summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/markup/test/browser_markup_tag_edit_01.js
blob: b1b4f7115bbbd7f10b18c40a3af8e543e0ce595e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* 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";

// Test editing various markup-containers' attribute fields

loadHelperScript("helper_attributes_test_runner.js");

const TEST_URL = URL_ROOT + "doc_markup_edit.html";
var TEST_DATA = [{
  desc: "Change an attribute",
  node: "#node1",
  originalAttributes: {
    id: "node1",
    class: "node1"
  },
  name: "class",
  value: 'class="changednode1"',
  expectedAttributes: {
    id: "node1",
    class: "changednode1"
  }
}, {
  desc: "Try changing an attribute to a quote (\") - this should result " +
        "in it being set to an empty string",
  node: "#node22",
  originalAttributes: {
    id: "node22",
    class: "unchanged"
  },
  name: "class",
  value: 'class="""',
  expectedAttributes: {
    id: "node22",
    class: ""
  }
}, {
  desc: "Remove an attribute",
  node: "#node4",
  originalAttributes: {
    id: "node4",
    class: "node4"
  },
  name: "class",
  value: "",
  expectedAttributes: {
    id: "node4"
  }
}, {
  desc: "Try add attributes by adding to an existing attribute's entry",
  node: "#node24",
  originalAttributes: {
    id: "node24"
  },
  name: "id",
  value: 'id="node24" class="""',
  expectedAttributes: {
    id: "node24",
    class: ""
  }
}];

add_task(function* () {
  let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
  yield runEditAttributesTests(TEST_DATA, inspector, testActor);
});