Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cypress-axe #38

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"files": [
"README.md"
],
"files": ["README.md"],
"imageSize": 100,
"commit": false,
"commitType": "docs",
Expand All @@ -27,20 +25,14 @@
"name": "Matthew Thornton",
"avatar_url": "https://avatars.githubusercontent.com/u/44626690?v=4",
"profile": "https://github.com/ThorntonMatthewD",
"contributions": [
"code",
"test"
]
"contributions": ["code", "test"]
},
{
"login": "Alex-Grimes",
"name": "Alex Grimes",
"avatar_url": "https://avatars.githubusercontent.com/u/66704965?v=4",
"profile": "https://github.com/Alex-Grimes",
"contributions": [
"code",
"test"
]
"contributions": ["code", "test"]
}
],
"contributorsPerLine": 7,
Expand Down
2 changes: 1 addition & 1 deletion cypress/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"]
"types": ["cypress", "node", "cypress-axe"]
}
}
8 changes: 8 additions & 0 deletions cypress/e2e/about.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ describe("About page", () => {

cy.contains("Upstate / Greenville SC Open Data Map Layers Demo");
});

it("is accessible", () => {
cy.visit("/about");

cy.injectAxe();

cy.checkA11y();
});
});
17 changes: 17 additions & 0 deletions cypress/e2e/map.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ describe("Map", () => {
);
});

it("is accessible", () => {
cy.visit("/");

cy.injectAxe();

cy.checkA11y();
});

describe("Attribution Control", () => {
it("Attribution control displays the proper message", () => {
loadMap("/");
Expand Down Expand Up @@ -168,5 +176,14 @@ describe("Map", () => {
// Maintainer control should not be visible any longer
cy.get("[title='Maintainers']").should("not.exist");
});

it("contents of control pop-up are accessible", () => {
cy.visit("/");
cy.get("[title='Layers']").trigger("mouseover");

cy.injectAxe();

cy.checkA11y();
});
});
});
2 changes: 1 addition & 1 deletion cypress/e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"isolatedModules": false,
"target": "es2015",
"lib": ["es2015", "dom"],
"types": ["cypress"]
"types": ["cypress", "cypress-axe"]
}
}
2 changes: 2 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "cypress-axe";

import "./commands";

// Alternatively you can use CommonJS syntax:
Expand Down
37 changes: 37 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
"@vue/test-utils": "^2.4.1",
"@vue/tsconfig": "^0.4.0",
"autoprefixer": "^10.4.16",
"axe-core": "^4.8.2",
"cross-env": "^7.0.3",
"cypress": "^13.3.1",
"cypress-axe": "^1.5.0",
"eslint": "^8.51.0",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-vue": "^9.17.0",
Expand Down
2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function mapLink() {
</Transition>
<div
:class="uiStore.showContributionBanner ? 'h-[calc(100%-24px)]' : 'h-full'"
role="main"
>
<RouterView />
</div>
Expand All @@ -47,6 +48,7 @@ function mapLink() {
>
<nav
class="flex justify-between items-center text-xl space-x-4 mx-4 md:mx-8 lg:mx-16"
role="navigation"
>
<RouterLink class="link" :to="mapLink()">Map</RouterLink>
<ContributionButton />
Expand Down
4 changes: 4 additions & 0 deletions src/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
.h-full-screen {
@apply fixed h-full overscroll-none;
}

.leaflet-control-attribution > a {
@apply underline;
}
5 changes: 4 additions & 1 deletion src/components/ContributionBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const uiStore = useUIStore();
</script>

<template>
<div class="sticky top-0 overflow-hidden gap-x-6 bg-gray-800 items-center">
<div
class="sticky top-0 overflow-hidden gap-x-6 bg-gray-800 items-center"
role="region"
>
<div class="flex flex-nowrap">
<!-- Spacer -->
<div class="flex flex-1 shrink" aria-hidden="true" />
Expand Down
7 changes: 2 additions & 5 deletions src/components/ContributionButton.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<template>
<a
href="https://data.openupstate.org/map-layers"
target="_blank"
role="button"
>
<a href="https://data.openupstate.org/map-layers" target="_blank">
<button
type="button"
role="button"
class="mt-1 text-white bg-gradient-to-r from-cyan-500 to-blue-500 hover:bg-gradient-to-bl focus:ring-4 focus:outline-none focus:ring-cyan-300 dark:focus:ring-cyan-800 font-medium rounded-lg text-sm px-2 py-1 sm:px-5 sm:py-2 text-center"
>
Learn how to contribute!
Expand Down