"use strict";
// Copyright 2024 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 elements_helpers_js_1 = require("../helpers/elements-helpers.js");
const settings_helpers_js_1 = require("../helpers/settings-helpers.js");
describe('Layout Pane in the Elements Tab', function () {
    // FIXME: lower parts of the panel are not visible in docked mode.
    setup({ dockingMode: 'undocked' });
    it('displays Layout pane', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('elements/css-grid.html');
        await (0, elements_helpers_js_1.waitForElementsStyleSection)(undefined, devToolsPage);
        await (0, elements_helpers_js_1.expandSelectedNodeRecursively)(devToolsPage);
        await (0, elements_helpers_js_1.waitForAdorners)([
            { textContent: 'view-source', isActive: false },
            { textContent: 'grid', isActive: false },
        ], devToolsPage);
        await (0, elements_helpers_js_1.openLayoutPane)(devToolsPage);
        await (0, elements_helpers_js_1.toggleElementCheckboxInLayoutPane)(devToolsPage);
        await (0, elements_helpers_js_1.waitForAdorners)([
            { textContent: 'view-source', isActive: false },
            { textContent: 'grid', isActive: true },
        ], devToolsPage);
    });
    it('Lists grids in UA shadow DOM only when needed', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('elements/css-grid-ua-shadow.html');
        await (0, elements_helpers_js_1.openLayoutPane)(devToolsPage);
        const grids = await (0, elements_helpers_js_1.getGridsInLayoutPane)(devToolsPage);
        chai_1.assert.lengthOf(grids, 1, 'Without UA shadow DOM, there is only one grid');
        await (0, settings_helpers_js_1.togglePreferenceInSettingsTab)('User agent shadow DOM', true, devToolsPage);
        // We only wait for at least 2 grids, the <video> element may generate more grids, but we're not interested
        // in testing how many exactly.
        await (0, elements_helpers_js_1.waitForSomeGridsInLayoutPane)(2, devToolsPage);
    });
});
//# sourceMappingURL=layout-pane.test.js.map