browser_dbg_variables-view-popup-06.js 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. * complext object as the value.
  7. */
  8. const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
  9. function test() {
  10. requestLongerTimeout(2);
  11. Task.spawn(function* () {
  12. let options = {
  13. source: TAB_URL,
  14. line: 1
  15. };
  16. let [tab,, panel] = yield initDebugger(TAB_URL, options);
  17. let win = panel.panelWin;
  18. let bubble = win.DebuggerView.VariableBubble;
  19. let tooltip = bubble._tooltip.panel;
  20. function verifyContents() {
  21. is(tooltip.querySelectorAll(".variables-view-container").length, 1,
  22. "There should be one variables view container added to the tooltip.");
  23. is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1,
  24. "There should be one scope with no header displayed.");
  25. is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1,
  26. "There should be one variable with no header displayed.");
  27. is(tooltip.querySelectorAll(".variables-view-property").length, 7,
  28. "There should be 7 properties displayed.");
  29. is(tooltip.querySelectorAll(".variables-view-property .name")[0].getAttribute("value"), "a",
  30. "The first property's name is correct.");
  31. is(tooltip.querySelectorAll(".variables-view-property .value")[0].getAttribute("value"), "1",
  32. "The first property's value is correct.");
  33. is(tooltip.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"), "b",
  34. "The second property's name is correct.");
  35. is(tooltip.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"), "\"beta\"",
  36. "The second property's value is correct.");
  37. is(tooltip.querySelectorAll(".variables-view-property .name")[2].getAttribute("value"), "c",
  38. "The third property's name is correct.");
  39. is(tooltip.querySelectorAll(".variables-view-property .value")[2].getAttribute("value"), "3",
  40. "The third property's value is correct.");
  41. is(tooltip.querySelectorAll(".variables-view-property .name")[3].getAttribute("value"), "d",
  42. "The fourth property's name is correct.");
  43. is(tooltip.querySelectorAll(".variables-view-property .value")[3].getAttribute("value"), "false",
  44. "The fourth property's value is correct.");
  45. is(tooltip.querySelectorAll(".variables-view-property .name")[4].getAttribute("value"), "e",
  46. "The fifth property's name is correct.");
  47. is(tooltip.querySelectorAll(".variables-view-property .value")[4].getAttribute("value"), "null",
  48. "The fifth property's value is correct.");
  49. is(tooltip.querySelectorAll(".variables-view-property .name")[5].getAttribute("value"), "f",
  50. "The sixth property's name is correct.");
  51. is(tooltip.querySelectorAll(".variables-view-property .value")[5].getAttribute("value"), "undefined",
  52. "The sixth property's value is correct.");
  53. is(tooltip.querySelectorAll(".variables-view-property .name")[6].getAttribute("value"), "__proto__",
  54. "The seventh property's name is correct.");
  55. is(tooltip.querySelectorAll(".variables-view-property .value")[6].getAttribute("value"), "Object",
  56. "The seventh property's value is correct.");
  57. }
  58. let onCaretAndScopes = waitForCaretAndScopes(panel, 24);
  59. callInTab(tab, "start");
  60. yield onCaretAndScopes;
  61. // Inspect variable.
  62. yield openVarPopup(panel, { line: 17, ch: 12 }, true);
  63. verifyContents();
  64. yield resumeDebuggerThenCloseAndFinish(panel);
  65. });
  66. }