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

"use strict";

const TEST_URI =
  "data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test for bug 1567372";

add_task(async function () {
  await pushPref("devtools.webconsole.input.editor", true);

  const hud = await openNewTabAndConsole(TEST_URI);

  info("Searching for `.webconsole-editor-toolbar`");
  const editorToolbar = hud.ui.outputNode.querySelector(
    ".webconsole-editor-toolbar"
  );

  info("Searching for `.webconsole-editor-toolbar-reverseSearchButton`");
  const reverseSearchButton = editorToolbar.querySelector(
    ".webconsole-editor-toolbar-reverseSearchButton"
  );

  const onReverseSearchUiOpen = waitFor(
    () => getReverseSearchElement(hud) != null
  );

  info("Performing click on `.webconsole-editor-toolbar-reverseSearchButton`");
  reverseSearchButton.click();

  await onReverseSearchUiOpen;
  ok(true, "Reverse Search UI is open");

  ok(
    reverseSearchButton.classList.contains("checked"),
    "Reverse Search Button is marked as checked"
  );

  const onReverseSearchUiClosed = waitFor(
    () => getReverseSearchElement(hud) == null
  );

  info("Performing click on `.webconsole-editor-toolbar-reverseSearchButton`");
  reverseSearchButton.click();

  await onReverseSearchUiClosed;
  ok(true, "Reverse Search UI is closed");

  ok(
    !reverseSearchButton.classList.contains("checked"),
    "Reverse Search Button is NOT marked as checked"
  );
});