browser_jsonview_valid_json.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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_JSON_URL = URL_ROOT + "valid_json.json";
  6. add_task(function* () {
  7. info("Test valid JSON started");
  8. let tab = yield addJsonViewTab(TEST_JSON_URL);
  9. ok(tab.linkedBrowser.contentPrincipal.isNullPrincipal, "Should have null principal");
  10. let countBefore = yield getElementCount(".jsonPanelBox .treeTable .treeRow");
  11. ok(countBefore == 3, "There must be three rows");
  12. let objectCellCount = yield getElementCount(
  13. ".jsonPanelBox .treeTable .objectCell");
  14. ok(objectCellCount == 1, "There must be one object cell");
  15. let objectCellText = yield getElementText(
  16. ".jsonPanelBox .treeTable .objectCell");
  17. ok(objectCellText == "", "The summary is hidden when object is expanded");
  18. // Collapsed auto-expanded node.
  19. yield clickJsonNode(".jsonPanelBox .treeTable .treeLabel");
  20. let countAfter = yield getElementCount(".jsonPanelBox .treeTable .treeRow");
  21. ok(countAfter == 1, "There must be one row");
  22. });