browser_cmd_highlight_04.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 body --showall",
  21. check: {
  22. input: "highlight body --showall",
  23. hints: " [options]",
  24. markup: "VVVVVVVVVVVVVVVVVVVVVVVV",
  25. status: "VALID"
  26. },
  27. exec: {
  28. output: "1 node highlighted"
  29. }
  30. },
  31. {
  32. setup: "highlight body --keep",
  33. check: {
  34. input: "highlight body --keep",
  35. hints: " [options]",
  36. markup: "VVVVVVVVVVVVVVVVVVVVV",
  37. status: "VALID"
  38. },
  39. exec: {
  40. output: "1 node highlighted"
  41. }
  42. },
  43. {
  44. setup: "highlight body --hideguides --showinfobar --showall --region " +
  45. "content --fill red --keep",
  46. check: {
  47. input: "highlight body --hideguides --showinfobar --showall --region " +
  48. "content --fill red --keep",
  49. hints: "",
  50. markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV" +
  51. "VVVVVVVVVVVVVVVVVVVVVVVVV",
  52. status: "VALID"
  53. },
  54. exec: {
  55. output: "1 node highlighted"
  56. }
  57. },
  58. {
  59. setup: "highlight .item",
  60. check: {
  61. input: "highlight .item",
  62. hints: " [options]",
  63. markup: "VVVVVVVVVVVVVVV",
  64. status: "VALID"
  65. },
  66. exec: {
  67. output: "101 nodes matched, but only 100 nodes highlighted. Use " +
  68. "\u2018--showall\u2019 to show all"
  69. }
  70. },
  71. {
  72. setup: "highlight .item --showall",
  73. check: {
  74. input: "highlight .item --showall",
  75. hints: " [options]",
  76. markup: "VVVVVVVVVVVVVVVVVVVVVVVVV",
  77. status: "VALID"
  78. },
  79. exec: {
  80. output: "101 nodes highlighted"
  81. }
  82. }
  83. ]);
  84. yield helpers.closeToolbar(options);
  85. yield helpers.closeTab(options);
  86. }