This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1471764 - Add unit tests for the toggling the flexbox and grid hi…
…ghlighter from the markup display badges. r=jdescottes
- Loading branch information
1 parent
95050e8
commit f01fd71
Showing
13 changed files
with
217 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
devtools/client/inspector/markup/test/browser_markup_flex_display_badge.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
// Tests that the flex display badge toggles on the flexbox highlighter. | ||
|
||
const TEST_URI = ` | ||
<style type="text/css"> | ||
#flex { | ||
display: flex; | ||
} | ||
</style> | ||
<div id="flex"></div> | ||
`; | ||
|
||
const HIGHLIGHTER_TYPE = "FlexboxHighlighter"; | ||
|
||
add_task(async function() { | ||
await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); | ||
const { inspector } = await openLayoutView(); | ||
const { highlighters, store } = inspector; | ||
|
||
info("Check the flex display badge is shown and not active."); | ||
await selectNode("#flex", inspector); | ||
const flexContainer = await getContainerForSelector("#flex", inspector); | ||
const flexDisplayBadge = flexContainer.elt.querySelector(".markup-badge[data-display]"); | ||
ok(!flexDisplayBadge.classList.contains("active"), "flex display badge is not active."); | ||
|
||
info("Check the initial state of the flex highlighter."); | ||
ok(!highlighters.highlighters[HIGHLIGHTER_TYPE], | ||
"No flexbox highlighter exists in the highlighters overlay."); | ||
ok(!highlighters.flexboxHighlighterShown, "No flexbox highlighter is shown."); | ||
|
||
info("Toggling ON the flexbox highlighter from the flex display badge."); | ||
const onHighlighterShown = highlighters.once("flexbox-highlighter-shown"); | ||
let onCheckboxChange = waitUntilState(store, state => state.flexbox.highlighted); | ||
flexDisplayBadge.click(); | ||
await onHighlighterShown; | ||
await onCheckboxChange; | ||
|
||
info("Check the flexbox highlighter is created and flex display badge state."); | ||
ok(highlighters.highlighters[HIGHLIGHTER_TYPE], | ||
"Flexbox highlighter is created in the highlighters overlay."); | ||
ok(highlighters.flexboxHighlighterShown, "Flexbox highlighter is shown."); | ||
ok(flexDisplayBadge.classList.contains("active"), "flex display badge is active."); | ||
|
||
info("Toggling OFF the flexbox highlighter from the flex display badge."); | ||
const onHighlighterHidden = highlighters.once("flexbox-highlighter-hidden"); | ||
onCheckboxChange = waitUntilState(store, state => !state.flexbox.highlighted); | ||
flexDisplayBadge.click(); | ||
await onHighlighterHidden; | ||
await onCheckboxChange; | ||
|
||
ok(!flexDisplayBadge.classList.contains("active"), "flex display badge is not active."); | ||
}); |
Oops, something went wrong.