summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/rules/test/browser_rules_shapes-toggle_04.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--devtools/client/inspector/rules/test/browser_rules_shapes-toggle_04.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/devtools/client/inspector/rules/test/browser_rules_shapes-toggle_04.js b/devtools/client/inspector/rules/test/browser_rules_shapes-toggle_04.js
new file mode 100644
index 0000000000..0add21381f
--- /dev/null
+++ b/devtools/client/inspector/rules/test/browser_rules_shapes-toggle_04.js
@@ -0,0 +1,48 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test toggling the shapes highlighter in the rule view and modifying the 'clip-path'
+// declaration.
+
+const TEST_URI = `
+ <style type='text/css'>
+ #shape {
+ width: 800px;
+ height: 800px;
+ clip-path: circle(25%);
+ }
+ </style>
+ <div id="shape"></div>
+`;
+
+add_task(async function () {
+ await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ const { inspector, view } = await openRuleView();
+ const highlighters = view.highlighters;
+
+ info("Select a node with a shape value");
+ await selectNode("#shape", inspector);
+ const container = getRuleViewProperty(view, "#shape", "clip-path").valueSpan;
+ let shapeToggle = container.querySelector(".ruleview-shapeswatch");
+
+ info("Toggling ON the CSS shape highlighter from the rule-view.");
+ const onHighlighterShown = highlighters.once("shapes-highlighter-shown");
+ shapeToggle.click();
+ await onHighlighterShown;
+
+ info("Edit the clip-path property to ellipse.");
+ const editor = await focusEditableField(view, container, 30);
+ const onDone = view.once("ruleview-changed");
+ editor.input.value = "ellipse(30% 20%);";
+ EventUtils.synthesizeKey("VK_RETURN", {}, view.styleWindow);
+ await onDone;
+
+ info(
+ "Check the shape highlighter and shape toggle button are still visible."
+ );
+ shapeToggle = container.querySelector(".ruleview-shapeswatch");
+ ok(shapeToggle, "Shape highlighter toggle is visible.");
+ ok(highlighters.shapesHighlighterShown, "CSS shape highlighter is shown.");
+});