Skip to content

Commit 8d7bd95

Browse files
authored
Merge pull request #760 from citation-file-format/757-fieldset-for-radio-group
2 parents ddf4693 + d0eafdf commit 8d7bd95

5 files changed

Lines changed: 58 additions & 50 deletions

File tree

cypress/e2e/errors.cy.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,7 @@ describe('From a fixed advanced app', () => {
197197
cy.checkThatInputValidityIs(false, 'value')
198198
cy.checkThatAppValidityIs(false)
199199

200-
cy.dataCy('radio-identifier')
201-
.children()
202-
.eq(1)
200+
cy.dataCy('radio-identifier-url')
203201
.click()
204202
cy.checkThatStepperValidityIs(false, 'identifiers')
205203
cy.checkThatInputValidityIs(false, 'value')
@@ -216,9 +214,7 @@ describe('From a fixed advanced app', () => {
216214
cy.checkThatInputValidityIs(false, 'value')
217215
cy.checkThatAppValidityIs(false)
218216

219-
cy.dataCy('radio-identifier')
220-
.children()
221-
.eq(2)
217+
cy.dataCy('radio-identifier-swh')
222218
.click()
223219
cy.checkThatStepperValidityIs(false, 'identifiers')
224220
cy.checkThatInputValidityIs(false, 'value')

cypress/e2e/info-dialog.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ const infoDialogs = [
1818
values: ['url', 'description'],
1919
before: () => {
2020
cy.dataCy('btn-add-identifier').click()
21-
cy.dataCy('radio-identifier').children().eq(1).click()
21+
cy.dataCy('radio-identifier-url').click()
2222
}
2323
},
2424
{
2525
screen: 'identifiers',
2626
values: ['swh', 'description'],
2727
before: () => {
2828
cy.dataCy('btn-add-identifier').click()
29-
cy.dataCy('radio-identifier').children().eq(2).click()
29+
cy.dataCy('radio-identifier-swh').click()
3030
}
3131
},
3232
{
3333
screen: 'identifiers',
3434
values: ['other', 'description'],
3535
before: () => {
3636
cy.dataCy('btn-add-identifier').click()
37-
cy.dataCy('radio-identifier').children().eq(3).click()
37+
cy.dataCy('radio-identifier-other').click()
3838
}
3939
},
4040
{

cypress/e2e/spec.cy.ts

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const minimumValidCff = {
99
}
1010
const fullValidCff = {
1111
'cff-version': '1.2.0',
12-
type: 'software',
12+
type: 'dataset',
1313
title: 'My Title',
1414
message: 'New message',
1515
authors: [{
@@ -49,13 +49,9 @@ describe('Basic usage', () => {
4949

5050
// Start screen
5151
cy.url().should('include', '/start')
52-
cy.dataCy('radio-type')
53-
.children()
54-
.eq(0)
52+
cy.dataCy('radio-type-software')
5553
.should('have.text', 'Software')
56-
cy.dataCy('radio-type')
57-
.children()
58-
.eq(1)
54+
cy.dataCy('radio-type-dataset')
5955
.should('have.text', 'Dataset')
6056
cy.dataCy('input-title')
6157
.type('My Title')
@@ -95,9 +91,7 @@ describe('Basic usage', () => {
9591

9692
// Start screen
9793
cy.url().should('include', '/start')
98-
cy.dataCy('radio-type')
99-
.children()
100-
.eq(1)
94+
cy.dataCy('radio-type-dataset')
10195
.click()
10296
cy.dataCy('input-title')
10397
.type('My Title')
@@ -145,29 +139,23 @@ describe('Basic usage', () => {
145139
.type('Some DOI')
146140
cy.dataCy('btn-add-identifier')
147141
.click()
148-
cy.dataCy('radio-identifier')
149-
.children()
150-
.eq(1)
142+
cy.dataCy('radio-identifier-url')
151143
.click()
152144
cy.dataCy('input-value')
153145
.type('https://id')
154146
cy.dataCy('input-description')
155147
.type('Some URL')
156148
cy.dataCy('btn-add-identifier')
157149
.click()
158-
cy.dataCy('radio-identifier')
159-
.children()
160-
.eq(2)
150+
cy.dataCy('radio-identifier-swh')
161151
.click()
162152
cy.dataCy('input-value')
163153
.type('swh:1:rev:0123456789abcdef0123456789abcdef01234567')
164154
cy.dataCy('input-description')
165155
.type('Some SWH')
166156
cy.dataCy('btn-add-identifier')
167157
.click()
168-
cy.dataCy('radio-identifier')
169-
.children()
170-
.eq(3)
158+
cy.dataCy('radio-identifier-other')
171159
.click()
172160
cy.dataCy('input-value')
173161
.type('Other')

src/components/IdentifierCardEditing.vue

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,29 @@
55
class="bg-formcard q-pa-md"
66
>
77
<q-card-section>
8-
<div class="items-center no-wrap">
9-
<q-option-group
10-
data-cy="radio-identifier"
11-
inline
12-
type="radio"
13-
v-bind:model-value="type"
14-
v-bind:options="typeOptions"
15-
v-on:update:modelValue="$emit('updateType', 'type', $event)"
16-
/>
17-
</div>
8+
<fieldset
9+
class="q-mb-md"
10+
role="radiogroup"
11+
>
12+
<legend
13+
class="question"
14+
>
15+
What type of identifier?
16+
<!-- <InfoDialog name="type" /> -->
17+
</legend>
18+
<label
19+
v-for="typeOption in typeOptions"
20+
v-bind:key="typeOption.label"
21+
>
22+
<q-radio
23+
v-bind:data-cy="'radio-identifier-' + typeOption.value"
24+
v-bind:label="typeOption.label"
25+
v-bind:model-value="type"
26+
v-bind:val="typeOption.value"
27+
v-on:update:modelValue="$emit('updateType', 'type', $event)"
28+
/>
29+
</label>
30+
</fieldset>
1831

1932
<q-input
2033
autofocus

src/components/ScreenStart.vue

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,29 @@
33
Start
44
</h1>
55

6-
<h2 class="question">
7-
What type of work does this CITATION.cff describe?
8-
<InfoDialog name="type" />
9-
</h2>
10-
<q-option-group
11-
data-cy="radio-type"
12-
type="radio"
13-
v-bind:model-value="type"
14-
v-bind:options="typeOptions"
15-
v-on:update:modelValue="[setType, setMessageOrDefault, checkDefaultMessage]"
16-
/>
17-
6+
<fieldset
7+
class="q-mb-md"
8+
role="radiogroup"
9+
>
10+
<legend
11+
class="question"
12+
>
13+
Type of the work
14+
<InfoDialog name="type" />
15+
</legend>
16+
<label
17+
v-for="typeOption in typeOptions"
18+
v-bind:key="typeOption.label"
19+
>
20+
<q-radio
21+
v-bind:data-cy="'radio-type-' + typeOption.value"
22+
v-bind:label="typeOption.label"
23+
v-bind:model-value="type"
24+
v-bind:val="typeOption.value"
25+
v-on:update:modelValue="[setType, setMessageOrDefault, checkDefaultMessage]"
26+
/>
27+
</label>
28+
</fieldset>
1829
<q-input
1930
bg-color="white"
2031
data-cy="input-title"

0 commit comments

Comments
 (0)