nonstandard.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. var _helpers = require("./util/helpers");
  3. (0, _helpers.test)('non-standard selector', '.icon.is-$(network)', function (t, tree) {
  4. var class1 = tree.nodes[0].nodes[0];
  5. t.deepEqual(class1.value, 'icon');
  6. t.deepEqual(class1.type, 'class');
  7. var class2 = tree.nodes[0].nodes[1];
  8. t.deepEqual(class2.value, 'is-$(network)');
  9. t.deepEqual(class2.type, 'class');
  10. });
  11. (0, _helpers.test)('at word in selector', 'em@il.com', function (t, tree) {
  12. t.deepEqual(tree.nodes[0].nodes[0].value, 'em@il');
  13. t.deepEqual(tree.nodes[0].nodes[1].value, 'com');
  14. });
  15. (0, _helpers.test)('leading combinator', '> *', function (t, tree) {
  16. t.deepEqual(tree.nodes[0].nodes[0].value, '>');
  17. t.deepEqual(tree.nodes[0].nodes[1].value, '*');
  18. });
  19. (0, _helpers.test)('sass escapes', '.#{$classname}', function (t, tree) {
  20. t.deepEqual(tree.nodes[0].nodes[0].type, "class");
  21. t.deepEqual(tree.nodes[0].nodes[0].value, "#{$classname}");
  22. });
  23. (0, _helpers.test)('sass escapes (2)', '[lang=#{$locale}]', function (t, tree) {
  24. t.deepEqual(tree.nodes[0].nodes[0].type, "attribute");
  25. t.deepEqual(tree.nodes[0].nodes[0].attribute, "lang");
  26. t.deepEqual(tree.nodes[0].nodes[0].operator, "=");
  27. t.deepEqual(tree.nodes[0].nodes[0].value, "#{$locale}");
  28. });
  29. (0, _helpers.test)('placeholder', '%foo', function (t, tree) {
  30. t.deepEqual(tree.nodes[0].nodes[0].type, "tag");
  31. t.deepEqual(tree.nodes[0].nodes[0].value, "%foo");
  32. });
  33. (0, _helpers.test)('styled selector', '${Step}', function (t, tree) {
  34. t.deepEqual(tree.nodes[0].nodes[0].type, "tag");
  35. t.deepEqual(tree.nodes[0].nodes[0].value, "${Step}");
  36. });
  37. (0, _helpers.test)('styled selector (2)', '${Step}:nth-child(odd)', function (t, tree) {
  38. t.deepEqual(tree.nodes[0].nodes[0].type, "tag");
  39. t.deepEqual(tree.nodes[0].nodes[0].value, "${Step}");
  40. t.deepEqual(tree.nodes[0].nodes[1].type, "pseudo");
  41. t.deepEqual(tree.nodes[0].nodes[1].value, ":nth-child");
  42. t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].type, "tag");
  43. t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, "odd");
  44. });