Skip to content

Commit 69913ae

Browse files
authored
Merge pull request #323 from shairez/pr-a11y-ci
2 parents f8ec783 + 0befa1d commit 69913ae

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

packages/kit-headless/cypress.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ export default defineConfig({
66
devServer: {
77
framework: 'cypress-ct-qwik',
88
bundler: 'vite',
9-
},
9+
} as any,
1010
},
1111
});

packages/kit-headless/cypress/support/component-index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html>
2+
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
55
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

packages/kit-headless/cypress/support/component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ addQwikLoader();
2020
// Import commands.ts using ES2015 syntax:
2121
import './commands';
2222
import 'cypress-axe';
23+
import 'axe-core';
2324

2425
// Augment the Cypress namespace to include type definitions for
2526
// your custom command.
@@ -30,11 +31,15 @@ declare global {
3031
namespace Cypress {
3132
interface Chainable {
3233
mount: typeof mount;
34+
checkA11yForComponent: () => void;
3335
}
3436
}
3537
}
3638

3739
Cypress.Commands.add('mount', mount);
40+
Cypress.Commands.add('checkA11yForComponent', () => {
41+
cy.checkA11y('[data-cy-root]');
42+
});
3843

3944
// Example use:
4045
// cy.mount(MyComponent)

packages/kit-headless/src/components/accordion/accordion.spec.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Accordion, AccordionItem } from './accordion';
44
describe('Accordion', () => {
55
it('should render an Accordion', () => {
66
mount(
7-
<Accordion>
7+
<Accordion class="accordion">
88
<AccordionItem label="Heading 1">
99
<p>
1010
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus
@@ -20,12 +20,10 @@ describe('Accordion', () => {
2020
</Accordion>
2121
);
2222

23-
// cy.injectAxe();
24-
2523
cy.contains(/Heading 1/i).click();
2624
cy.get('.content').should('exist');
2725
cy.contains(/Heading 2/i).should('exist');
2826

29-
// cy.checkA11y();
27+
cy.checkA11yForComponent();
3028
});
3129
});

0 commit comments

Comments
 (0)