universal.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. var _helpers = require("./util/helpers");
  3. (0, _helpers.test)('universal selector', '*', function (t, tree) {
  4. t.deepEqual(tree.nodes[0].nodes[0].value, '*');
  5. t.deepEqual(tree.nodes[0].nodes[0].type, 'universal');
  6. });
  7. (0, _helpers.test)('lobotomized owl', '* + *', function (t, tree) {
  8. t.deepEqual(tree.nodes[0].nodes[0].type, 'universal');
  9. t.deepEqual(tree.nodes[0].nodes[1].type, 'combinator');
  10. t.deepEqual(tree.nodes[0].nodes[2].type, 'universal');
  11. });
  12. (0, _helpers.test)('universal selector with descendant combinator', '* *', function (t, tree) {
  13. t.deepEqual(tree.nodes[0].nodes[0].type, 'universal');
  14. t.deepEqual(tree.nodes[0].nodes[1].type, 'combinator');
  15. t.deepEqual(tree.nodes[0].nodes[2].type, 'universal');
  16. });
  17. (0, _helpers.test)('universal selector with descendant combinator and extraneous non-combinating whitespace', '* *', function (t, tree) {
  18. t.deepEqual(tree.nodes[0].nodes[0].type, 'universal');
  19. t.deepEqual(tree.nodes[0].nodes[1].type, 'combinator');
  20. t.deepEqual(tree.nodes[0].nodes[2].type, 'universal');
  21. });
  22. (0, _helpers.test)('extraneous non-combinating whitespace', ' * , * ', function (t, tree) {
  23. t.deepEqual(tree.nodes[0].nodes[0].value, '*');
  24. t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' ');
  25. t.deepEqual(tree.nodes[0].nodes[0].spaces.after, ' ');
  26. t.deepEqual(tree.nodes[1].nodes[0].value, '*');
  27. t.deepEqual(tree.nodes[1].nodes[0].spaces.before, ' ');
  28. t.deepEqual(tree.nodes[1].nodes[0].spaces.after, ' ');
  29. });
  30. (0, _helpers.test)('qualified universal selector', '*[href] *:not(*.green)', function (t, tree) {
  31. t.deepEqual(tree.nodes[0].nodes[0].value, '*');
  32. t.deepEqual(tree.nodes[0].nodes[3].value, '*');
  33. t.deepEqual(tree.nodes[0].nodes[4].nodes[0].nodes[0].value, '*');
  34. });
  35. (0, _helpers.test)('universal selector with pseudo', '*::--webkit-media-controls-play-button', function (t, tree) {
  36. t.deepEqual(tree.nodes[0].nodes[0].value, '*');
  37. t.deepEqual(tree.nodes[0].nodes[0].type, 'universal');
  38. t.deepEqual(tree.nodes[0].nodes[1].value, '::--webkit-media-controls-play-button');
  39. t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo');
  40. });