mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 04:39:07 -10:00
Bug 1615509: Add a test for changing top level target. r=mtigley
Differential Revision: https://phabricator.services.mozilla.com/D64535
This commit is contained in:
1 parent
7db3790e5a
commit
141324032e
2 files changed
+77
No files matched your search
@@ -14,6 +14,7 @@ support-files =
|
||||
[browser_compatibility_event_document-reload.js]
|
||||
[browser_compatibility_event_rule-change.js]
|
||||
[browser_compatibility_event_selected-node-change.js]
|
||||
[browser_compatibility_event_top-level-target-change.js]
|
||||
[browser_compatibility_issue-node.js]
|
||||
[browser_compatibility_preference.js]
|
||||
[browser_compatibility_unsupported-browsers_all.js]
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test the issues after navigating to another page.
|
||||
|
||||
const TEST_DATA_ISSUES = {
|
||||
uri: `
|
||||
<style>
|
||||
body {
|
||||
border-block-color: lime;
|
||||
}
|
||||
div {
|
||||
margin-inline-start: 5px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div>test</div>
|
||||
</body>
|
||||
`,
|
||||
expectedIssuesOnSelected: [{ property: "border-block-color" }],
|
||||
expectedIssuesOnAll: [
|
||||
{ property: "border-block-color" },
|
||||
{ property: "margin-inline-start" },
|
||||
],
|
||||
};
|
||||
|
||||
const TEST_DATA_NO_ISSUES = {
|
||||
uri: "<body></body>",
|
||||
expectedIssuesOnSelected: [],
|
||||
expectedIssuesOnAll: [],
|
||||
};
|
||||
|
||||
add_task(async function() {
|
||||
const tab = await addTab(
|
||||
"data:text/html;charset=utf-8," + encodeURIComponent(TEST_DATA_ISSUES.uri)
|
||||
);
|
||||
|
||||
const {
|
||||
allElementsPane,
|
||||
inspector,
|
||||
selectedElementPane,
|
||||
} = await openCompatibilityView();
|
||||
|
||||
info("Check issues at initial");
|
||||
await assertIssues(selectedElementPane, allElementsPane, TEST_DATA_ISSUES);
|
||||
|
||||
info("Navigate to next uri that has no issues");
|
||||
await navigateTo(TEST_DATA_NO_ISSUES.uri, tab, inspector);
|
||||
info("Check issues after navigating");
|
||||
await assertIssues(selectedElementPane, allElementsPane, TEST_DATA_NO_ISSUES);
|
||||
|
||||
info("Revert the uri");
|
||||
await navigateTo(TEST_DATA_ISSUES.uri, tab, inspector);
|
||||
info("Check issues after reverting");
|
||||
await assertIssues(selectedElementPane, allElementsPane, TEST_DATA_ISSUES);
|
||||
});
|
||||
|
||||
async function assertIssues(
|
||||
selectedElementPane,
|
||||
allElementsPane,
|
||||
{ expectedIssuesOnSelected, expectedIssuesOnAll }
|
||||
) {
|
||||
await assertIssueList(selectedElementPane, expectedIssuesOnSelected);
|
||||
await assertIssueList(allElementsPane, expectedIssuesOnAll);
|
||||
}
|
||||
|
||||
async function navigateTo(uri, tab, { store }) {
|
||||
uri = "data:text/html;charset=utf-8," + encodeURIComponent(uri);
|
||||
const onSelectedNodeUpdated = waitForUpdateSelectedNodeAction(store);
|
||||
const onTopLevelTargetUpdated = waitForUpdateTopLevelTargetAction(store);
|
||||
const onLoaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
await BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
|
||||
await Promise.all([onLoaded, onSelectedNodeUpdated, onTopLevelTargetUpdated]);
|
||||
}
|
||||
Reference in new issue
Block a user