123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- "use strict";
- var _helpers = require("./util/helpers");
- (0, _helpers.test)('id selector', '#one', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'one');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- });
- (0, _helpers.test)('id selector with universal', '*#z98y ', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '*');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'universal');
- t.deepEqual(tree.nodes[0].nodes[1].value, 'z98y');
- t.deepEqual(tree.nodes[0].nodes[1].type, 'id');
- });
- (0, _helpers.test)('id hack', '#one#two', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[1].type, 'id');
- });
- (0, _helpers.test)('id and class names mixed', '#one.two.three', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'one');
- t.deepEqual(tree.nodes[0].nodes[1].value, 'two');
- t.deepEqual(tree.nodes[0].nodes[2].value, 'three');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[1].type, 'class');
- t.deepEqual(tree.nodes[0].nodes[2].type, 'class');
- });
- (0, _helpers.test)('qualified id', 'button#one', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');
- t.deepEqual(tree.nodes[0].nodes[1].type, 'id');
- });
- (0, _helpers.test)('qualified id & class name', 'h1#one.two', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');
- t.deepEqual(tree.nodes[0].nodes[1].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[2].type, 'class');
- });
- (0, _helpers.test)('extraneous non-combinating whitespace', ' #h1 , #h2 ', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'h1');
- t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' ');
- t.deepEqual(tree.nodes[0].nodes[0].spaces.after, ' ');
- t.deepEqual(tree.nodes[1].nodes[0].value, 'h2');
- t.deepEqual(tree.nodes[1].nodes[0].spaces.before, ' ');
- t.deepEqual(tree.nodes[1].nodes[0].spaces.after, ' ');
- });
- (0, _helpers.test)('Sass interpolation within a class', '.#{foo}', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes.length, 1);
- t.deepEqual(tree.nodes[0].nodes[0].type, 'class');
- t.deepEqual(tree.nodes[0].nodes[0].value, '#{foo}');
- });
- (0, _helpers.test)('Sass interpolation within an id', '#foo#{bar}', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes.length, 1);
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].value, 'foo#{bar}');
- });
- (0, _helpers.test)('Less interpolation within an id', '#foo@{bar}', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes.length, 1);
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].value, 'foo@{bar}');
- });
- (0, _helpers.test)('id selector with escaping', '#\\#test', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '#test');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#test');
- });
- (0, _helpers.test)('id selector with escaping (2)', '#-a-b-c-', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '-a-b-c-');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- });
- (0, _helpers.test)('id selector with escaping (3)', '#u-m\\00002b', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'u-m+');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'u-m\\00002b');
- });
- (0, _helpers.test)('id selector with escaping (4)', '#♥', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '♥');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- });
- (0, _helpers.test)('id selector with escaping (5)', '#©', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '©');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- });
- (0, _helpers.test)('id selector with escaping (6)', '#“‘’”', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '“‘’”');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- });
- (0, _helpers.test)('id selector with escaping (7)', '#☺☃', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '☺☃');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- });
- (0, _helpers.test)('id selector with escaping (8)', '#⌘⌥', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '⌘⌥');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- });
- (0, _helpers.test)('id selector with escaping (9)', '#𝄞♪♩♫♬', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '𝄞♪♩♫♬');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- });
- (0, _helpers.test)('id selector with escaping (10)', '#💩', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '💩');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- });
- (0, _helpers.test)('id selector with escaping (11)', '#\\?', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '?');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\?');
- });
- (0, _helpers.test)('id selector with escaping (12)', '#\\@', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '@');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\@');
- });
- (0, _helpers.test)('id selector with escaping (13)', '#\\.', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '.');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\.');
- });
- (0, _helpers.test)('id selector with escaping (14)', '#\\3A \\)', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, ':)');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A \\)');
- });
- (0, _helpers.test)('id selector with escaping (15)', '#\\3A \\`\\(', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, ':`(');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A \\`\\(');
- });
- (0, _helpers.test)('id selector with escaping (16)', '#\\31 23', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '123');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\31 23');
- });
- (0, _helpers.test)('id selector with escaping (17)', '#\\31 a2b3c', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '1a2b3c');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\31 a2b3c');
- });
- (0, _helpers.test)('id selector with escaping (18)', '#\\<p\\>', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '<p>');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\<p\\>');
- });
- (0, _helpers.test)('id selector with escaping (19)', '#\\<\\>\\<\\<\\<\\>\\>\\<\\>', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '<><<<>><>');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\<\\>\\<\\<\\<\\>\\>\\<\\>');
- });
- (0, _helpers.test)('id selector with escaping (20)', '#\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<\\-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.\\-\\-\\-\\-\\-\\-\\.\\-\\-\\-\\-\\-\\-\\-\\-\\.\\>\\+\\.\\>\\.', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<\\-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.\\-\\-\\-\\-\\-\\-\\.\\-\\-\\-\\-\\-\\-\\-\\-\\.\\>\\+\\.\\>\\.');
- });
- (0, _helpers.test)('id selector with escaping (21)', '#\\#', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '#');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#');
- });
- (0, _helpers.test)('id selector with escaping (22)', '#\\#\\#', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '##');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#\\#');
- });
- (0, _helpers.test)('id selector with escaping (23)', '#\\#\\.\\#\\.\\#', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '#.#.#');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#\\.\\#\\.\\#');
- });
- (0, _helpers.test)('id selector with escaping (24)', '#\\_', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '_');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\_');
- });
- (0, _helpers.test)('id selector with escaping (25)', '#\\{\\}', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '{}');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\{\\}');
- });
- (0, _helpers.test)('id selector with escaping (26)', '#\\.fake\\-class', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '.fake-class');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\.fake\\-class');
- });
- (0, _helpers.test)('id selector with escaping (27)', '#foo\\.bar', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'foo.bar');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'foo\\.bar');
- });
- (0, _helpers.test)('id selector with escaping (28)', '#\\3A hover', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, ':hover');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A hover');
- });
- (0, _helpers.test)('id selector with escaping (29)', '#\\3A hover\\3A focus\\3A active', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, ':hover:focus:active');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A hover\\3A focus\\3A active');
- });
- (0, _helpers.test)('id selector with escaping (30)', '#\\[attr\\=value\\]', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, '[attr=value]');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\[attr\\=value\\]');
- });
- (0, _helpers.test)('id selector with escaping (31)', '#f\\/o\\/o', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'f/o/o');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\/o\\/o');
- });
- (0, _helpers.test)('id selector with escaping (32)', '#f\\\\o\\\\o', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'f\\o\\o');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\\\o\\\\o');
- });
- (0, _helpers.test)('id selector with escaping (33)', '#f\\*o\\*o', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'f*o*o');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\*o\\*o');
- });
- (0, _helpers.test)('id selector with escaping (34)', '#f\\!o\\!o', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'f!o!o');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\!o\\!o');
- });
- (0, _helpers.test)('id selector with escaping (35)', '#f\\\'o\\\'o', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'f\'o\'o');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\\'o\\\'o');
- });
- (0, _helpers.test)('id selector with escaping (36)', '#f\\~o\\~o', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'f~o~o');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\~o\\~o');
- });
- (0, _helpers.test)('id selector with escaping (37)', '#f\\+o\\+o', function (t, tree) {
- t.deepEqual(tree.nodes[0].nodes[0].value, 'f+o+o');
- t.deepEqual(tree.nodes[0].nodes[0].type, 'id');
- t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\+o\\+o');
- });
|