Skip to content

Commit 8f7912b

Browse files
authored
Merge pull request #776 from citation-file-format/617-stop-using-error-classes
2 parents 5609546 + 33bd10a commit 8f7912b

10 files changed

Lines changed: 14 additions & 59 deletions

cypress/e2e/errors.cy.ts

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ describe('On application start', () => {
2727
})
2828
it('should have error on preview', () => {
2929
cy.visit('/start')
30-
cy.dataCy('ta-cff-preview')
31-
.should('have.class', 'error')
3230
cy.dataCy('text-validation-msg')
33-
.should('have.class', 'invalid')
3431
.should('contain.text', 'minimum')
3532
})
3633
})
@@ -48,11 +45,7 @@ describe('From a fixed advanced app', () => {
4845
it('should have no errors', () => {
4946
allStepNames.forEach((step) => {
5047
cy.checkThatStepperValidityIs(true, step)
51-
cy.dataCy('ta-cff-preview')
52-
.should('not.have.class', 'error')
53-
cy.dataCy('text-validation-msg')
54-
.should('not.have.class', 'invalid')
55-
.should('contain.text', 'Your CITATION.cff is valid')
48+
cy.checkThatAppValidityIs(true)
5649
})
5750
})
5851
it('should validate screen Start', () => {
@@ -61,11 +54,7 @@ describe('From a fixed advanced app', () => {
6154
cy.dataCy('input-title')
6255
.clear()
6356
cy.checkThatStepperValidityIs(false, 'start')
64-
cy.dataCy('ta-cff-preview')
65-
.should('have.class', 'error')
66-
cy.dataCy('text-validation-msg')
67-
.should('have.class', 'invalid')
68-
.should('contain.text', 'minimum')
57+
cy.checkThatAppValidityIs(false)
6958
cy.checkThatInputValidityIs(false, 'title')
7059
cy.get('.q-field__messages > div')
7160
.should('have.length', 1)
@@ -77,11 +66,7 @@ describe('From a fixed advanced app', () => {
7766

7867
cy.checkThatInputValidityIs(true, 'message')
7968
cy.checkThatStepperValidityIs(true, 'start')
80-
cy.dataCy('ta-cff-preview')
81-
.should('not.have.class', 'error')
82-
cy.dataCy('text-validation-msg')
83-
.should('not.have.class', 'invalid')
84-
.should('contain.text', 'Your CITATION.cff is valid')
69+
cy.checkThatAppValidityIs(true)
8570
})
8671

8772
describe('On screen Authors', () => {
@@ -93,21 +78,13 @@ describe('From a fixed advanced app', () => {
9378
cy.dataCy('btn-remove')
9479
.click()
9580
cy.checkThatStepperValidityIs(false, 'authors')
96-
cy.dataCy('ta-cff-preview')
97-
.should('have.class', 'error')
98-
cy.dataCy('text-validation-msg')
99-
.should('have.class', 'invalid')
100-
.should('contain.text', 'minimum')
81+
cy.checkThatAppValidityIs(false)
10182
cy.get('.q-banner')
10283
.should('contain.text', 'Use the button to add an author')
10384
cy.dataCy('btn-add-author')
10485
.click()
10586
cy.checkThatStepperValidityIs(true, 'authors')
106-
cy.dataCy('ta-cff-preview')
107-
.should('not.have.class', 'error')
108-
cy.dataCy('text-validation-msg')
109-
.should('not.have.class', 'invalid')
110-
.should('contain.text', 'Your CITATION.cff is valid')
87+
cy.checkThatAppValidityIs(true)
11188
})
11289
it('should validate duplicate authors', () => {
11390
cy.dataCy('btn-remove')
@@ -126,24 +103,16 @@ describe('From a fixed advanced app', () => {
126103
.click()
127104

128105
cy.dataCy('card-author0')
129-
.should('have.class', 'has-error')
106+
.should('have.class', 'red-border')
130107
cy.checkThatStepperValidityIs(false, 'authors')
131-
cy.dataCy('ta-cff-preview')
132-
.should('have.class', 'error')
133-
cy.dataCy('text-validation-msg')
134-
.should('have.class', 'invalid')
135-
.should('contain.text', 'minimum')
108+
cy.checkThatAppValidityIs(false)
136109
cy.get('.q-banner')
137110
.should('contain.text', 'There are duplicate authors')
138111

139112
cy.dataCy('btn-remove0')
140113
.click()
141114
cy.checkThatStepperValidityIs(true, 'authors')
142-
cy.dataCy('ta-cff-preview')
143-
.should('not.have.class', 'error')
144-
cy.dataCy('text-validation-msg')
145-
.should('not.have.class', 'invalid')
146-
.should('contain.text', 'Your CITATION.cff is valid')
115+
cy.checkThatAppValidityIs(true)
147116
})
148117
it('should validate authors\' fields', () => {
149118
cy.dataCy('btn-remove')
@@ -169,7 +138,7 @@ describe('From a fixed advanced app', () => {
169138
cy.dataCy('input-orcid')
170139
.type('23412341234123X')
171140
.parents('.q-field')
172-
.should('not.have.class', 'has-error')
141+
.should('not.have.class', 'q-field--error')
173142
cy.checkThatStepperValidityIs(true, 'authors')
174143
cy.checkThatAppValidityIs(true)
175144
})
@@ -241,7 +210,7 @@ describe('From a fixed advanced app', () => {
241210
cy.dataCy('btn-done')
242211
.click()
243212
cy.dataCy('card-identifier0')
244-
.should('have.class', 'has-error')
213+
.should('have.class', 'red-border')
245214
cy.get('.q-banner')
246215
.should('contain.text', 'There are duplicate identifier')
247216
cy.checkThatStepperValidityIs(false, 'identifiers')
@@ -328,7 +297,7 @@ describe('From a fixed advanced app', () => {
328297
cy.dataCy('input-date-released')
329298
.type('1111111')
330299
.parents('.q-field')
331-
.should('not.have.class', 'has-error')
300+
.should('not.have.class', 'q-field--error')
332301
cy.checkThatStepperValidityIs(true, 'version-specific')
333302
cy.checkThatAppValidityIs(true)
334303
})

cypress/support/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,13 @@ Cypress.Commands.add('findInputError', (input) => {
6565
Cypress.Commands.add('checkThatInputValidityIs', (passing, input) => {
6666
cy.dataCy(`input-${input}`)
6767
.parents('.q-field')
68-
.should(prependIf(passing, 'have.class'), 'has-error')
68+
.should(prependIf(passing, 'have.class'), 'q-field--error')
6969
.find('.q-field__messages > div')
7070
.should(prependIf(passing, 'exist'))
7171
})
7272

7373
Cypress.Commands.add('checkThatAppValidityIs', (passing) => {
74-
cy.dataCy('ta-cff-preview')
75-
.should(prependIf(passing, 'have.class'), 'error')
7674
cy.dataCy('text-validation-msg')
77-
.should(prependIf(passing, 'have.class'), 'invalid')
7875
.should(prependIf(!passing, 'contain.text'), 'Your CITATION.cff is valid')
7976
.should(prependIf(passing, 'contain.text'), 'not')
8077
})

src/components/AuthorCardEditing.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
standout
7878
type="email"
7979
v-bind:model-value="email"
80-
v-bind:class="emailErrors.length > 0 ? 'has-error' : ''"
8180
v-bind:error="emailErrors.length > 0"
8281
v-bind:error-message="emailErrors.join(', ')"
8382
v-on:update:modelValue="$emit('update', 'email', $event)"
@@ -117,7 +116,6 @@
117116
mask="https://orcid.org/####-####-####-###X"
118117
outlined
119118
standout
120-
v-bind:class="orcidErrors.length > 0 ? 'has-error' : ''"
121119
v-bind:model-value="orcid"
122120
v-bind:error="orcidErrors.length > 0"
123121
v-bind:error-message="orcidErrors.join(', ')"

src/components/AuthorCardViewing.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
22
<q-card
33
bordered
4-
v-bind:class="['bg-formcard', authorErrors.length > 0 ? 'red-border has-error' : '']"
54
flat
65
style="display: flex; flex-direction: row"
6+
v-bind:class="['bg-formcard', authorErrors.length > 0 ? 'red-border' : '']"
77
>
88
<div style="flex-grow: 1.0">
99
<ul v-bind:data-cy="'card-info' + index">

src/components/IdentifierCardEditing.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
outlined
3838
standout
3939
v-bind:aria-label="`Value of the ${label}. Press tab to reach help button.`"
40-
v-bind:class="identifierValueErrors.length > 0 ? 'has-error' : ''"
4140
v-bind:error-message="identifierValueErrors.join(', ')"
4241
v-bind:error="identifierValueErrors.length > 0"
4342
v-bind:label="`Value of the ${label}`"

src/components/IdentifierCardViewing.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<q-card
33
bordered
4-
v-bind:class="['bg-formcard', identifierErrors.length > 0 ? 'red-border has-error' : '']"
4+
v-bind:class="['bg-formcard', identifierErrors.length > 0 ? 'red-border' : '']"
55
flat
66
style="display: flex; flex-direction: row"
77
>

src/components/Keyword.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
dense
88
outlined
99
placeholder="Type a keyword"
10-
v-bind:class="validationErrors.length > 0 ? 'has-error' : ''"
1110
v-bind:data-cy="'input-keyword' + index"
1211
v-bind:label="'Keyword #' + (index + 1)"
1312
v-bind:model-value="keyword"

src/components/ScreenRelatedResources.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
label="Code repository"
1111
outlined
1212
standout
13-
v-bind:class="repositoryCodeErrors.length > 0 ? 'has-error' : ''"
1413
v-bind:model-value="repositoryCode"
1514
v-bind:error="repositoryCodeErrors.length > 0"
1615
v-bind:error-message="repositoryCodeErrors.join(', ')"
@@ -28,7 +27,6 @@
2827
label="Website/Landing page"
2928
outlined
3029
standout
31-
v-bind:class="urlErrors.length > 0 ? 'has-error' : ''"
3230
v-bind:model-value="url"
3331
v-bind:error="urlErrors.length > 0"
3432
v-bind:error-message="urlErrors.join(', ')"
@@ -46,7 +44,6 @@
4644
label="Other repository"
4745
outlined
4846
standout
49-
v-bind:class="repositoryErrors.length > 0 ? 'has-error' : ''"
5047
v-bind:model-value="repository"
5148
v-bind:error="repositoryErrors.length > 0"
5249
v-bind:error-message="repositoryErrors.join(', ')"
@@ -64,7 +61,6 @@
6461
label="Artifact repository"
6562
outlined
6663
standout
67-
v-bind:class="repositoryArtifactErrors.length > 0 ? 'has-error' : ''"
6864
v-bind:model-value="repositoryArtifact"
6965
v-bind:error="repositoryArtifactErrors.length > 0"
7066
v-bind:error-message="repositoryArtifactErrors.join(', ')"

src/components/ScreenStart.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
outlined
3333
standout
3434
v-bind:aria-label="`Title of the ${ type } (required). Press tab to reach help button.`"
35-
v-bind:class="[titleErrors.length > 0 ? 'has-error' : '']"
3635
v-bind:error-message="titleErrors.join(', ')"
3736
v-bind:error="titleErrors.length > 0"
3837
v-bind:label="`Title of the ${ type } (required)`"
@@ -50,7 +49,6 @@
5049
label="Personalized message. Leave blank to use default"
5150
outlined
5251
standout
53-
v-bind:class="[messageErrors.length > 0 ? 'has-error' : '']"
5452
v-model="localMessage"
5553
v-bind:error="messageErrors.length > 0"
5654
v-bind:error-message="messageErrors.join(', ')"

src/components/ScreenVersionSpecific.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
standout
4646
style="width: 33.33%"
4747
today-btn="true"
48-
v-bind:class="dateReleasedErrors.length > 0 ? 'has-error' : ''"
4948
v-bind:model-value="dateReleased"
5049
v-bind:error="dateReleasedErrors.length > 0"
5150
v-bind:error-message="dateReleasedErrors.join(', ')"

0 commit comments

Comments
 (0)