Skip to content

Commit be0e043

Browse files
authored
Merge pull request #736 from citation-file-format/453-refactor-finish
2 parents 54269e6 + c675a4c commit be0e043

11 files changed

Lines changed: 89 additions & 183 deletions

File tree

cypress/e2e/errors.cy.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('On application start', () => {
1515
// Since the stepper is separate from the screen itself, it doesn't matter which screen we join
1616
const stepsWithExpectedErrors = ['start', 'authors']
1717
it('should have errors in start and authors, but not in any other steps', () => {
18-
cy.visit('/finish-advanced')
18+
cy.visit('/identifiers')
1919
stepsWithExpectedErrors.forEach((step) => {
2020
cy.checkThatStepperValidityIs(false, step)
2121
})
@@ -43,10 +43,9 @@ describe('From a fixed advanced app', () => {
4343
cy.visit('/authors')
4444
cy.dataCy('btn-add-author')
4545
.click()
46-
cy.visit('/finish-advanced')
46+
cy.visit('/identifiers')
4747
})
4848
it('should have no errors', () => {
49-
cy.visit('/finish-advanced')
5049
allStepNames.forEach((step) => {
5150
cy.checkThatStepperValidityIs(true, step)
5251
cy.dataCy('ta-cff-preview')

cypress/e2e/navigation.cy.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('App navigation', () => {
2929
cy.dataCy('btn-previous')
3030
.should('be.visible')
3131
})
32-
cy.url().should('include', '/finish-minimum')
32+
cy.url().should('include', '/finish')
3333
cy.dataCy('btn-next')
3434
.should('not.be.visible')
3535
Array.from(basicStepNames).reverse().forEach((step) => {
@@ -44,7 +44,7 @@ describe('App navigation', () => {
4444
.should('not.be.visible')
4545
})
4646
it('should be navigable through the stepper', () => {
47-
['finish-minimum', ...basicStepNames, ...[...basicStepNames].reverse()].forEach((step) => {
47+
['finish', ...basicStepNames, ...[...basicStepNames].reverse()].forEach((step) => {
4848
cy.visit(step === 'start' ? '/authors' : `/${step}`)
4949
cy.dataCy(`step-${step}`)
5050
.click()
@@ -62,7 +62,7 @@ describe('App navigation', () => {
6262
cy.visit('/authors')
6363
cy.dataCy('btn-add-author')
6464
.click()
65-
cy.visit('/finish-minimum')
65+
cy.visit('/finish')
6666
cy.dataCy('btn-add-more')
6767
.click()
6868
})
@@ -82,7 +82,7 @@ describe('App navigation', () => {
8282
cy.dataCy('btn-previous')
8383
.should('be.visible')
8484
})
85-
cy.url().should('include', '/finish-advanced')
85+
cy.url().should('include', '/finish')
8686
cy.dataCy('btn-next')
8787
.should('not.be.visible')
8888
Array.from(allStepNames).reverse().forEach((step) => {
@@ -97,7 +97,7 @@ describe('App navigation', () => {
9797
.should('not.be.visible')
9898
})
9999
it('should be navigable through the stepper', () => {
100-
['finish-advanced', ...allStepNames, ...[...allStepNames].reverse()].forEach((step) => {
100+
['finish', ...allStepNames, ...[...allStepNames].reverse()].forEach((step) => {
101101
cy.visit(step === 'start' ? '/authors' : `/${step}`)
102102
cy.dataCy(`step-${step}`)
103103
.click()
@@ -106,7 +106,7 @@ describe('App navigation', () => {
106106
})
107107
})
108108
describe('if there are no errors', () => {
109-
it('should jump from step to finish-advanced when finish is clicked', () => {
109+
it('should jump from step to finish when finish is clicked', () => {
110110
allStepNames.forEach((step) => {
111111
cy.visit(`/${step}`)
112112
// The next test is just to make sure the page loaded without using cy.wait
@@ -115,7 +115,7 @@ describe('App navigation', () => {
115115
.should('be.visible')
116116
.click()
117117
cy.url()
118-
.should('contain', '/finish-advanced')
118+
.should('contain', '/finish')
119119
})
120120
})
121121
})
@@ -153,8 +153,8 @@ describe('App navigation', () => {
153153
}
154154
})
155155
})
156-
it(`should have ${basicStepNames.length + 1} steps, visible previous, hidden next/finish for step finish-minimum`, () => {
157-
cy.visit('/finish-minimum')
156+
it(`should have ${basicStepNames.length + 1} steps, visible previous, hidden next/finish for step finish`, () => {
157+
cy.visit('/finish')
158158
cy.get('.q-stepper__tab')
159159
.should('have.length', basicStepNames.length + 1)
160160
cy.dataCy('btn-finish')
@@ -164,17 +164,6 @@ describe('App navigation', () => {
164164
cy.dataCy('btn-previous')
165165
.should('be.visible')
166166
})
167-
it(`should have ${advancedStepNames.length + 1} steps, visible previous, hidden next/finish for step finish-advanced`, () => {
168-
cy.visit('/finish-advanced')
169-
cy.get('.q-stepper__tab')
170-
.should('have.length', allStepNames.length + 1)
171-
cy.dataCy('btn-finish')
172-
.should('not.be.visible')
173-
cy.dataCy('btn-next')
174-
.should('not.be.visible')
175-
cy.dataCy('btn-previous')
176-
.should('be.visible')
177-
})
178167
})
179168

180169
describe('On the screen Authors', () => {

cypress/e2e/spec.cy.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ describe('Basic usage', () => {
7474
cy.dataCy('btn-next')
7575
.click()
7676

77-
// Finish Minimum screen
78-
cy.url().should('include', '/finish-minimum')
77+
// Finish screen (minimum version)
78+
cy.url().should('include', '/finish')
7979
cy.dataCy('btn-download')
8080
.click()
8181
const downloadsFolder = Cypress.config('downloadsFolder')
@@ -130,8 +130,8 @@ describe('Basic usage', () => {
130130
cy.dataCy('btn-next')
131131
.click()
132132

133-
// Finish Minimum screen
134-
cy.url().should('include', '/finish-minimum')
133+
// Finish screen (minimum version)
134+
cy.url().should('include', '/finish')
135135
cy.dataCy('btn-add-more')
136136
.click()
137137

@@ -240,8 +240,8 @@ describe('Basic usage', () => {
240240
cy.dataCy('btn-next')
241241
.click()
242242

243-
// Finish Advanced screen
244-
cy.url().should('include', '/finish-advanced')
243+
// Finish screen (advanced version)
244+
cy.url().should('include', '/finish')
245245
cy.dataCy('btn-download')
246246
.click()
247247

src/components/LayoutStepper.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default defineComponent({
9494
return {
9595
isNotFinish: computed(() => {
9696
const currentPath = useRoute().path
97-
return currentPath !== '/finish-minimum' && currentPath !== '/finish-advanced'
97+
return currentPath !== '/finish'
9898
}),
9999
isPreviewDrawerEnabled,
100100
onTogglePreview: () => { isPreviewDrawerEnabled.value = !isPreviewDrawerEnabled.value }
Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,36 @@
1313
</h1>
1414

1515
<div v-if="isValidCFF">
16-
<p class="finish-paragraph">
16+
<p
17+
v-if="!showAdvanced"
18+
class="finish-paragraph"
19+
>
20+
You now have a minimal CITATION.cff file. Use the buttons below to download your CITATION.cff file, continue adding more properties, or reset the form.
21+
</p>
22+
<p
23+
v-else
24+
class="finish-paragraph"
25+
>
1726
Use the buttons below to download your CITATION.cff file, or reset the form to start over.
1827
</p>
1928
<p class="finish-paragraph">
2029
Distribute the CITATION.cff with your project, for instance, by adding it to the root of your GitHub repository.
2130
</p>
2231
<div class="row">
2332
<DownloadButton class="col-4 q-ma-lg" />
33+
<q-btn
34+
v-if="!showAdvanced"
35+
class="col-4 q-ma-lg"
36+
color="primary"
37+
data-cy="btn-add-more"
38+
icon="workspace_premium"
39+
label="Add more"
40+
no-caps
41+
size="xl"
42+
to="/identifiers"
43+
v-on:click="setupAdvanced"
44+
v-bind:class="q.platform.is.mobile ? 'full-width' : ''"
45+
/>
2446
</div>
2547
<div class="row">
2648
<q-btn
@@ -51,18 +73,17 @@ import { useStepperErrors } from 'src/store/stepper-errors'
5173
import { useValidation } from 'src/store/validation'
5274
5375
export default defineComponent({
54-
name: 'ScreenFinishAdvanced',
76+
name: 'ScreenFinish',
5577
components: {
5678
DownloadButton
5779
},
5880
setup () {
59-
const { setStepName, setShowAdvanced } = useApp()
81+
const { setStepName, setShowAdvanced, showAdvanced } = useApp()
6082
const { reset: resetCffData } = useCff()
6183
const { reset: resetStepperErrorState } = useStepperErrors()
6284
const { errors } = useValidation()
6385
const q = useQuasar()
6486
return {
65-
isValidCFF: computed(() => errors.value.length === 0),
6687
confirmAndReset: () => {
6788
q.dialog({
6889
title: 'Confirm',
@@ -75,7 +96,14 @@ export default defineComponent({
7596
setShowAdvanced(false)
7697
await setStepName('start')
7798
})
78-
}
99+
},
100+
isValidCFF: computed(() => errors.value.length === 0),
101+
q,
102+
setupAdvanced: async () => {
103+
setShowAdvanced(true)
104+
await setStepName('identifiers')
105+
},
106+
showAdvanced
79107
}
80108
}
81109
})

src/components/ScreenFinishMinimum.vue

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/components/Stepper.vue

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,13 @@
3232
v-on:click="setStepName('authors')"
3333
/>
3434

35-
<q-step
36-
active-icon="navigate_next"
37-
data-cy="step-finish-minimum"
38-
name="finish-minimum"
39-
title="Finish"
40-
v-bind:order="2"
41-
v-if="!showAdvanced"
42-
v-on:click="setStepName('finish-minimum')"
43-
/>
44-
4535
<q-step
4636
data-cy="step-identifiers"
4737
name="identifiers"
4838
title="Identifiers"
4939
v-bind:active-icon="errorStateScreenIdentifiers ? 'warning' : 'edit'"
5040
v-bind:error="errorStateScreenIdentifiers"
51-
v-bind:order="3"
41+
v-bind:order="2"
5242
v-if="showAdvanced"
5343
v-on:click="setStepName('identifiers')"
5444
/>
@@ -59,7 +49,7 @@
5949
title="Related resources"
6050
v-bind:active-icon="errorStateScreenRelatedResources ? 'warning' : 'edit'"
6151
v-bind:error="errorStateScreenRelatedResources"
62-
v-bind:order="4"
52+
v-bind:order="3"
6353
v-if="showAdvanced"
6454
v-on:click="setStepName('related-resources')"
6555
/>
@@ -68,7 +58,7 @@
6858
data-cy="step-abstract"
6959
name="abstract"
7060
title="Abstract"
71-
v-bind:order="5"
61+
v-bind:order="4"
7262
v-if="showAdvanced"
7363
v-on:click="setStepName('abstract')"
7464
/>
@@ -79,7 +69,7 @@
7969
title="Keywords"
8070
v-bind:active-icon="errorStateScreenKeywords ? 'warning' : 'edit'"
8171
v-bind:error="errorStateScreenKeywords"
82-
v-bind:order="6"
72+
v-bind:order="5"
8373
v-if="showAdvanced"
8474
v-on:click="setStepName('keywords')"
8575
/>
@@ -88,7 +78,7 @@
8878
data-cy="step-license"
8979
name="license"
9080
title="License"
91-
v-bind:order="7"
81+
v-bind:order="6"
9282
v-if="showAdvanced"
9383
v-on:click="setStepName('license')"
9484
/>
@@ -99,19 +89,18 @@
9989
title="Version specific"
10090
v-bind:active-icon="errorStateScreenVersionSpecific ? 'warning' : 'edit'"
10191
v-bind:error="errorStateScreenVersionSpecific"
102-
v-bind:order="8"
92+
v-bind:order="7"
10393
v-if="showAdvanced"
10494
v-on:click="setStepName('version-specific')"
10595
/>
10696

10797
<q-step
10898
active-icon="navigate_next"
109-
data-cy="step-finish-advanced"
110-
name="finish-advanced"
99+
data-cy="step-finish"
100+
name="finish"
111101
title="Finish"
112-
v-bind:order="9"
113-
v-if="showAdvanced"
114-
v-on:click="setStepName('finish-advanced')"
102+
v-bind:order="showAdvanced ? 8 : 2"
103+
v-on:click="setStepName('finish')"
115104
/>
116105
</q-stepper>
117106
</template>

0 commit comments

Comments
 (0)