browser_canvas-frontend-slider-01.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Tests if the slider in the calls list view works as advertised.
  5. */
  6. function* ifTestingSupported() {
  7. let { target, panel } = yield initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
  8. let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
  9. yield reload(target);
  10. let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
  11. let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
  12. SnapshotsListView._onRecordButtonClick();
  13. yield promise.all([recordingFinished, callListPopulated]);
  14. is(CallsListView.selectedIndex, -1,
  15. "No item in the function calls list should be initially selected.");
  16. is($("#calls-slider").value, 0,
  17. "The slider should be moved all the way to the start.");
  18. is($("#calls-slider").min, 0,
  19. "The slider minimum value should be 0.");
  20. is($("#calls-slider").max, 7,
  21. "The slider maximum value should be 7.");
  22. CallsListView.selectedIndex = 1;
  23. is($("#calls-slider").value, 1,
  24. "The slider should be changed according to the current selection.");
  25. $("#calls-slider").value = 2;
  26. is(CallsListView.selectedIndex, 2,
  27. "The calls selection should be changed according to the current slider value.");
  28. yield teardown(panel);
  29. finish();
  30. }