Skip to content

Commit

Permalink
Home Owners Table - A11Y (#2021)
Browse files Browse the repository at this point in the history
* A11y Home Owners Table

* removed test code
  • Loading branch information
cameron-eyds authored Sep 12, 2024
1 parent bde1a08 commit 9026b65
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ppr-ui/package-lock.json

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

2 changes: 1 addition & 1 deletion ppr-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
"version": "3.2.54",
"version": "3.2.55",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
id="home-owner-table-card"
flat
rounded
role="region"
:class="{ 'border-error-left': showTableError && !hideTableErrors }"
>
<BaseDialog
Expand All @@ -14,8 +15,9 @@
<v-table
id="mhr-home-owners-table"
class="home-owners-table"
:class="{ 'review-mode': isReadonlyTable }"
itemKey="groupId"
role="presentation"
:class="{ 'review-mode': isReadonlyTable }"
:groupBy="showGroups ? 'groupId' : null"
>
<thead class="simple">
Expand All @@ -24,6 +26,8 @@
v-for="header in homeOwnersTableHeaders"
:key="header.value"
:class="header.class"
:aria-label="header.text || header.value"
:aria-hidden="header.value === 'actions'"
>
{{ header.text }}
</th>
Expand Down Expand Up @@ -165,6 +169,8 @@
>
<v-icon
class="mr-2"
aria-hidden="false"
aria-label="Owner Individual"
:class="{ 'person-executor-icon': item.partyType !== HomeOwnerPartyTypes.OWNER_IND }"
>
{{ getHomeOwnerIcon(item.partyType) }}
Expand All @@ -181,6 +187,8 @@
>
<v-icon
class="mr-2"
aria-hidden="false"
aria-label="Owner Business"
:class="{ 'business-executor-icon': item.partyType !== HomeOwnerPartyTypes.OWNER_BUS }"
>
{{ getHomeOwnerIcon(item.partyType, true) }}
Expand Down
1 change: 0 additions & 1 deletion ppr-ui/src/resources/tableHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@ export const homeOwnersTableHeaders: Array<BaseHeaderIF> = [
{
class: 'actions column-md',
sortable: false,
text: '',
value: 'actions'
}
]
Expand Down
2 changes: 2 additions & 0 deletions ppr-ui/src/views/newMhrRegistration/HomeOwners.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<section
id="mhr-owners"
:class="{'mt-10': !isReadonlyTable && !isMhrTransfer}"
role="region"
aria-labelledby="mhr-home-owners-list"
>
<template v-if="!isMhrTransfer">
<h2>1. Owners</h2>
Expand Down
2 changes: 2 additions & 0 deletions ppr-ui/tests/unit/MhrRegistration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import HomeLocation from '@/views/newMhrRegistration/HomeLocation.vue'
import HomeOwners from '@/views/newMhrRegistration/HomeOwners.vue'
import { MhrRegistrationHomeOwnerGroupIF } from '@/interfaces'
import { PreviousHomeOwners } from '@/components/mhrRegistration'
import { expect, it } from 'vitest'
import { axe } from 'vitest-axe'

const store = useStore()

Expand Down
9 changes: 9 additions & 0 deletions ppr-ui/tests/unit/MhrRegistrationHomeOwners.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { MhrCorrectionStaff, MixedRolesErrors } from '@/resources'
import { useStore } from '../../src/store/store'
import { useNewMhrRegistration } from '@/composables/mhrRegistration'
import { defaultFlagSet } from '@/utils'
import { expect, it } from 'vitest'
import { axe } from 'vitest-axe'

const store = useStore()

Expand Down Expand Up @@ -73,6 +75,13 @@ describe('Home Owners', () => {

// Tests

it('should have no accessibility violations', async () => {
// Run the axe-core accessibility check on the component's HTML
const results = await axe(wrapper.html())
// Use the custom vitest-axe matcher to check for violations
expect(results).toHaveNoViolations()
})

it('renders Home Owners and its sub components', () => {
expect(wrapper.exists()).toBeTruthy()
expect(wrapper.findComponent(AddEditHomeOwner).exists()).toBeFalsy() // Hidden by default
Expand Down

0 comments on commit 9026b65

Please sign in to comment.