browser/devtools/webconsole/test/browser_webconsole_output_03.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_output_03.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,163 @@
     1.4 +/*
     1.5 + * Any copyright is dedicated to the Public Domain.
     1.6 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.7 + */
     1.8 +
     1.9 +// Test the webconsole output for various types of objects.
    1.10 +
    1.11 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-03.html";
    1.12 +
    1.13 +let inputTests = [
    1.14 +  // 0
    1.15 +  {
    1.16 +    input: "document",
    1.17 +    output: "HTMLDocument \u2192 " + TEST_URI,
    1.18 +    printOutput: "[object HTMLDocument]",
    1.19 +    inspectable: true,
    1.20 +    noClick: true,
    1.21 +  },
    1.22 +
    1.23 +  // 1
    1.24 +  {
    1.25 +    input: "window",
    1.26 +    output: "Window \u2192 " + TEST_URI,
    1.27 +    printOutput: "[object Window",
    1.28 +    inspectable: true,
    1.29 +    noClick: true,
    1.30 +  },
    1.31 +
    1.32 +  // 2
    1.33 +  {
    1.34 +    input: "document.body",
    1.35 +    output: "<body>",
    1.36 +    printOutput: "[object HTMLBodyElement]",
    1.37 +    inspectable: true,
    1.38 +    noClick: true,
    1.39 +  },
    1.40 +
    1.41 +  // 3
    1.42 +  {
    1.43 +    input: "document.body.dataset",
    1.44 +    output: "DOMStringMap {  }",
    1.45 +    printOutput: "[object DOMStringMap]",
    1.46 +    inspectable: true,
    1.47 +    variablesViewLabel: "DOMStringMap[0]",
    1.48 +  },
    1.49 +
    1.50 +  // 4
    1.51 +  {
    1.52 +    input: "document.body.classList",
    1.53 +    output: "DOMTokenList [  ]",
    1.54 +    printOutput: '""',
    1.55 +    inspectable: true,
    1.56 +    variablesViewLabel: "DOMTokenList[0]",
    1.57 +  },
    1.58 +
    1.59 +  // 5
    1.60 +  {
    1.61 +    input: "window.location.href",
    1.62 +    output: '"' + TEST_URI + '"',
    1.63 +  },
    1.64 +
    1.65 +  // 6
    1.66 +  {
    1.67 +    input: "window.location",
    1.68 +    output: "Location \u2192 " + TEST_URI,
    1.69 +    printOutput: TEST_URI,
    1.70 +    inspectable: true,
    1.71 +    variablesViewLabel: "Location \u2192 test-console-output-03.html",
    1.72 +  },
    1.73 +
    1.74 +  // 7
    1.75 +  {
    1.76 +    input: "document.body.attributes",
    1.77 +    output: "MozNamedAttrMap [  ]",
    1.78 +    printOutput: "[object MozNamedAttrMap]",
    1.79 +    inspectable: true,
    1.80 +    variablesViewLabel: "MozNamedAttrMap[0]",
    1.81 +  },
    1.82 +
    1.83 +  // 8
    1.84 +  {
    1.85 +    input: "document.styleSheets",
    1.86 +    output: "StyleSheetList [  ]",
    1.87 +    printOutput: "[object StyleSheetList",
    1.88 +    inspectable: true,
    1.89 +    variablesViewLabel: "StyleSheetList[0]",
    1.90 +  },
    1.91 +
    1.92 +  // 9
    1.93 +  {
    1.94 +    input: "testBodyClassName()",
    1.95 +    output: '<body class="test1 tezt2">',
    1.96 +    printOutput: "[object HTMLBodyElement]",
    1.97 +    inspectable: true,
    1.98 +    noClick: true,
    1.99 +  },
   1.100 +
   1.101 +  // 10
   1.102 +  {
   1.103 +    input: "testBodyID()",
   1.104 +    output: '<body class="test1 tezt2" id="foobarid">',
   1.105 +    printOutput: "[object HTMLBodyElement]",
   1.106 +    inspectable: true,
   1.107 +    noClick: true,
   1.108 +  },
   1.109 +
   1.110 +  // 11
   1.111 +  {
   1.112 +    input: "document.body.classList",
   1.113 +    output: 'DOMTokenList [ "test1", "tezt2" ]',
   1.114 +    printOutput: '"test1 tezt2"',
   1.115 +    inspectable: true,
   1.116 +    variablesViewLabel: "DOMTokenList[2]",
   1.117 +  },
   1.118 +
   1.119 +  // 12
   1.120 +  {
   1.121 +    input: "testBodyDataset()",
   1.122 +    output: '<body class="test1 tezt2" id="foobarid"' +
   1.123 +            ' data-preview="zuzu&quot;&lt;a&gt;foo">',
   1.124 +    printOutput: "[object HTMLBodyElement]",
   1.125 +    inspectable: true,
   1.126 +    noClick: true,
   1.127 +  },
   1.128 +
   1.129 +  // 13
   1.130 +  {
   1.131 +    input: "document.body.dataset",
   1.132 +    output: 'DOMStringMap { preview: "zuzu"<a>foo" }',
   1.133 +    printOutput: "[object DOMStringMap]",
   1.134 +    inspectable: true,
   1.135 +    variablesViewLabel: "DOMStringMap[1]",
   1.136 +  },
   1.137 +
   1.138 +  // 14
   1.139 +  {
   1.140 +    input: "document.body.attributes",
   1.141 +    output: 'MozNamedAttrMap [ class="test1 tezt2", id="foobarid", ' +
   1.142 +            'data-preview="zuzu&quot;&lt;a&gt;foo" ]',
   1.143 +    printOutput: "[object MozNamedAttrMap]",
   1.144 +    inspectable: true,
   1.145 +    variablesViewLabel: "MozNamedAttrMap[3]",
   1.146 +  },
   1.147 +
   1.148 +  // 15
   1.149 +  {
   1.150 +    input: "document.body.attributes[0]",
   1.151 +    output: 'class="test1 tezt2"',
   1.152 +    printOutput: "[object Attr]",
   1.153 +    inspectable: true,
   1.154 +    variablesViewLabel: 'class="test1 tezt2"',
   1.155 +  },
   1.156 +];
   1.157 +
   1.158 +function test() {
   1.159 +  requestLongerTimeout(2);
   1.160 +  Task.spawn(function*() {
   1.161 +    const {tab} = yield loadTab(TEST_URI);
   1.162 +    const hud = yield openConsole(tab);
   1.163 +    yield checkOutputForInputs(hud, inputTests);
   1.164 +    inputTests = null;
   1.165 +  }).then(finishTest);
   1.166 +}

mercurial