browser_dom_array.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. "use strict";
  5. const TEST_PAGE_URL = URL_ROOT + "page_array.html";
  6. const TEST_ARRAY = [
  7. "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
  8. "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
  9. ];
  10. /**
  11. * Basic test that checks content of the DOM panel.
  12. */
  13. add_task(function* () {
  14. info("Test DOM Panel Array Expansion started");
  15. let { panel } = yield addTestTab(TEST_PAGE_URL);
  16. // Expand specified row and wait till children are displayed.
  17. yield expandRow(panel, "_a");
  18. // Verify that children is displayed now.
  19. let childRows = getAllRowsForLabel(panel, "_a");
  20. let item = childRows.pop();
  21. is(item.name, "length", "length property is correct");
  22. is(item.value, 26, "length property value is 26");
  23. let i = 0;
  24. for (let name in childRows) {
  25. let row = childRows[name];
  26. is(name, i++, `index ${name} is correct and sorted into the correct position`);
  27. ok(typeof row.name === "number", "array index is displayed as a number");
  28. is(TEST_ARRAY[name], row.value, `value for array[${name}] is ${row.value}`);
  29. }
  30. });