"use strict";
// Copyright 2021 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 style_property_editor_helpers_js_1 = require("../helpers/style-property-editor-helpers.js");
describe('Grid Editor', function () {
    async function setupStyles(devToolsPage, inspectedPage) {
        await inspectedPage.goToResource('elements/grid-editor.html');
        await (0, elements_helpers_js_1.waitForContentOfSelectedElementsNode)('<body>\u200B', devToolsPage);
        await (0, elements_helpers_js_1.focusElementsTree)(devToolsPage);
        await (0, elements_helpers_js_1.clickNthChildOfSelectedElementNode)(1, devToolsPage);
        await (0, elements_helpers_js_1.waitForCSSPropertyValue)('#target', 'display', 'grid', undefined, devToolsPage);
    }
    it('can be opened and grid styles can be edited', async ({ devToolsPage, inspectedPage }) => {
        await setupStyles(devToolsPage, inspectedPage);
        await (0, style_property_editor_helpers_js_1.clickStylePropertyEditorButton)('Open grid editor', 'devtools-grid-editor', devToolsPage);
        // Clicking once sets the value.
        await (0, style_property_editor_helpers_js_1.clickPropertyButton)('[title="Add align-items: start"]', devToolsPage);
        await (0, elements_helpers_js_1.waitForCSSPropertyValue)('#target', 'align-items', 'start', undefined, devToolsPage);
        // Clicking again removes the value.
        await (0, style_property_editor_helpers_js_1.clickPropertyButton)('[title="Remove align-items: start"]', devToolsPage);
        // Wait for the button's title to be updated so that we know the change
        // was made.
        await devToolsPage.waitFor('[title="Add align-items: start"]');
        const property = await (0, elements_helpers_js_1.getCSSPropertyInRule)('#target', 'align-items', undefined, devToolsPage);
        chai_1.assert.isUndefined(property);
    });
});
//# sourceMappingURL=grid-editor.test.js.map