browser_wa_graph-click.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Tests that the clicking on a node in the GraphView opens and sets
  5. * the correct node in the InspectorView
  6. */
  7. add_task(function* () {
  8. let { target, panel } = yield initWebAudioEditor(COMPLEX_CONTEXT_URL);
  9. let panelWin = panel.panelWin;
  10. let { gFront, $, $$, InspectorView } = panelWin;
  11. let started = once(gFront, "start-context");
  12. let events = Promise.all([
  13. getN(gFront, "create-node", 8),
  14. waitForGraphRendered(panel.panelWin, 8, 8)
  15. ]);
  16. reload(target);
  17. let [actors, _] = yield events;
  18. let nodeIds = actors.map(actor => actor.actorID);
  19. ok(!InspectorView.isVisible(), "InspectorView hidden on start.");
  20. yield clickGraphNode(panelWin, nodeIds[1], true);
  21. ok(InspectorView.isVisible(), "InspectorView visible after selecting a node.");
  22. is(InspectorView.getCurrentAudioNode().id, nodeIds[1], "InspectorView has correct node set.");
  23. yield clickGraphNode(panelWin, nodeIds[2]);
  24. ok(InspectorView.isVisible(), "InspectorView still visible after selecting another node.");
  25. is(InspectorView.getCurrentAudioNode().id, nodeIds[2], "InspectorView has correct node set on second node.");
  26. yield clickGraphNode(panelWin, nodeIds[2]);
  27. is(InspectorView.getCurrentAudioNode().id, nodeIds[2], "Clicking the same node again works (idempotent).");
  28. yield clickGraphNode(panelWin, $("rect", findGraphNode(panelWin, nodeIds[3])));
  29. is(InspectorView.getCurrentAudioNode().id, nodeIds[3], "Clicking on a <rect> works as expected.");
  30. yield clickGraphNode(panelWin, $("tspan", findGraphNode(panelWin, nodeIds[4])));
  31. is(InspectorView.getCurrentAudioNode().id, nodeIds[4], "Clicking on a <tspan> works as expected.");
  32. ok(InspectorView.isVisible(),
  33. "InspectorView still visible after several nodes have been clicked.");
  34. yield teardown(target);
  35. });