summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/new/test/mochitest/browser_dbg-searching.js
blob: dd25e2b5494fc95ca5d3042c1c714c8c581222a4 (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
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

// Testing source search
add_task(function* () {
  const dbg = yield initDebugger("doc-script-switching.html");

  pressKey(dbg, "sourceSearch");
  yield waitForElement(dbg, "input");
  findElementWithSelector(dbg, "input").focus();
  type(dbg, "sw");
  pressKey(dbg, "Enter");

  yield waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
  let source = dbg.selectors.getSelectedSource(dbg.getState());
  ok(source.get("url").match(/switching-01/), "first source is selected");

  // 2. arrow keys and check to see if source is selected
  pressKey(dbg, "sourceSearch");
  findElementWithSelector(dbg, "input").focus();
  type(dbg, "sw");
  pressKey(dbg, "Down");
  pressKey(dbg, "Enter");

  yield waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
  source = dbg.selectors.getSelectedSource(dbg.getState());
  ok(source.get("url").match(/switching-02/), "second source is selected");
});