browser_cmd_highlight_01.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* Any copyright is dedicated to the Public Domain.
  2. * http://creativecommons.org/publicdomain/zero/1.0/ */
  3. "use strict";
  4. /* eslint key-spacing: 0 */
  5. // Tests the various highlight command parameters and options
  6. // Creating a test page with many elements to test the --showall option
  7. var TEST_PAGE = "data:text/html;charset=utf-8,<body><ul>";
  8. for (let i = 0; i < 101; i++) {
  9. TEST_PAGE += "<li class='item'>" + i + "</li>";
  10. }
  11. TEST_PAGE += "</ul></body>";
  12. function test() {
  13. return Task.spawn(spawnTest).then(finish, helpers.handleError);
  14. }
  15. function* spawnTest() {
  16. let options = yield helpers.openTab(TEST_PAGE);
  17. yield helpers.openToolbar(options);
  18. yield helpers.audit(options, [
  19. {
  20. setup: "highlight",
  21. check: {
  22. input: "highlight",
  23. hints: " [selector] [options]",
  24. markup: "VVVVVVVVV",
  25. status: "VALID"
  26. },
  27. exec: {
  28. output: "0 nodes highlighted"
  29. }
  30. },
  31. {
  32. setup: "highlight bo",
  33. check: {
  34. input: "highlight bo",
  35. hints: " [options]",
  36. markup: "VVVVVVVVVVII",
  37. status: "ERROR"
  38. },
  39. exec: {
  40. output: "Error: No matches"
  41. }
  42. },
  43. {
  44. setup: "highlight body",
  45. check: {
  46. input: "highlight body",
  47. hints: " [options]",
  48. markup: "VVVVVVVVVVVVVV",
  49. status: "VALID"
  50. },
  51. exec: {
  52. output: "1 node highlighted"
  53. }
  54. },
  55. {
  56. setup: "highlight body --hideguides",
  57. check: {
  58. input: "highlight body --hideguides",
  59. hints: " [options]",
  60. markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVV",
  61. status: "VALID"
  62. },
  63. exec: {
  64. output: "1 node highlighted"
  65. }
  66. },
  67. {
  68. setup: "highlight body --showinfobar",
  69. check: {
  70. input: "highlight body --showinfobar",
  71. hints: " [options]",
  72. markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVV",
  73. status: "VALID"
  74. },
  75. exec: {
  76. output: "1 node highlighted"
  77. }
  78. }
  79. ]);
  80. yield helpers.closeToolbar(options);
  81. yield helpers.closeTab(options);
  82. }