Skip to content

Commit fd3034c

Browse files
committed
fix issue of no tag choices
1 parent ad757f4 commit fd3034c

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/context/reducers/accTestCaseReducer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const accTestCaseState: AccTestCaseState = {
1616
describe0: {
1717
id: 'describe0',
1818
text: 'Component is accessible according to all standards enforced by axe-core.',
19-
standardTag: '',
19+
standardTag: 'none',
2020
},
2121
},
2222
allIds: ['describe0'],
@@ -27,7 +27,7 @@ export const accTestCaseState: AccTestCaseState = {
2727
id: 'it0',
2828
describeId: 'describe0',
2929
text: 'Component is accessible regarding all axe-core categories.',
30-
catTag: '',
30+
catTag: 'none',
3131
},
3232
},
3333
allIds: {

src/context/useGenerateTest.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -893,11 +893,17 @@ function useGenerateTest(test, projectFilePath) {
893893
rules: {
894894
'color-contrast': { enabled: false },
895895
'link-in-text-block': { enabled: false },
896+
},`
897+
898+
if (accTestCase.describeBlocks.byId[descId].standardTag !== 'none') {
899+
testFileCode += `
896900
runOnly: {
897901
type: 'tag',
898902
value: ['${accTestCase.describeBlocks.byId[descId].standardTag}']
899-
}
900-
},
903+
}`
904+
}
905+
906+
testFileCode += `
901907
};
902908
`;
903909

@@ -930,7 +936,7 @@ function useGenerateTest(test, projectFilePath) {
930936
testFileCode += `
931937
it('${itStatements.byId[itId].text}', (done) => {`
932938

933-
if(itStatements.byId[itId].catTag !== '') {
939+
if(itStatements.byId[itId].catTag !== 'none') {
934940
testFileCode += `
935941
options.runOnly.value.push('cat.${itStatements.byId[itId].catTag}')`
936942
}

0 commit comments

Comments
 (0)