Commit e96878e3 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo Committed by Kushal Pandya

Refactor specs to match current guidelines

Replace done callbacks with async/await, update
to use finders instead of classes and add a
createComponent method
parent 965377e5
......@@ -96,7 +96,12 @@ export default {
</script>
<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" />
<div class="time-tracking-collapsed-summary">
<div :class="divClass">
......
......@@ -70,14 +70,19 @@ export default {
</script>
<template>
<div class="time-tracking-comparison-pane">
<div data-testid="timeTrackingComparisonPane">
<div
v-gl-tooltip
data-testid="compareMeter"
:title="timeRemainingTooltip"
:class="timeRemainingStatusClass"
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 float-left">
<span class="compare-label">{{ s__('TimeTracking|Spent') }}</span>
......
......@@ -11,7 +11,8 @@ export default {
</script>
<template>
<div class="time-tracking-estimate-only-pane">
<span class="bold"> {{ s__('TimeTracking|Estimated:') }} </span> {{ timeEstimateHumanReadable }}
<div data-testid="estimateOnlyPane">
<span class="gl-font-weight-bold">{{ s__('TimeTracking|Estimated:') }} </span
>{{ timeEstimateHumanReadable }}
</div>
</template>
......@@ -34,7 +34,7 @@ export default {
</script>
<template>
<div class="time-tracking-help-state">
<div data-testid="helpPane" class="time-tracking-help-state">
<div class="time-tracking-info">
<h4>{{ __('Track time with quick actions') }}</h4>
<p>{{ __('Quick actions can be used in the issues description and comment boxes.') }}</p>
......
......@@ -5,7 +5,7 @@ export default {
</script>
<template>
<div class="time-tracking-no-tracking-pane">
<span class="no-value"> {{ __('No estimate or time spent') }} </span>
<div data-testid="noTrackingPane">
<span class="no-value">{{ __('No estimate or time spent') }}</span>
</div>
</template>
......@@ -15,7 +15,7 @@ export default {
return sprintf(
s__('TimeTracking|%{startTag}Spent: %{endTag}%{timeSpentHumanReadable}'),
{
startTag: '<span class="bold">',
startTag: '<span class="gl-font-weight-bold">',
endTag: '</span>',
timeSpentHumanReadable: this.timeSpentHumanReadable,
},
......@@ -27,5 +27,5 @@ export default {
</script>
<template>
<div class="time-tracking-spend-only-pane" v-html="timeSpent"></div>
<div data-testid="spentOnlyPane" v-html="timeSpent"></div>
</template>
......@@ -105,11 +105,17 @@ export default {
/>
<div class="title hide-collapsed">
{{ __('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" />
</div>
<div
v-if="showHelpState"
v-else
data-testid="closeHelpButton"
class="close-help-button float-right"
@click="toggleHelpState(false)"
>
......
......@@ -76,7 +76,7 @@ RSpec.describe 'Milestone' do
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'
end
end
......@@ -94,7 +94,7 @@ RSpec.describe 'Milestone' do
wait_for_requests
page.within('.time-tracking-spend-only-pane') do
page.within('[data-testid="spentOnlyPane"]') do
expect(page).to have_content 'Spent: 3h'
end
end
......
......@@ -13,7 +13,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type|
end
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'
end
end
......@@ -22,7 +22,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type|
submit_time('/estimate 3w 1d 1h')
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'
end
end
......@@ -31,7 +31,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type|
submit_time('/spend 3w 1d 1h')
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'
end
end
......@@ -41,7 +41,7 @@ RSpec.shared_examples 'issuable time tracker' do |issuable_type|
submit_time('/spend 3w 1d 1h')
wait_for_requests
page.within '.time-tracking-comparison-pane' do
page.within '[data-testid="timeTrackingComparisonPane"]' do
expect(page).to have_content '3w 1d 1h'
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