summaryrefslogtreecommitdiffstats
path: root/devtools/client/webaudioeditor/test/browser_wa_inspector.js
blob: 5599ad36fb84223d057826688f4ab6fa60f6aa3f (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

/**
 * Tests that inspector view opens on graph node click, and
 * loads the correct node inside the inspector.
 */

add_task(function* () {
  let { target, panel } = yield initWebAudioEditor(SIMPLE_CONTEXT_URL);
  let { panelWin } = panel;
  let { gFront, $, $$, EVENTS, InspectorView } = panelWin;
  let gVars = InspectorView._propsView;

  let started = once(gFront, "start-context");

  let events = Promise.all([
    get3(gFront, "create-node"),
    waitForGraphRendered(panelWin, 3, 2)
  ]);
  reload(target);
  let [actors] = yield events;
  let nodeIds = actors.map(actor => actor.actorID);

  ok(!InspectorView.isVisible(), "InspectorView hidden on start.");
  ok(isVisible($("#web-audio-editor-details-pane-empty")),
    "InspectorView empty message should show when no node's selected.");
  ok(!isVisible($("#web-audio-editor-tabs")),
    "InspectorView tabs view should be hidden when no node's selected.");

  // Wait for the node to be set as well as the inspector to come fully into the view
  yield clickGraphNode(panelWin, findGraphNode(panelWin, nodeIds[1]), true);

  ok(InspectorView.isVisible(), "InspectorView shown once node selected.");
  ok(!isVisible($("#web-audio-editor-details-pane-empty")),
    "InspectorView empty message hidden when node selected.");
  ok(isVisible($("#web-audio-editor-tabs")),
    "InspectorView tabs view visible when node selected.");

  is($("#web-audio-editor-tabs").selectedIndex, 0,
    "default tab selected should be the parameters tab.");

  yield clickGraphNode(panelWin, findGraphNode(panelWin, nodeIds[2]));

  yield teardown(target);
});