summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/markup/test/browser_markup_tag_edit_06.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/inspector/markup/test/browser_markup_tag_edit_06.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/inspector/markup/test/browser_markup_tag_edit_06.js')
-rw-r--r--devtools/client/inspector/markup/test/browser_markup_tag_edit_06.js85
1 files changed, 85 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_tag_edit_06.js b/devtools/client/inspector/markup/test/browser_markup_tag_edit_06.js
new file mode 100644
index 000000000..8202bd0a2
--- /dev/null
+++ b/devtools/client/inspector/markup/test/browser_markup_tag_edit_06.js
@@ -0,0 +1,85 @@
+/* vim: set ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+/* import-globals-from helper_attributes_test_runner.js */
+"use strict";
+
+// Tests that adding various types of attributes to nodes in the markup-view
+// works as expected. Also checks that the changes are properly undoable and
+// redoable. For each step in the test, we:
+// - Create a new DIV
+// - Make the change, check that the change was made as we expect
+// - Undo the change, check that the node is back in its original state
+// - Redo the change, check that the node change was made again correctly.
+
+loadHelperScript("helper_attributes_test_runner.js");
+
+var TEST_URL = "data:text/html,<div>markup-view attributes addition test</div>";
+var TEST_DATA = [{
+ desc: "Mixed single and double quotes",
+ text: "name=\"hi\" maxlength='not a number'",
+ expectedAttributes: {
+ maxlength: "not a number",
+ name: "hi"
+ }
+}, {
+ desc: "Invalid attribute name",
+ text: "x='y' <why-would-you-do-this>=\"???\"",
+ expectedAttributes: {
+ x: "y"
+ }
+}, {
+ desc: "Double quote wrapped in single quotes",
+ text: "x='h\"i'",
+ expectedAttributes: {
+ x: "h\"i"
+ }
+}, {
+ desc: "Single quote wrapped in double quotes",
+ text: "x=\"h'i\"",
+ expectedAttributes: {
+ x: "h'i"
+ }
+}, {
+ desc: "No quote wrapping",
+ text: "a=b x=y data-test=Some spaced data",
+ expectedAttributes: {
+ a: "b",
+ x: "y",
+ "data-test": "Some",
+ spaced: "",
+ data: ""
+ }
+}, {
+ desc: "Duplicate Attributes",
+ text: "a=b a='c' a=\"d\"",
+ expectedAttributes: {
+ a: "b"
+ }
+}, {
+ desc: "Inline styles",
+ text: "style=\"font-family: 'Lucida Grande', sans-serif; font-size: 75%;\"",
+ expectedAttributes: {
+ style: "font-family: 'Lucida Grande', sans-serif; font-size: 75%;"
+ }
+}, {
+ desc: "Object attribute names",
+ text: "toString=\"true\" hasOwnProperty=\"false\"",
+ expectedAttributes: {
+ tostring: "true",
+ hasownproperty: "false"
+ }
+}, {
+ desc: "Add event handlers",
+ text: "onclick=\"javascript: throw new Error('wont fire');\" " +
+ "onload=\"alert('here');\"",
+ expectedAttributes: {
+ onclick: "javascript: throw new Error('wont fire');",
+ onload: "alert('here');"
+ }
+}];
+
+add_task(function* () {
+ let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
+ yield runAddAttributesTests(TEST_DATA, "div", inspector, testActor);
+});