summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/rules/test/browser_rules_add-property-cancel_02.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/inspector/rules/test/browser_rules_add-property-cancel_02.js
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/inspector/rules/test/browser_rules_add-property-cancel_02.js')
-rw-r--r--devtools/client/inspector/rules/test/browser_rules_add-property-cancel_02.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/devtools/client/inspector/rules/test/browser_rules_add-property-cancel_02.js b/devtools/client/inspector/rules/test/browser_rules_add-property-cancel_02.js
new file mode 100644
index 0000000000..e47023e8f3
--- /dev/null
+++ b/devtools/client/inspector/rules/test/browser_rules_add-property-cancel_02.js
@@ -0,0 +1,45 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Tests adding a new property and escapes the new empty property value editor.
+
+const TEST_URI = `
+ <style type='text/css'>
+ #testid {
+ background-color: blue;
+ }
+ </style>
+ <div id='testid'>Styled Node</div>
+`;
+
+add_task(async function () {
+ await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ const { inspector, view } = await openRuleView();
+ await selectNode("#testid", inspector);
+
+ info("Test creating a new property and escaping");
+ await addProperty(view, 1, "color", "red", {
+ commitValueWith: "VK_ESCAPE",
+ blurNewProperty: false,
+ });
+
+ is(
+ view.styleDocument.activeElement,
+ view.styleDocument.body,
+ "Correct element has focus"
+ );
+
+ const elementRuleEditor = getRuleViewRuleEditor(view, 1);
+ is(
+ elementRuleEditor.rule.textProps.length,
+ 1,
+ "Removed the new text property."
+ );
+ is(
+ elementRuleEditor.propertyList.children.length,
+ 1,
+ "Removed the property editor."
+ );
+});