"use strict";
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const issues_helpers_js_1 = require("../helpers/issues-helpers.js");
describe('Select element accessibility issues test', () => {
    it('should display issue when there is a disallowed child of a select element', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('issues/select-element-accessibility-issue-DisallowedSelectChild.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        const issueElement = await (0, issues_helpers_js_1.getAndExpandSpecificIssueByTitle)('Invalid element or text node within <select>', devToolsPage);
        chai_1.assert.isOk(issueElement);
        const section = await (0, issues_helpers_js_1.getResourcesElement)('1 element', issueElement, undefined, devToolsPage);
        await (0, issues_helpers_js_1.ensureResourceSectionIsExpanded)(section, devToolsPage);
        const expectedTableRows = [
            ['Disallowed descendant'],
        ];
        await (0, issues_helpers_js_1.waitForTableFromResourceSectionContents)(section.content, expectedTableRows, devToolsPage);
    });
    it('should display issue when there is a disallowed child of an optgroup element', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('issues/select-element-accessibility-issue-DisallowedOptGroupChild.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        const issueElement = await (0, issues_helpers_js_1.getAndExpandSpecificIssueByTitle)('Invalid element or text node within <optgroup>', devToolsPage);
        chai_1.assert.isOk(issueElement);
        const section = await (0, issues_helpers_js_1.getResourcesElement)('1 element', issueElement, undefined, devToolsPage);
        await (0, issues_helpers_js_1.ensureResourceSectionIsExpanded)(section, devToolsPage);
        const expectedTableRows = [
            ['Disallowed descendant'],
        ];
        await (0, issues_helpers_js_1.waitForTableFromResourceSectionContents)(section.content, expectedTableRows, devToolsPage);
    });
    it('should display issue when there is a non-phrasing child element of an option element', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('issues/select-element-accessibility-issue-NonPhrasingContentOptionChild.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        const issueElement = await (0, issues_helpers_js_1.getAndExpandSpecificIssueByTitle)('Non-phrasing content used within an <option> element', devToolsPage);
        chai_1.assert.isOk(issueElement);
        const section = await (0, issues_helpers_js_1.getResourcesElement)('1 element', issueElement, undefined, devToolsPage);
        await (0, issues_helpers_js_1.ensureResourceSectionIsExpanded)(section, devToolsPage);
        const expectedTableRows = [
            ['Disallowed descendant'],
        ];
        await (0, issues_helpers_js_1.waitForTableFromResourceSectionContents)(section.content, expectedTableRows, devToolsPage);
    });
    it('should display issue when there is an interactive child element of an option element', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('issues/select-element-accessibility-issue-InteractiveContentOptionChild.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        const issueElement = await (0, issues_helpers_js_1.getAndExpandSpecificIssueByTitle)('Interactive element inside of an <option> element', devToolsPage);
        chai_1.assert.isOk(issueElement);
        const section = await (0, issues_helpers_js_1.getResourcesElement)('1 element', issueElement, undefined, devToolsPage);
        await (0, issues_helpers_js_1.ensureResourceSectionIsExpanded)(section, devToolsPage);
        const expectedTableRows = [
            ['Disallowed descendant'],
        ];
        await (0, issues_helpers_js_1.waitForTableFromResourceSectionContents)(section.content, expectedTableRows, devToolsPage);
    });
    it('should display issue when there is an interactive child element of a legend element', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('issues/select-element-accessibility-issue-InteractiveContentLegendChild.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        const issueElement = await (0, issues_helpers_js_1.getAndExpandSpecificIssueByTitle)('Interactive element inside of a <legend> element', devToolsPage);
        chai_1.assert.isOk(issueElement);
        const section = await (0, issues_helpers_js_1.getResourcesElement)('1 element', issueElement, undefined, devToolsPage);
        await (0, issues_helpers_js_1.ensureResourceSectionIsExpanded)(section, devToolsPage);
        const expectedTableRows = [
            ['Disallowed descendant'],
        ];
        await (0, issues_helpers_js_1.waitForTableFromResourceSectionContents)(section.content, expectedTableRows, devToolsPage);
    });
    it('should display issue when there is an element with disallowed attributes as a child of a select element', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('issues/select-element-accessibility-issue-InteractiveAttributesSelectDescendant.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        const issueElement = await (0, issues_helpers_js_1.getAndExpandSpecificIssueByTitle)('Element with invalid attributes within a <select> element', devToolsPage);
        chai_1.assert.isOk(issueElement);
        const section = await (0, issues_helpers_js_1.getResourcesElement)('1 element', issueElement, undefined, devToolsPage);
        await (0, issues_helpers_js_1.ensureResourceSectionIsExpanded)(section, devToolsPage);
        const expectedTableRows = [
            ['Disallowed descendant'],
        ];
        await (0, issues_helpers_js_1.waitForTableFromResourceSectionContents)(section.content, expectedTableRows, devToolsPage);
    });
    it('should display issue when there is an interactive element as a descendant of a summary element', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('issues/summary-element-accessibility-issue-InteractiveContentSummaryDescendant.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        const issueElement = await (0, issues_helpers_js_1.getAndExpandSpecificIssueByTitle)('Interactive element inside of a <summary> element', devToolsPage);
        chai_1.assert.isOk(issueElement);
        const section = await (0, issues_helpers_js_1.getResourcesElement)('1 element', issueElement, undefined, devToolsPage);
        await (0, issues_helpers_js_1.ensureResourceSectionIsExpanded)(section, devToolsPage);
        const expectedTableRows = [
            ['Disallowed descendant'],
        ];
        await (0, issues_helpers_js_1.waitForTableFromResourceSectionContents)(section.content, expectedTableRows, devToolsPage);
    });
});
//# sourceMappingURL=select-element-accessibility-issues.test.js.map