browser_dbg_variables-view-popup-02.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
  2. /* Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/ */
  4. /**
  5. * Tests opening the variable inspection popup on a variable which has a
  6. * a property accessible via getters and setters.
  7. */
  8. const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
  9. function test() {
  10. Task.spawn(function* () {
  11. let options = {
  12. source: TAB_URL,
  13. line: 1
  14. };
  15. let [tab,, panel] = yield initDebugger(TAB_URL, options);
  16. let win = panel.panelWin;
  17. let bubble = win.DebuggerView.VariableBubble;
  18. let tooltip = bubble._tooltip.panel;
  19. function verifyContents(textContent, className) {
  20. is(tooltip.querySelectorAll(".variables-view-container").length, 0,
  21. "There should be no variables view containers added to the tooltip.");
  22. is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
  23. "There should be a simple text node added to the tooltip instead.");
  24. is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent,
  25. "The inspected property's value is correct.");
  26. ok(tooltip.querySelector(".devtools-tooltip-simple-text").className.includes(className),
  27. "The inspected property's value is colorized correctly.");
  28. }
  29. let onCaretAndScopes = waitForCaretAndScopes(panel, 24);
  30. callInTab(tab, "start");
  31. yield onCaretAndScopes;
  32. // Inspect properties.
  33. yield openVarPopup(panel, { line: 19, ch: 10 });
  34. verifyContents("42", "token-number");
  35. yield reopenVarPopup(panel, { line: 20, ch: 14 });
  36. verifyContents("42", "token-number");
  37. yield reopenVarPopup(panel, { line: 21, ch: 14 });
  38. verifyContents("42", "token-number");
  39. yield resumeDebuggerThenCloseAndFinish(panel);
  40. });
  41. }