Commit d1d688cf authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ek-update-time-tracking-specs' into 'master'

Updates the time tracking specs to use vue-test-utils

See merge request gitlab-org/gitlab!44979
parents 012093ff e96878e3
...@@ -96,7 +96,12 @@ export default { ...@@ -96,7 +96,12 @@ export default {
</script> </script>
<template> <template>
<div v-gl-tooltip:body.viewport.left :title="tooltipText" class="sidebar-collapsed-icon"> <div
v-gl-tooltip:body.viewport.left
:title="tooltipText"
data-testid="collapsedState"
class="sidebar-collapsed-icon"
>
<gl-icon name="timer" /> <gl-icon name="timer" />
<div class="time-tracking-collapsed-summary"> <div class="time-tracking-collapsed-summary">
<div :class="divClass"> <div :class="divClass">
......
...@@ -70,14 +70,19 @@ export default { ...@@ -70,14 +70,19 @@ export default {
</script> </script>
<template> <template>
<div class="time-tracking-comparison-pane"> <div data-testid="timeTrackingComparisonPane">
<div <div
v-gl-tooltip v-gl-tooltip
data-testid="compareMeter"
:title="timeRemainingTooltip" :title="timeRemainingTooltip"
:class="timeRemainingStatusClass" :class="timeRemainingStatusClass"
class="compare-meter" class="compare-meter"
> >
<gl-progress-bar :value="timeRemainingPercent" :variant="progressBarVariant" /> <gl-progress-bar
data-testid="timeRemainingProgress"
:value="timeRemainingPercent"
:variant="progressBarVariant"
/>
<div class="compare-display-container"> <div class="compare-display-container">
<div class="compare-display float-left"> <div class="compare-display float-left">
<span class="compare-label">{{ s__('TimeTracking|Spent') }}</span> <span class="compare-label">{{ s__('TimeTracking|Spent') }}</span>
......
...@@ -11,7 +11,8 @@ export default { ...@@ -11,7 +11,8 @@ export default {
</script> </script>
<template> <template>
<div class="time-tracking-estimate-only-pane"> <div data-testid="estimateOnlyPane">
<span class="bold"> {{ s__('TimeTracking|Estimated:') }} </span> {{ timeEstimateHumanReadable }} <span class="gl-font-weight-bold">{{ s__('TimeTracking|Estimated:') }} </span
>{{ timeEstimateHumanReadable }}
</div> </div>
</template> </template>
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
</script> </script>
<template> <template>
<div class="time-tracking-help-state"> <div data-testid="helpPane" class="time-tracking-help-state">
<div class="time-tracking-info"> <div class="time-tracking-info">
<h4>{{ __('Track time with quick actions') }}</h4> <h4>{{ __('Track time with quick actions') }}</h4>
<p>{{ __('Quick actions can be used in the issues description and comment boxes.') }}</p> <p>{{ __('Quick actions can be used in the issues description and comment boxes.') }}</p>
......
...@@ -5,7 +5,7 @@ export default { ...@@ -5,7 +5,7 @@ export default {
</script> </script>
<template> <template>
<div class="time-tracking-no-tracking-pane"> <div data-testid="noTrackingPane">
<span class="no-value"> {{ __('No estimate or time spent') }} </span> <span class="no-value">{{ __('No estimate or time spent') }}</span>
</div> </div>
</template> </template>
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
return sprintf( return sprintf(
s__('TimeTracking|%{startTag}Spent: %{endTag}%{timeSpentHumanReadable}'), s__('TimeTracking|%{startTag}Spent: %{endTag}%{timeSpentHumanReadable}'),
{ {
startTag: '<span class="bold">', startTag: '<span class="gl-font-weight-bold">',
endTag: '</span>', endTag: '</span>',
timeSpentHumanReadable: this.timeSpentHumanReadable, timeSpentHumanReadable: this.timeSpentHumanReadable,
}, },
...@@ -27,5 +27,5 @@ export default { ...@@ -27,5 +27,5 @@ export default {
</script> </script>
<template> <template>
<div class="time-tracking-spend-only-pane" v-html="timeSpent"></div> <div data-testid="spentOnlyPane" v-html="timeSpent"></div>
</template> </template>
...@@ -105,11 +105,17 @@ export default { ...@@ -105,11 +105,17 @@ export default {
/> />
<div class="title hide-collapsed"> <div class="title hide-collapsed">
{{ __('Time tracking') }} {{ __('Time tracking') }}
<div v-if="!showHelpState" class="help-button float-right" @click="toggleHelpState(true)"> <div
v-if="!showHelpState"
data-testid="helpButton"
class="help-button float-right"
@click="toggleHelpState(true)"
>
<gl-icon name="question-o" /> <gl-icon name="question-o" />
</div> </div>
<div <div
v-if="showHelpState" v-else
data-testid="closeHelpButton"
class="close-help-button float-right" class="close-help-button float-right"
@click="toggleHelpState(false)" @click="toggleHelpState(false)"
> >
......
...@@ -76,7 +76,7 @@ RSpec.describe 'Milestone' do ...@@ -76,7 +76,7 @@ RSpec.describe 'Milestone' do
wait_for_requests wait_for_requests
page.within('.time-tracking-no-tracking-pane') do page.within('[data-testid="noTrackingPane"]') do
expect(page).to have_content 'No estimate or time spent' expect(page).to have_content 'No estimate or time spent'
end end
end end
...@@ -94,7 +94,7 @@ RSpec.describe 'Milestone' do ...@@ -94,7 +94,7 @@ RSpec.describe 'Milestone' do
wait_for_requests wait_for_requests
page.within('.time-tracking-spend-only-pane') do page.within('[data-testid="spentOnlyPane"]') do
expect(page).to have_content 'Spent: 3h' expect(page).to have_content 'Spent: 3h'
end end
end end
......
...@@ -13,7 +13,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type| ...@@ -13,7 +13,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type|
end end
it 'renders the sidebar component empty state' do it 'renders the sidebar component empty state' do
page.within '.time-tracking-no-tracking-pane' do page.within '[data-testid="noTrackingPane"]' do
expect(page).to have_content 'No estimate or time spent' expect(page).to have_content 'No estimate or time spent'
end end
end end
...@@ -22,7 +22,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type| ...@@ -22,7 +22,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type|
submit_time('/estimate 3w 1d 1h') submit_time('/estimate 3w 1d 1h')
wait_for_requests wait_for_requests
page.within '.time-tracking-estimate-only-pane' do page.within '[data-testid="estimateOnlyPane"]' do
expect(page).to have_content '3w 1d 1h' expect(page).to have_content '3w 1d 1h'
end end
end end
...@@ -31,7 +31,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type| ...@@ -31,7 +31,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type|
submit_time('/spend 3w 1d 1h') submit_time('/spend 3w 1d 1h')
wait_for_requests wait_for_requests
page.within '.time-tracking-spend-only-pane' do page.within '[data-testid="spentOnlyPane"]' do
expect(page).to have_content '3w 1d 1h' expect(page).to have_content '3w 1d 1h'
end end
end end
...@@ -41,7 +41,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type| ...@@ -41,7 +41,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type|
submit_time('/spend 3w 1d 1h') submit_time('/spend 3w 1d 1h')
wait_for_requests wait_for_requests
page.within '.time-tracking-comparison-pane' do page.within '[data-testid="timeTrackingComparisonPane"]' do
expect(page).to have_content '3w 1d 1h' expect(page).to have_content '3w 1d 1h'
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment