browser/devtools/webconsole/test/browser_webconsole_output_order.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:734aa398c29f
1 /* vim:set ts=2 sw=2 sts=2 et: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 // Tests that any output created from calls to the console API comes after the
7 // echoed JavaScript.
8
9 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
10
11 function test() {
12 addTab(TEST_URI);
13 browser.addEventListener("load", function onLoad() {
14 browser.removeEventListener("load", onLoad, true);
15 openConsole(null, testOutputOrder);
16 }, true);
17 }
18
19 function testOutputOrder(hud) {
20 let jsterm = hud.jsterm;
21 let outputNode = jsterm.outputNode;
22
23 jsterm.clearOutput();
24 jsterm.execute("console.log('foo', 'bar');");
25
26 waitForMessages({
27 webconsole: hud,
28 messages: [{
29 text: "console.log('foo', 'bar');",
30 category: CATEGORY_INPUT,
31 },
32 {
33 text: "undefined",
34 category: CATEGORY_OUTPUT,
35 },
36 {
37 text: '"foo" "bar"',
38 category: CATEGORY_WEBDEV,
39 severity: SEVERITY_LOG,
40 }],
41 }).then(([function_call, result, console_message]) => {
42 let fncall_node = [...function_call.matched][0];
43 let result_node = [...result.matched][0];
44 let console_message_node = [...console_message.matched][0];
45 is(fncall_node.nextElementSibling, result_node,
46 "console.log() is followed by undefined");
47 is(result_node.nextElementSibling, console_message_node,
48 "undefined is followed by 'foo' 'bar'");
49 finishTest();
50 });
51 }

mercurial