diff options
Diffstat (limited to '')
-rw-r--r-- | devtools/client/inspector/rules/test/browser_rules_add-property-invalid-identifier.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/devtools/client/inspector/rules/test/browser_rules_add-property-invalid-identifier.js b/devtools/client/inspector/rules/test/browser_rules_add-property-invalid-identifier.js new file mode 100644 index 0000000000..e4a4b0fba1 --- /dev/null +++ b/devtools/client/inspector/rules/test/browser_rules_add-property-invalid-identifier.js @@ -0,0 +1,33 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test adding properties that are invalid identifiers. + +const TEST_URI = "<div id='testid'>Styled Node</div>"; +const TEST_DATA = [ + { name: "1", value: "100" }, + { name: "-1", value: "100" }, + { name: "1a", value: "100" }, + { name: "-11a", value: "100" }, +]; + +add_task(async function () { + await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); + const { inspector, view } = await openRuleView(); + await selectNode("#testid", inspector); + + for (const { name, value } of TEST_DATA) { + info(`Test creating a new property ${name}: ${value}`); + const declaration = await addProperty(view, 0, name, value); + + is(declaration.name, name, "Property name should have been changed."); + is(declaration.value, value, "Property value should have been changed."); + is( + declaration.editor.isValid(), + false, + "The declaration should be invalid." + ); + } +}); |