michael@0: /* vim: set ts=2 et sw=2 tw=80: */
michael@0: /* Any copyright is dedicated to the Public Domain.
michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0:
michael@0: "use strict";
michael@0:
michael@0: // Test outerHTML edition via the markup-view
michael@0:
michael@0: loadHelperScript("helper_outerhtml_test_runner.js");
michael@0:
michael@0: const TEST_DATA = [
michael@0: {
michael@0: selector: "#one",
michael@0: oldHTML: '
First Div
',
michael@0: newHTML: 'First Div
',
michael@0: validate: function(pageNode, selectedNode) {
michael@0: is(pageNode.textContent, "First Div", "New div has expected text content");
michael@0: ok(!getNode("#one em"), "No em remaining")
michael@0: }
michael@0: },
michael@0: {
michael@0: selector: "#removedChildren",
michael@0: oldHTML: 'removedChild Italic Bold Underline Normal
',
michael@0: newHTML: 'removedChild
'
michael@0: },
michael@0: {
michael@0: selector: "#addedChildren",
michael@0: oldHTML: 'addedChildren
',
michael@0: newHTML: 'addedChildren Italic Bold Underline Normal
'
michael@0: },
michael@0: {
michael@0: selector: "#addedAttribute",
michael@0: oldHTML: 'addedAttribute
',
michael@0: newHTML: 'addedAttribute
',
michael@0: validate: function(pageNode, selectedNode) {
michael@0: is(pageNode, selectedNode, "Original element is selected");
michael@0: is(pageNode.outerHTML, 'addedAttribute
',
michael@0: "Attributes have been added");
michael@0: }
michael@0: },
michael@0: {
michael@0: selector: "#changedTag",
michael@0: oldHTML: 'changedTag
',
michael@0: newHTML: 'changedTag
'
michael@0: },
michael@0: {
michael@0: selector: "#siblings",
michael@0: oldHTML: 'siblings
',
michael@0: newHTML: 'before sibling
' +
michael@0: 'siblings (updated)
' +
michael@0: 'after sibling
',
michael@0: validate: function(pageNode, selectedNode) {
michael@0: let beforeSiblingNode = getNode("#siblings-before-sibling");
michael@0: let afterSiblingNode = getNode("#siblings-after-sibling");
michael@0:
michael@0: is(beforeSiblingNode, selectedNode, "Sibling has been selected");
michael@0: is(pageNode.textContent, "siblings (updated)", "New div has expected text content");
michael@0: is(beforeSiblingNode.textContent, "before sibling", "Sibling has been inserted");
michael@0: is(afterSiblingNode.textContent, "after sibling", "Sibling has been inserted");
michael@0: }
michael@0: }
michael@0: ];
michael@0:
michael@0: const TEST_URL = "data:text/html," +
michael@0: "" +
michael@0: "" +
michael@0: "" +
michael@0: [outer.oldHTML for (outer of TEST_DATA)].join("\n") +
michael@0: "" +
michael@0: "