|
| 1 | +// Copyright 2025 The Chromium Authors. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | + |
| 5 | +import { |
| 6 | + ensureResourceSectionIsExpanded, |
| 7 | + getAndExpandSpecificIssueByTitle, |
| 8 | + getResourcesElement, |
| 9 | + navigateToIssuesTab, |
| 10 | + waitForTableFromResourceSectionContents, |
| 11 | +} from '../../e2e/helpers/issues-helpers.js'; |
| 12 | +import { |
| 13 | + assertNotNullOrUndefined, |
| 14 | +} from '../../shared/helper.js'; |
| 15 | + |
| 16 | +describe('Select element accessibility issues test', () => { |
| 17 | + it('should display issue when there is a disallowed child of a select element', |
| 18 | + async ({devToolsPage, inspectedPage}) => { |
| 19 | + await inspectedPage.goToResource('issues/select-element-accessibility-issue-DisallowedSelectChild.html'); |
| 20 | + await navigateToIssuesTab(devToolsPage); |
| 21 | + const issueElement = |
| 22 | + await getAndExpandSpecificIssueByTitle('Invalid element or text node within <select>', devToolsPage); |
| 23 | + assertNotNullOrUndefined(issueElement); |
| 24 | + |
| 25 | + const section = await getResourcesElement('1 element', issueElement, undefined, devToolsPage); |
| 26 | + await ensureResourceSectionIsExpanded(section, devToolsPage); |
| 27 | + const expectedTableRows = [ |
| 28 | + ['Disallowed descendant'], |
| 29 | + ]; |
| 30 | + await waitForTableFromResourceSectionContents(section.content, expectedTableRows, devToolsPage); |
| 31 | + }); |
| 32 | + |
| 33 | + it('should display issue when there is a disallowed child of an optgroup element', |
| 34 | + async ({devToolsPage, inspectedPage}) => { |
| 35 | + await inspectedPage.goToResource('issues/select-element-accessibility-issue-DisallowedOptGroupChild.html'); |
| 36 | + await navigateToIssuesTab(devToolsPage); |
| 37 | + const issueElement = |
| 38 | + await getAndExpandSpecificIssueByTitle('Invalid element or text node within <optgroup>', devToolsPage); |
| 39 | + assertNotNullOrUndefined(issueElement); |
| 40 | + |
| 41 | + const section = await getResourcesElement('1 element', issueElement, undefined, devToolsPage); |
| 42 | + await ensureResourceSectionIsExpanded(section, devToolsPage); |
| 43 | + const expectedTableRows = [ |
| 44 | + ['Disallowed descendant'], |
| 45 | + ]; |
| 46 | + await waitForTableFromResourceSectionContents(section.content, expectedTableRows, devToolsPage); |
| 47 | + }); |
| 48 | + |
| 49 | + it('should display issue when there is a non-phrasing child element of an option element', |
| 50 | + async ({devToolsPage, inspectedPage}) => { |
| 51 | + await inspectedPage.goToResource('issues/select-element-accessibility-issue-NonPhrasingContentOptionChild.html'); |
| 52 | + await navigateToIssuesTab(devToolsPage); |
| 53 | + const issueElement = |
| 54 | + await getAndExpandSpecificIssueByTitle('Non-phrasing content used within an <option> element', devToolsPage); |
| 55 | + assertNotNullOrUndefined(issueElement); |
| 56 | + |
| 57 | + const section = await getResourcesElement('1 element', issueElement, undefined, devToolsPage); |
| 58 | + await ensureResourceSectionIsExpanded(section, devToolsPage); |
| 59 | + const expectedTableRows = [ |
| 60 | + ['Disallowed descendant'], |
| 61 | + ]; |
| 62 | + await waitForTableFromResourceSectionContents(section.content, expectedTableRows, devToolsPage); |
| 63 | + }); |
| 64 | + |
| 65 | + it('should display issue when there is an interactive child element of an option element', |
| 66 | + async ({devToolsPage, inspectedPage}) => { |
| 67 | + await inspectedPage.goToResource('issues/select-element-accessibility-issue-InteractiveContentOptionChild.html'); |
| 68 | + await navigateToIssuesTab(devToolsPage); |
| 69 | + const issueElement = |
| 70 | + await getAndExpandSpecificIssueByTitle('Interactive element inside of an <option> element', devToolsPage); |
| 71 | + assertNotNullOrUndefined(issueElement); |
| 72 | + |
| 73 | + const section = await getResourcesElement('1 element', issueElement, undefined, devToolsPage); |
| 74 | + await ensureResourceSectionIsExpanded(section, devToolsPage); |
| 75 | + const expectedTableRows = [ |
| 76 | + ['Disallowed descendant'], |
| 77 | + ]; |
| 78 | + await waitForTableFromResourceSectionContents(section.content, expectedTableRows, devToolsPage); |
| 79 | + }); |
| 80 | + |
| 81 | + it('should display issue when there is an interactive child element of a legend element', |
| 82 | + async ({devToolsPage, inspectedPage}) => { |
| 83 | + await inspectedPage.goToResource('issues/select-element-accessibility-issue-InteractiveContentLegendChild.html'); |
| 84 | + await navigateToIssuesTab(devToolsPage); |
| 85 | + const issueElement = |
| 86 | + await getAndExpandSpecificIssueByTitle('Interactive element inside of a <legend> element', devToolsPage); |
| 87 | + assertNotNullOrUndefined(issueElement); |
| 88 | + |
| 89 | + const section = await getResourcesElement('1 element', issueElement, undefined, devToolsPage); |
| 90 | + await ensureResourceSectionIsExpanded(section, devToolsPage); |
| 91 | + const expectedTableRows = [ |
| 92 | + ['Disallowed descendant'], |
| 93 | + ]; |
| 94 | + await waitForTableFromResourceSectionContents(section.content, expectedTableRows, devToolsPage); |
| 95 | + }); |
| 96 | + |
| 97 | + it('should display issue when there is an element with disallowed attributes as a child of a select element', |
| 98 | + async ({devToolsPage, inspectedPage}) => { |
| 99 | + await inspectedPage.goToResource( |
| 100 | + 'issues/select-element-accessibility-issue-InteractiveAttributesSelectDescendant.html'); |
| 101 | + await navigateToIssuesTab(devToolsPage); |
| 102 | + const issueElement = await getAndExpandSpecificIssueByTitle( |
| 103 | + 'Element with invalid attributes within a <select> element', devToolsPage); |
| 104 | + assertNotNullOrUndefined(issueElement); |
| 105 | + |
| 106 | + const section = await getResourcesElement('1 element', issueElement, undefined, devToolsPage); |
| 107 | + await ensureResourceSectionIsExpanded(section, devToolsPage); |
| 108 | + const expectedTableRows = [ |
| 109 | + ['Disallowed descendant'], |
| 110 | + ]; |
| 111 | + await waitForTableFromResourceSectionContents(section.content, expectedTableRows, devToolsPage); |
| 112 | + }); |
| 113 | + |
| 114 | + it('should display issue when there is an interactive element as a descendant of a summary element', |
| 115 | + async ({devToolsPage, inspectedPage}) => { |
| 116 | + await inspectedPage.goToResource( |
| 117 | + 'issues/summary-element-accessibility-issue-InteractiveContentSummaryDescendant.html'); |
| 118 | + await navigateToIssuesTab(devToolsPage); |
| 119 | + const issueElement = |
| 120 | + await getAndExpandSpecificIssueByTitle('Interactive element inside of a <summary> element', devToolsPage); |
| 121 | + assertNotNullOrUndefined(issueElement); |
| 122 | + |
| 123 | + const section = await getResourcesElement('1 element', issueElement, undefined, devToolsPage); |
| 124 | + await ensureResourceSectionIsExpanded(section, devToolsPage); |
| 125 | + const expectedTableRows = [ |
| 126 | + ['Disallowed descendant'], |
| 127 | + ]; |
| 128 | + await waitForTableFromResourceSectionContents(section.content, expectedTableRows, devToolsPage); |
| 129 | + }); |
| 130 | +}); |
0 commit comments