From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../browser_rules_completion-new-property_03.js | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 devtools/client/inspector/rules/test/browser_rules_completion-new-property_03.js (limited to 'devtools/client/inspector/rules/test/browser_rules_completion-new-property_03.js') diff --git a/devtools/client/inspector/rules/test/browser_rules_completion-new-property_03.js b/devtools/client/inspector/rules/test/browser_rules_completion-new-property_03.js new file mode 100644 index 0000000000..4f5577a21e --- /dev/null +++ b/devtools/client/inspector/rules/test/browser_rules_completion-new-property_03.js @@ -0,0 +1,49 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Regression test for a case where completing gave the wrong answer. +// See bug 1179318. + +const TEST_URI = "

Header

"; + +add_task(async function () { + await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); + const { toolbox, inspector, view } = await openRuleView(); + + info("Test autocompletion for background-color"); + await runAutocompletionTest(toolbox, inspector, view); +}); + +async function runAutocompletionTest(toolbox, inspector, view) { + info("Selecting the test node"); + await selectNode("h1", inspector); + + info("Focusing the new property editable field"); + const ruleEditor = getRuleViewRuleEditor(view, 0); + const editor = await focusNewRuleViewProperty(ruleEditor); + + info('Sending "background" to the editable field'); + for (const key of "background") { + const onSuggest = editor.once("after-suggest"); + EventUtils.synthesizeKey(key, {}, view.styleWindow); + await onSuggest; + } + + const itemIndex = 4; + + const bgcItem = editor.popup.getItemAtIndex(itemIndex); + is( + bgcItem.label, + "background-color", + "check the expected completion element" + ); + + editor.popup.selectedIndex = itemIndex; + + const node = editor.popup._list.childNodes[itemIndex]; + EventUtils.synthesizeMouseAtCenter(node, {}, editor.popup._window); + + is(editor.input.value, "background-color", "Correct value is autocompleted"); +} -- cgit v1.2.3