-
Notifications
You must be signed in to change notification settings - Fork 177
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
[MWPW-165791] Table select aria-label and column cell role added #3513
base: stage
Are you sure you want to change the base?
Changes from 2 commits
7ca0dd5
65d7353
ce394bd
4d7a01e
9342f3b
ad81ecb
1879c4e
79e9809
3d358d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { readFile, sendMouse, sendKeys, resetMouse } from '@web/test-runner-commands'; | ||
import { expect } from 'chai'; | ||
import { MILO_EVENTS } from '../../../libs/utils/utils.js'; | ||
import { getConfig, MILO_EVENTS, setConfig } from '../../../libs/utils/utils.js'; | ||
import { delay, waitForElement } from '../../helpers/waitfor.js'; | ||
|
||
document.body.innerHTML = await readFile({ path: './mocks/body.html' }); | ||
const { default: init } = await import('../../../libs/blocks/table/table.js'); | ||
const config = getConfig(); | ||
config.env = { locale: { contentRoot: `${window.location.origin}` } }; | ||
setConfig(config); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't this end up actually making the placeholders call during the unit tests? We generally avoid network requests, so this should be mocked. I suspect the palceholders tests should have a way of doing this already. |
||
|
||
describe('table and tablemetadata', () => { | ||
beforeEach(() => { | ||
|
@@ -111,5 +114,15 @@ describe('table and tablemetadata', () => { | |
expect(tooltipHeading.childNodes.length).to.equal(2); | ||
expect(tooltipHeading.querySelector('.milo-tooltip, .icon-tooltip')).to.exist; | ||
}); | ||
|
||
it('should apply aria-label to all selects within .filters on mobile', async () => { | ||
window.innerWidth = 375; | ||
window.dispatchEvent(new Event('resize')); | ||
await delay(500); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We try to avoid any wait time in our unit tests as to not delay the whole suite. You can look up |
||
const selectElements = document.querySelectorAll('.filters select'); | ||
selectElements.forEach((selectElement) => { | ||
expect(selectElement.getAttribute('aria-label')).to.equal('choose table column'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, we should probably mock the placeholders logic/values, so we might need to adapt the expected value here as well. |
||
}); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to future-proof this a bit, in case we'll have another number of columns visible on different breakpoints. So let's send these in an Array and have a single argument for
setAriaLabelsForElements
that iterates over the array's elements to set thearia-label
.