Skip to content

Commit dee1775

Browse files
committed
test(select): fix more tests
1 parent 84daa2f commit dee1775

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

elements/pf-select/test/pf-select.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe('<pf-select>', function() {
105105
it('shows options with "r" anywhere in them', async function() {
106106
const snapshot = await a11ySnapshot();
107107
const [listbox] = snapshot.children ?? [];
108-
expect(listbox?.children).to.deep.equal([
108+
expect(listbox.children?.map(({ name, role }) => ({ name, role }))).to.deep.equal([
109109
{ role: 'option', name: 'Green' },
110110
{ role: 'option', name: 'Orange' },
111111
{ role: 'option', name: 'Purple' },
@@ -214,7 +214,9 @@ describe('<pf-select>', function() {
214214
const snapshot = await a11ySnapshot();
215215
const [, listbox] = snapshot.children ?? [];
216216
const [, second] = listbox?.children ?? [];
217-
expect(second).to.deep.equal({ role: 'option', name: 'Green', focused: true });
217+
expect(second.role).to.equal('option');
218+
expect(second.name).to.equal('Green');
219+
expect(second.focused).to.be.true;
218220
});
219221

220222
describe('clicking the second option', function() {
@@ -385,7 +387,7 @@ describe('<pf-select>', function() {
385387
it('checkboxes should NOT be visible to screen readers', async function() {
386388
const snapshot = await a11ySnapshot();
387389
const [listbox] = snapshot.children ?? [];
388-
expect(listbox.children).to.deep.equal([
390+
expect(listbox.children?.map(({ name, role }) => ({ name, role }))).to.deep.equal([
389391
{ role: 'option', name: 'Amethyst', selected: true },
390392
{ role: 'option', name: 'Aqua', selected: true },
391393
{ role: 'option', name: 'Blue' },
@@ -428,7 +430,7 @@ describe('<pf-select>', function() {
428430
it('show listbox items starting with "p"', async function() {
429431
const snapshot = await a11ySnapshot();
430432
const [,, listbox] = snapshot.children ?? [];
431-
expect(listbox.children).to.deep.equal([
433+
expect(listbox.children?.map(({ name, role }) => ({ name, role }))).to.deep.equal([
432434
{ role: 'option', name: 'Purple' },
433435
{ role: 'option', name: 'Pink' }
434436
]);
@@ -440,7 +442,7 @@ describe('<pf-select>', function() {
440442
it('all options are visible', async function() {
441443
const snapshot = await a11ySnapshot();
442444
const [,, listbox] = snapshot.children ?? [];
443-
expect(listbox.children).to.deep.equal([
445+
expect(listbox.children?.map(({ name, role }) => ({ name, role }))).to.deep.equal([
444446
{ role: 'option', name: 'Blue' },
445447
{ role: 'option', name: 'Green' },
446448
{ role: 'option', name: 'Magenta' },

0 commit comments

Comments
 (0)