"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('IssueView', () => {
    it('should be parented in issueTree when not groupedByCategory', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('elements/element-reveal-inline-issue.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        if (await (0, issues_helpers_js_1.getGroupByCategoryChecked)(devToolsPage)) {
            await (0, issues_helpers_js_1.toggleGroupByCategory)(devToolsPage);
        }
        const issue = await devToolsPage.waitFor(issues_helpers_js_1.ISSUE);
        const parent = await issue.evaluate(node => node.parentElement?.classList.contains('issue-category-body'));
        chai_1.assert.isFalse(parent);
    });
    it('should be parented in IssueCategoryView when groupedByCategory', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('elements/element-reveal-inline-issue.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        if (!await (0, issues_helpers_js_1.getGroupByCategoryChecked)(devToolsPage)) {
            await (0, issues_helpers_js_1.toggleGroupByCategory)(devToolsPage);
        }
        const issue = await devToolsPage.waitFor(issues_helpers_js_1.ISSUE);
        const parent = await issue.evaluate(node => node.parentElement?.classList.contains('issue-category-body'));
        chai_1.assert.isTrue(parent);
    });
    it('should reparent correctly after parent change', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.goToResource('elements/element-reveal-inline-issue.html');
        await (0, issues_helpers_js_1.navigateToIssuesTab)(devToolsPage);
        if (await (0, issues_helpers_js_1.getGroupByCategoryChecked)(devToolsPage)) {
            await (0, issues_helpers_js_1.toggleGroupByCategory)(devToolsPage);
        }
        let category = await devToolsPage.$$(issues_helpers_js_1.CATEGORY);
        chai_1.assert.isEmpty(category);
        const issue = await devToolsPage.waitFor(issues_helpers_js_1.ISSUE);
        const parent = await issue.evaluate(node => node.parentElement?.classList.contains('issue-category-body'));
        chai_1.assert.isFalse(parent);
        await (0, issues_helpers_js_1.toggleGroupByCategory)(devToolsPage);
        category = await devToolsPage.$$(issues_helpers_js_1.CATEGORY);
        chai_1.assert.isNotEmpty(category);
        const reparentedIssue = await devToolsPage.waitFor(issues_helpers_js_1.ISSUE);
        const newParent = await reparentedIssue.evaluate(node => node.parentElement?.classList.contains('issue-category-body'));
        chai_1.assert.isTrue(newParent);
    });
});
//# sourceMappingURL=issue-view-reparent.test.js.map