browser_cmd_paintflashing.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Any copyright is dedicated to the Public Domain.
  2. * http://creativecommons.org/publicdomain/zero/1.0/ */
  3. // Tests that the paintflashing command correctly sets its state.
  4. "use strict";
  5. const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
  6. "test/browser_cmd_cookie.html";
  7. function test() {
  8. return Task.spawn(testTask).then(finish, helpers.handleError);
  9. }
  10. var tests = {
  11. testInput: function (options) {
  12. let toggleCommand = options.requisition.system.commands.get("paintflashing toggle");
  13. let _tab = options.tab;
  14. let actions = [
  15. {
  16. command: "paintflashing on",
  17. isChecked: true,
  18. label: "checked after on"
  19. },
  20. {
  21. command: "paintflashing off",
  22. isChecked: false,
  23. label: "unchecked after off"
  24. },
  25. {
  26. command: "paintflashing toggle",
  27. isChecked: true,
  28. label: "checked after toggle"
  29. },
  30. {
  31. command: "paintflashing toggle",
  32. isChecked: false,
  33. label: "unchecked after toggle"
  34. }
  35. ];
  36. return helpers.audit(options, actions.map(spec => ({
  37. setup: spec.command,
  38. exec: {},
  39. post: () => is(toggleCommand.state.isChecked({_tab}), spec.isChecked, spec.label)
  40. })));
  41. },
  42. };
  43. function* testTask() {
  44. let options = yield helpers.openTab(TEST_URI);
  45. yield helpers.openToolbar(options);
  46. yield helpers.runTests(options, tests);
  47. yield helpers.closeToolbar(options);
  48. yield helpers.closeTab(options);
  49. }