summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser/browser_jsterm_helper_clear.js
blob: 70c52f384805c73946381bc3cd85c5de068d8021 (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
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

const TEST_URI =
  "data:text/html,<!DOCTYPE html>Test <code>clear()</code> jsterm helper";

add_task(async function () {
  const hud = await openNewTabAndConsole(TEST_URI);

  const onMessage = waitForMessageByType(hud, "message", ".console-api");
  SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
    content.wrappedJSObject.console.log("message");
  });
  await onMessage;

  const onCleared = waitFor(
    () => hud.ui.outputNode.querySelector(".message") === null
  );
  execute(hud, "clear()");
  await onCleared;
  ok(true, "Console was cleared");
});