summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/markup/test/browser_markup_events_03.js
blob: b0de4561e0e5786b6ed23cbdc6372225f847a174 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from helper_events_test_runner.js */

"use strict";

// Test that markup view event bubbles show the correct event info for DOM
// events.

const TEST_URL = URL_ROOT_SSL + "doc_markup_events_03.html";

loadHelperScript("helper_events_test_runner.js");

const TEST_DATA = [
  {
    selector: "#es6-method",
    expected: [
      {
        type: "click",
        filename: TEST_URL + ":70:17",
        attributes: ["Bubbling"],
        handler:
          "es6Method(foo, bar) {\n" + '  alert("obj.es6Method");\n' + "}",
      },
    ],
  },
  {
    selector: "#generator",
    expected: [
      {
        type: "click",
        filename: TEST_URL + ":91:25",
        attributes: ["Bubbling"],
        handler: "function* generator() {\n" + '  alert("generator");\n' + "}",
      },
    ],
  },
  {
    selector: "#anon-generator",
    expected: [
      {
        type: "click",
        filename: TEST_URL + ":47:58",
        attributes: ["Bubbling"],
        handler: "function*() {\n" + '  alert("anonGenerator");\n' + "}",
      },
    ],
  },
  {
    selector: "#named-function-expression",
    expected: [
      {
        type: "click",
        filename: TEST_URL + ":22:18",
        attributes: ["Bubbling"],
        handler:
          "function foo() {\n" + '  alert("namedFunctionExpression");\n' + "}",
      },
    ],
  },
  {
    selector: "#anon-function-expression",
    expected: [
      {
        type: "click",
        filename: TEST_URL + ":26:45",
        attributes: ["Bubbling"],
        handler:
          "function() {\n" + '  alert("anonFunctionExpression");\n' + "}",
      },
    ],
  },
  {
    selector: "#returned-function",
    expected: [
      {
        type: "click",
        filename: TEST_URL + ":31:27",
        attributes: ["Bubbling"],
        handler: "function bar() {\n" + '  alert("returnedFunction");\n' + "}",
      },
    ],
  },
];

add_task(async function () {
  await runEventPopupTests(TEST_URL, TEST_DATA);
});