summaryrefslogtreecommitdiffstats
path: root/devtools/client/storage/test/browser_storage_overflow.js
blob: 88181ca0558080592eb83dbcf506842cde029205 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Test endless scrolling when a lot of items are present in the storage
// inspector table.
"use strict";

add_task(function* () {
  yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-overflow.html");

  let $ = id => gPanelWindow.document.querySelector(id);
  let $$ = sel => gPanelWindow.document.querySelectorAll(sel);

  gUI.tree.expandAll();
  yield selectTreeItem(["localStorage", "http://test1.example.org"]);

  let table = $("#storage-table .table-widget-body");
  let cellHeight = $(".table-widget-cell").getBoundingClientRect().height;

  is($$("#value .table-widget-cell").length, 50,
     "Table should initially display 50 items");

  let onStoresUpdate = gUI.once("store-objects-updated");
  table.scrollTop += cellHeight * 50;
  yield onStoresUpdate;

  is($$("#value .table-widget-cell").length, 100,
     "Table should display 100 items after scrolling");

  onStoresUpdate = gUI.once("store-objects-updated");
  table.scrollTop += cellHeight * 50;
  yield onStoresUpdate;

  is($$("#value .table-widget-cell").length, 150,
     "Table should display 150 items after scrolling");

  onStoresUpdate = gUI.once("store-objects-updated");
  table.scrollTop += cellHeight * 50;
  yield onStoresUpdate;

  is($$("#value .table-widget-cell").length, 160,
     "Table should display all 160 items after scrolling");
  yield finishTests();
});