browser_perf-tree-abstract-04.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. "use strict";
  4. /**
  5. * Tests that the treeview expander arrow doesn't react to dblclick events.
  6. */
  7. const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils");
  8. const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils");
  9. const { once } = require("devtools/client/performance/test/helpers/event-utils");
  10. add_task(function* () {
  11. let { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass();
  12. let container = document.createElement("vbox");
  13. yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
  14. // Populate the tree and test the root item...
  15. let treeRoot = new MyCustomTreeItem(myDataSrc, { parent: null });
  16. treeRoot.attachTo(container);
  17. let originalTreeRootExpandedState = treeRoot.expanded;
  18. info("Double clicking on the root item arrow and waiting for focus event.");
  19. let receivedFocusEvent = once(treeRoot, "focus");
  20. dblclick(treeRoot.target.querySelector(".arrow"));
  21. yield receivedFocusEvent;
  22. is(treeRoot.expanded, originalTreeRootExpandedState,
  23. "A double click on the arrow was ignored.");
  24. container.remove();
  25. });