Skip to content

Commit 7d86c70

Browse files
abelsiqueirac-martinez
authored andcommitted
Remove concept of basic/advanced. All steps are present in the stepper
1 parent a664378 commit 7d86c70

File tree

8 files changed

+50
-227
lines changed

8 files changed

+50
-227
lines changed

cypress/e2e/errors.cy.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { StepNameType } from 'src/store/app'
22

3-
const basicStepNames = ['start', 'authors'] as Array<StepNameType>
4-
const advancedStepNames = [
3+
const stepNames = [
4+
'start',
5+
'authors',
56
'identifiers',
67
'related-resources',
78
'abstract',
89
'keywords',
910
'license',
1011
'version-specific'
1112
] as Array<StepNameType>
12-
const allStepNames = [...basicStepNames, ...advancedStepNames]
1313

1414
describe('On application start', () => {
1515
// Since the stepper is separate from the screen itself, it doesn't matter which screen we join
@@ -20,7 +20,7 @@ describe('On application start', () => {
2020
cy.checkThatStepperValidityIs(false, step)
2121
})
2222
// Future proofing, in case more steps add considered basic
23-
allStepNames.filter(x => !stepsWithExpectedErrors.includes(x))
23+
stepNames.filter(x => !stepsWithExpectedErrors.includes(x))
2424
.forEach((step) => {
2525
cy.checkThatStepperValidityIs(true, step)
2626
})
@@ -32,7 +32,7 @@ describe('On application start', () => {
3232
})
3333
})
3434

35-
describe('From a fixed advanced app', () => {
35+
describe('From a fixed app', () => {
3636
beforeEach(() => {
3737
cy.visit('/start')
3838
cy.dataCy('input-title')
@@ -43,7 +43,7 @@ describe('From a fixed advanced app', () => {
4343
cy.visit('/identifiers')
4444
})
4545
it('should have no errors', () => {
46-
allStepNames.forEach((step) => {
46+
stepNames.forEach((step) => {
4747
cy.checkThatStepperValidityIs(true, step)
4848
cy.checkThatAppValidityIs(true)
4949
})

cypress/e2e/navigation.cy.ts

Lines changed: 14 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { StepNameType } from 'src/store/app'
22

3-
const basicStepNames = ['start', 'authors'] as Array<StepNameType>
4-
const advancedStepNames = [
3+
const stepNames = [
4+
'start',
5+
'authors',
56
'identifiers',
67
'related-resources',
78
'abstract',
89
'keywords',
910
'license',
1011
'version-specific'
1112
] as Array<StepNameType>
12-
const allStepNames = [...basicStepNames, ...advancedStepNames]
1313

1414
describe('App navigation', () => {
1515
it('should be able to go back through the logo button', () => {
@@ -18,70 +18,25 @@ describe('App navigation', () => {
1818
.click()
1919
cy.url().then((e) => expect(e.endsWith('#/')).to.be.true)
2020
})
21-
describe('during basic mode', () => {
22-
it(`should have ${basicStepNames.length + 1} steps on stepper`, () => {
23-
cy.visit('/start')
24-
cy.get('.q-stepper__tab')
25-
.should('have.length', basicStepNames.length + 1)
26-
})
27-
it('should allow navigation using next/previous', () => {
28-
cy.visit('/start')
29-
cy.dataCy('btn-previous')
30-
.should('not.be.visible')
31-
basicStepNames.forEach((step) => {
32-
cy.url().should('include', `/${step}`)
33-
cy.dataCy('btn-next')
34-
.click()
35-
cy.dataCy('btn-previous')
36-
.should('be.visible')
37-
})
38-
cy.url().should('include', '/finish')
39-
cy.dataCy('btn-next')
40-
.should('not.be.visible')
41-
Array.from(basicStepNames).reverse().forEach((step) => {
42-
cy.dataCy('btn-previous')
43-
.click()
44-
cy.url().should('include', `/${step}`)
45-
cy.dataCy('btn-next')
46-
.should('be.visible')
47-
})
48-
cy.url().should('include', '/start')
49-
cy.dataCy('btn-previous')
50-
.should('not.be.visible')
51-
})
52-
it('should be navigable through the stepper', () => {
53-
['finish', ...basicStepNames, ...[...basicStepNames].reverse()].forEach((step) => {
54-
cy.visit(step === 'start' ? '/authors' : `/${step}`)
55-
cy.dataCy(`step-${step}`)
56-
.click()
57-
cy.url()
58-
.should('contain', `/${step}`)
59-
})
60-
})
61-
})
62-
63-
describe('during advanced mode', () => {
21+
describe('basic checks', () => {
6422
beforeEach(() => {
6523
cy.visit('/start')
6624
cy.dataCy('input-title')
6725
.type('A')
6826
cy.visit('/authors')
6927
cy.dataCy('btn-add-author')
7028
.click()
71-
cy.visit('/finish')
72-
cy.dataCy('btn-add-more')
73-
.click()
7429
})
75-
it(`should have ${allStepNames.length + 1} steps on stepper`, () => {
30+
it(`should have ${stepNames.length + 1} steps on stepper`, () => {
7631
cy.visit('/start')
7732
cy.get('.q-stepper__tab')
78-
.should('have.length', allStepNames.length + 1)
33+
.should('have.length', stepNames.length + 1)
7934
})
8035
it('should allow navigation using next/previous ', () => {
8136
cy.visit('/start')
8237
cy.dataCy('btn-previous')
8338
.should('not.be.visible')
84-
allStepNames.forEach((step) => {
39+
stepNames.forEach((step) => {
8540
cy.url().should('include', `/${step}`)
8641
cy.dataCy('btn-next')
8742
.click()
@@ -91,7 +46,7 @@ describe('App navigation', () => {
9146
cy.url().should('include', '/finish')
9247
cy.dataCy('btn-next')
9348
.should('not.be.visible')
94-
Array.from(allStepNames).reverse().forEach((step) => {
49+
Array.from(stepNames).reverse().forEach((step) => {
9550
cy.dataCy('btn-previous')
9651
.click()
9752
cy.url().should('include', `/${step}`)
@@ -103,7 +58,7 @@ describe('App navigation', () => {
10358
.should('not.be.visible')
10459
})
10560
it('should be navigable through the stepper', () => {
106-
['finish', ...allStepNames, ...[...allStepNames].reverse()].forEach((step) => {
61+
['finish', ...stepNames, ...[...stepNames].reverse()].forEach((step) => {
10762
cy.visit(step === 'start' ? '/authors' : `/${step}`)
10863
cy.dataCy(`step-${step}`)
10964
.click()
@@ -113,7 +68,7 @@ describe('App navigation', () => {
11368
})
11469
describe('if there are no errors', () => {
11570
it('should jump from step to finish when finish is clicked', () => {
116-
allStepNames.forEach((step) => {
71+
stepNames.forEach((step) => {
11772
cy.visit(`/${step}`)
11873
// The next test is just to make sure the page loaded without using cy.wait
11974
cy.get('#form-title').should('not.contain', 'Congratulations')
@@ -128,48 +83,19 @@ describe('App navigation', () => {
12883
})
12984

13085
describe('while navigating directly to a page', () => {
131-
it(`should have ${allStepNames.length + 1} steps and visible finish/next/previous`, () => {
132-
advancedStepNames.forEach((step) => {
86+
it(`should have ${stepNames.length + 1} steps and visible finish/next/previous`, () => {
87+
stepNames.forEach((step) => {
13388
cy.visit(`/${step}`)
13489
cy.get('.q-stepper__tab')
135-
.should('have.length', allStepNames.length + 1)
90+
.should('have.length', stepNames.length + 1)
13691
cy.dataCy('btn-finish')
13792
.should('be.visible')
13893
cy.dataCy('btn-next')
13994
.should('be.visible')
14095
cy.dataCy('btn-previous')
141-
.should('be.visible')
96+
.should((step === 'start' ? 'not.' : '') + 'be.visible')
14297
})
14398
})
144-
it(`should have ${basicStepNames.length + 1} steps, visible next/previous, and hidden finish`, () => {
145-
basicStepNames.forEach((step) => {
146-
cy.visit(`/${step}`)
147-
cy.get('.q-stepper__tab')
148-
.should('have.length', basicStepNames.length + 1)
149-
cy.dataCy('btn-finish')
150-
.should('not.be.visible')
151-
cy.dataCy('btn-next')
152-
.should('be.visible')
153-
if (step === 'start') {
154-
cy.dataCy('btn-previous')
155-
.should('not.be.visible')
156-
} else {
157-
cy.dataCy('btn-previous')
158-
.should('be.visible')
159-
}
160-
})
161-
})
162-
it(`should have ${basicStepNames.length + 1} steps, visible previous, hidden next/finish for step finish`, () => {
163-
cy.visit('/finish')
164-
cy.get('.q-stepper__tab')
165-
.should('have.length', basicStepNames.length + 1)
166-
cy.dataCy('btn-finish')
167-
.should('not.be.visible')
168-
cy.dataCy('btn-next')
169-
.should('not.be.visible')
170-
cy.dataCy('btn-previous')
171-
.should('be.visible')
172-
})
17399
})
174100

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

cypress/e2e/spec.cy.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ describe('Basic usage', () => {
7070
cy.dataCy('btn-next')
7171
.click()
7272

73-
// Finish screen (minimum version)
73+
// Finish screen
74+
cy.dataCy('btn-finish')
75+
.click()
7476
cy.url().should('include', '/finish')
7577
cy.dataCy('btn-download')
7678
.click()
@@ -124,11 +126,6 @@ describe('Basic usage', () => {
124126
cy.dataCy('btn-next')
125127
.click()
126128

127-
// Finish screen (minimum version)
128-
cy.url().should('include', '/finish')
129-
cy.dataCy('btn-add-more')
130-
.click()
131-
132129
// Identifiers screen
133130
cy.url().should('include', '/identifiers')
134131
cy.dataCy('btn-add-identifier')
@@ -228,7 +225,7 @@ describe('Basic usage', () => {
228225
cy.dataCy('btn-next')
229226
.click()
230227

231-
// Finish screen (advanced version)
228+
// Finish screen
232229
cy.url().should('include', '/finish')
233230
cy.dataCy('btn-download')
234231
.click()

src/components/ScreenFinish.vue

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,14 @@
1515
</h1>
1616

1717
<div v-if="isValidCFF">
18-
<p
19-
v-if="!showAdvanced"
20-
>
21-
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.
22-
</p>
23-
<p
24-
v-else
25-
>
18+
<p>
2619
Use the buttons below to download your CITATION.cff file, or reset the form to start over.
2720
</p>
2821
<p>
2922
Distribute the CITATION.cff with your project, for instance, by adding it to the root of your GitHub repository.
3023
</p>
3124
<div class="row q-gutter-md justify-center">
3225
<DownloadButton />
33-
<q-btn
34-
v-if="!showAdvanced"
35-
class="rounded-borders bg-primary text-white"
36-
data-cy="btn-add-more"
37-
icon="workspace_premium"
38-
label="Add more fields"
39-
no-caps
40-
size="xl"
41-
to="/identifiers"
42-
v-on:click="setupAdvanced"
43-
/>
4426
</div>
4527
<div class="row justify-center">
4628
<q-btn
@@ -73,7 +55,7 @@ export default defineComponent({
7355
DownloadButton
7456
},
7557
setup () {
76-
const { setStepName, setShowAdvanced, showAdvanced } = useApp()
58+
const { setStepName } = useApp()
7759
const { reset: resetCffData } = useCff()
7860
const { errors } = useValidation()
7961
const q = useQuasar()
@@ -86,16 +68,10 @@ export default defineComponent({
8668
persistent: true
8769
}).onOk(() => {
8870
resetCffData()
89-
setShowAdvanced(false)
9071
void setStepName('start')
9172
})
9273
},
93-
isValidCFF: computed(() => errors.value.length === 0),
94-
setupAdvanced: async () => {
95-
setShowAdvanced(true)
96-
await setStepName('identifiers')
97-
},
98-
showAdvanced
74+
isValidCFF: computed(() => errors.value.length === 0)
9975
}
10076
}
10177
})

src/components/Stepper.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
v-for="(step, stepIndex) in stepNames"
1616
v-bind:active-icon="activeIcon(errorPerStep[step].value, step)"
1717
v-bind:aria-label="toLabel(step)"
18+
v-bind:caption="stepIndex < 2 ? 'required' : ''"
1819
v-bind:data-cy="`step-${step}`"
1920
v-bind:done="currentStepIndex > stepIndex"
2021
v-bind:error="errorPerStep[step].value"

src/components/StepperActions.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
label="Finish"
2222
no-caps
2323
to="/finish"
24-
v-bind:class="!showAdvanced || cannotGoForward ? 'hidden' : ''"
24+
v-bind:class="cannotGoForward ? 'hidden' : ''"
2525
v-on:click="setStepName('finish')"
2626
/>
2727
<q-btn
@@ -46,15 +46,14 @@ export default defineComponent({
4646
name: 'StepperActions',
4747
4848
setup () {
49-
const { cannotGoBack, cannotGoForward, navigateNext, navigatePrevious, setStepName, showAdvanced } = useApp()
49+
const { cannotGoBack, cannotGoForward, navigateNext, navigatePrevious, setStepName } = useApp()
5050
5151
return {
5252
cannotGoBack,
5353
cannotGoForward,
5454
navigateNext,
5555
navigatePrevious,
56-
setStepName,
57-
showAdvanced
56+
setStepName
5857
}
5958
}
6059

0 commit comments

Comments
 (0)