"use strict";
// Copyright 2020 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");
describe('CSS hints in the Styles panel', () => {
    it('can detect inactive CSS', async ({ devToolsPage, inspectedPage }) => {
        await (0, elements_helpers_js_1.goToResourceAndWaitForStyleSection)('elements/inactive-css-page.html', devToolsPage, inspectedPage);
        await (0, elements_helpers_js_1.waitForStyleRule)('body', devToolsPage);
        await (0, elements_helpers_js_1.waitForAndClickTreeElementWithPartialText)('wrapper', devToolsPage);
        await (0, elements_helpers_js_1.waitForStyleRule)('#wrapper', devToolsPage);
        const propertiesWithHints = await (0, elements_helpers_js_1.getPropertiesWithHints)(devToolsPage);
        chai_1.assert.deepEqual(propertiesWithHints, ['align-content']);
    });
    it('does not show authoring hint when property value is invalid', async ({ devToolsPage, inspectedPage }) => {
        await (0, elements_helpers_js_1.goToResourceAndWaitForStyleSection)('elements/inactive-css-with-invalid-value.html', devToolsPage, inspectedPage);
        await (0, elements_helpers_js_1.waitForStyleRule)('body', devToolsPage);
        await (0, elements_helpers_js_1.waitForAndClickTreeElementWithPartialText)('wrapper', devToolsPage);
        await (0, elements_helpers_js_1.waitForStyleRule)('#wrapper', devToolsPage);
        const propertiesWithHints = await (0, elements_helpers_js_1.getPropertiesWithHints)(devToolsPage);
        chai_1.assert.deepEqual(propertiesWithHints, []);
    });
    it('updates the hint if the styles are edited', async ({ devToolsPage, inspectedPage }) => {
        await (0, elements_helpers_js_1.goToResourceAndWaitForStyleSection)('elements/inactive-css-page.html', devToolsPage, inspectedPage);
        await (0, elements_helpers_js_1.waitForStyleRule)('body', devToolsPage);
        await (0, elements_helpers_js_1.waitForAndClickTreeElementWithPartialText)('wrapper', devToolsPage);
        await (0, elements_helpers_js_1.waitForStyleRule)('#wrapper', devToolsPage);
        chai_1.assert.deepEqual(await (0, elements_helpers_js_1.getPropertiesWithHints)(devToolsPage), ['align-content']);
        await (0, elements_helpers_js_1.focusCSSPropertyValue)('#wrapper', 'flex-wrap', devToolsPage);
        await devToolsPage.typeText('wrap', { delay: 100 });
        await devToolsPage.pressKey('Enter');
        await devToolsPage.waitForFunction(async () => {
            const propertiesWithHints = await (0, elements_helpers_js_1.getPropertiesWithHints)(devToolsPage);
            return propertiesWithHints.length === 0;
        });
    });
});
//# sourceMappingURL=css-hints.test.js.map