Best JavaScript code snippet using tracetest
sourceIndex.js
Source:sourceIndex.js
1"use strict";2var _helpers = require("./util/helpers");3(0, _helpers.test)('universal selector', '*', function (t, tree) {4 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1);5 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 1);6 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0);7});8(0, _helpers.test)('lobotomized owl selector', ' * + * ', function (t, tree) {9 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 2);10 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 2);11 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 1);12 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 4);13 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 4);14 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 3);15 t.deepEqual(tree.nodes[0].nodes[2].source.start.column, 6);16 t.deepEqual(tree.nodes[0].nodes[2].source.end.column, 6);17 t.deepEqual(tree.nodes[0].nodes[2].sourceIndex, 5);18});19(0, _helpers.test)('comment', '/**\n * Hello!\n */', function (t, tree) {20 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1);21 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 3);22 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0);23});24(0, _helpers.test)('comment & universal selectors', '*/*test*/*', function (t, tree) {25 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1);26 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 1);27 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0);28 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 2);29 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 9);30 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 1);31 t.deepEqual(tree.nodes[0].nodes[2].source.start.column, 10);32 t.deepEqual(tree.nodes[0].nodes[2].source.end.column, 10);33 t.deepEqual(tree.nodes[0].nodes[2].sourceIndex, 9);34});35(0, _helpers.test)('tag selector', 'h1', function (t, tree) {36 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1);37 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 2);38 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0);39});40(0, _helpers.test)('id selector', '#id', function (t, tree) {41 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1);42 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 3);43 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0);44});45(0, _helpers.test)('tag selector followed by id selector', 'h1, #id', function (t, tree) {46 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1);47 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 2);48 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0);49 t.deepEqual(tree.nodes[1].nodes[0].source.start.column, 5);50 t.deepEqual(tree.nodes[1].nodes[0].source.end.column, 7);51 t.deepEqual(tree.nodes[1].nodes[0].sourceIndex, 4);52});53(0, _helpers.test)('multiple id selectors', '#one#two', function (t, tree) {54 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1);55 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 4);56 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0);57 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 5);58 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 8);59 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 4);60});61(0, _helpers.test)('multiple id selectors (2)', '#one#two#three#four', function (t, tree) {62 t.deepEqual(tree.nodes[0].nodes[2].source.start.column, 9);63 t.deepEqual(tree.nodes[0].nodes[2].source.end.column, 14);64 t.deepEqual(tree.nodes[0].nodes[2].sourceIndex, 8);65 t.deepEqual(tree.nodes[0].nodes[3].source.start.column, 15);66 t.deepEqual(tree.nodes[0].nodes[3].source.end.column, 19);67 t.deepEqual(tree.nodes[0].nodes[3].sourceIndex, 14);68});69(0, _helpers.test)('multiple id selectors (3)', '#one#two,#three#four', function (t, tree) {70 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 5);71 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 8);72 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 4);73 t.deepEqual(tree.nodes[1].nodes[1].source.start.column, 16);74 t.deepEqual(tree.nodes[1].nodes[1].source.end.column, 20);75 t.deepEqual(tree.nodes[1].nodes[1].sourceIndex, 15);76});77(0, _helpers.test)('multiple class selectors', '.one.two,.three.four', function (t, tree) {78 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 5);79 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 8);80 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 4);81 t.deepEqual(tree.nodes[1].nodes[1].source.start.column, 16);82 t.deepEqual(tree.nodes[1].nodes[1].source.end.column, 20);83 t.deepEqual(tree.nodes[1].nodes[1].sourceIndex, 15);84});85(0, _helpers.test)('attribute selector', '[name="james"]', function (t, tree) {86 t.deepEqual(tree.nodes[0].nodes[0].source.start.line, 1);87 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1);88 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 14);89 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0);90});91(0, _helpers.test)('multiple attribute selectors', '[name="james"][name="ed"],[name="snakeman"][name="a"]', function (t, tree) {92 t.deepEqual(tree.nodes[0].nodes[0].source.start.line, 1);93 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1);94 t.deepEqual(tree.nodes[0].nodes[0].source.end.line, 1);95 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 14);96 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0);97 t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1);98 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 15);99 t.deepEqual(tree.nodes[0].nodes[1].source.end.line, 1);100 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 25);101 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 14);102 t.deepEqual(tree.nodes[1].nodes[0].source.start.line, 1);103 t.deepEqual(tree.nodes[1].nodes[0].source.start.column, 27);104 t.deepEqual(tree.nodes[1].nodes[0].source.end.line, 1);105 t.deepEqual(tree.nodes[1].nodes[0].source.end.column, 43);106 t.deepEqual(tree.nodes[1].nodes[0].sourceIndex, 26);107 t.deepEqual(tree.nodes[1].nodes[1].source.start.line, 1);108 t.deepEqual(tree.nodes[1].nodes[1].source.start.column, 44);109 t.deepEqual(tree.nodes[1].nodes[1].source.end.line, 1);110 t.deepEqual(tree.nodes[1].nodes[1].source.end.column, 53);111 t.deepEqual(tree.nodes[1].nodes[1].sourceIndex, 43);112});113(0, _helpers.test)('pseudo-class', 'h1:first-child', function (t, tree) {114 t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1);115 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 3);116 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 14);117 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 2);118});119(0, _helpers.test)('pseudo-class with argument', 'h1:not(.strudel, .food)', function (t, tree) {120 t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1);121 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 3);122 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 23);123 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 2);124});125(0, _helpers.test)('pseudo-element', 'h1::before', function (t, tree) {126 t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1);127 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 3);128 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 10);129 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 2);130});131(0, _helpers.test)('multiple pseudos', 'h1:not(.food)::before, a:first-child', function (t, tree) {132 t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1);133 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 3);134 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 13);135 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 2);136 t.deepEqual(tree.nodes[0].nodes[2].source.start.line, 1);137 t.deepEqual(tree.nodes[0].nodes[2].source.start.column, 14);138 t.deepEqual(tree.nodes[0].nodes[2].source.end.column, 21);139 t.deepEqual(tree.nodes[0].nodes[2].sourceIndex, 13);140 t.deepEqual(tree.nodes[1].nodes[1].source.start.line, 1);141 t.deepEqual(tree.nodes[1].nodes[1].source.start.column, 25);142 t.deepEqual(tree.nodes[1].nodes[1].source.end.column, 36);143 t.deepEqual(tree.nodes[1].nodes[1].sourceIndex, 24);144});145(0, _helpers.test)('combinators', 'div > h1 span', function (t, tree) {146 t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1, "> start line");147 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 5, "> start column");148 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 5, "> end column");149 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 4, "> sourceIndex");150 t.deepEqual(tree.nodes[0].nodes[3].source.start.line, 1, "' ' start line");151 t.deepEqual(tree.nodes[0].nodes[3].source.start.column, 9, "' ' start column");152 t.deepEqual(tree.nodes[0].nodes[3].source.end.column, 9, "' ' end column");153 t.deepEqual(tree.nodes[0].nodes[3].sourceIndex, 8, "' ' sourceIndex");154});155(0, _helpers.test)('combinators surrounded by superfluous spaces', 'div > h1 ~ span a', function (t, tree) {156 t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1, "> start line");157 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 7, "> start column");158 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 7, "> end column");159 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 6, "> sourceIndex");160 t.deepEqual(tree.nodes[0].nodes[3].source.start.line, 1, "~ start line");161 t.deepEqual(tree.nodes[0].nodes[3].source.start.column, 13, "~ start column");162 t.deepEqual(tree.nodes[0].nodes[3].source.end.column, 13, "~ end column");163 t.deepEqual(tree.nodes[0].nodes[3].sourceIndex, 12, "~ sourceIndex");164 t.deepEqual(tree.nodes[0].nodes[5].source.start.line, 1, "' ' start line");165 t.deepEqual(tree.nodes[0].nodes[5].source.start.column, 21, "' ' start column");166 t.deepEqual(tree.nodes[0].nodes[5].source.end.column, 23, "' ' end column");167 t.deepEqual(tree.nodes[0].nodes[5].sourceIndex, 20, "' ' sourceIndex");168});169(0, _helpers.test)('multiple id selectors on different lines', '#one,\n#two', function (t, tree) {170 t.deepEqual(tree.nodes[0].nodes[0].source.start.line, 1);171 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1);172 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 4);173 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0);174 t.deepEqual(tree.nodes[1].nodes[0].source.start.line, 2);175 t.deepEqual(tree.nodes[1].nodes[0].source.start.column, 1);176 t.deepEqual(tree.nodes[1].nodes[0].source.end.column, 4);177 t.deepEqual(tree.nodes[1].nodes[0].sourceIndex, 6);178});179(0, _helpers.test)('multiple id selectors on different CRLF lines', '#one,\r\n#two,\r\n#three', function (t, tree) {180 t.deepEqual(tree.nodes[0].nodes[0].source.start.line, 1, '#one start line');181 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1, '#one start column');182 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 4, '#one end column');183 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0, '#one sourceIndex');184 t.deepEqual(tree.nodes[1].nodes[0].source.start.line, 2, '#two start line');185 t.deepEqual(tree.nodes[1].nodes[0].source.start.column, 1, '#two start column');186 t.deepEqual(tree.nodes[1].nodes[0].source.end.column, 4, '#two end column');187 t.deepEqual(tree.nodes[1].nodes[0].sourceIndex, 7, '#two sourceIndex');188 t.deepEqual(tree.nodes[2].nodes[0].source.start.line, 3, '#three start line');189 t.deepEqual(tree.nodes[2].nodes[0].source.start.column, 1, '#three start column');190 t.deepEqual(tree.nodes[2].nodes[0].source.end.column, 6, '#three end column');191 t.deepEqual(tree.nodes[2].nodes[0].sourceIndex, 14, '#three sourceIndex');192});193(0, _helpers.test)('id, tag, pseudo, and class selectors on different lines with indentation', '\t#one,\n\th1:after,\n\t\t.two', function (t, tree) {194 t.deepEqual(tree.nodes[0].nodes[0].source.start.line, 1, '#one start line');195 t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 2, '#one start column');196 t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 5, '#one end column');197 t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 1, '#one sourceIndex');198 t.deepEqual(tree.nodes[1].nodes[0].source.start.line, 2, 'h1 start line');199 t.deepEqual(tree.nodes[1].nodes[0].source.start.column, 2, 'h1 start column');200 t.deepEqual(tree.nodes[1].nodes[0].source.end.column, 3, 'h1 end column');201 t.deepEqual(tree.nodes[1].nodes[0].sourceIndex, 8, 'h1 sourceIndex');202 t.deepEqual(tree.nodes[1].nodes[1].source.start.line, 2, ':after start line');203 t.deepEqual(tree.nodes[1].nodes[1].source.start.column, 4, ':after start column');204 t.deepEqual(tree.nodes[1].nodes[1].source.end.column, 9, ':after end column');205 t.deepEqual(tree.nodes[1].nodes[1].sourceIndex, 10, ':after sourceIndex');206 t.deepEqual(tree.nodes[2].nodes[0].source.start.line, 3, '.two start line');207 t.deepEqual(tree.nodes[2].nodes[0].source.start.column, 3, '.two start column');208 t.deepEqual(tree.nodes[2].nodes[0].source.end.column, 6, '.two end column');209 t.deepEqual(tree.nodes[2].nodes[0].sourceIndex, 20, '.two sourceIndex');210});211(0, _helpers.test)('pseudo with arguments spanning multiple lines', 'h1:not(\n\t.one,\n\t.two\n)', function (t, tree) {212 t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1, ':not start line');213 t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 3, ':not start column');214 t.deepEqual(tree.nodes[0].nodes[1].source.end.line, 4, ':not end line');215 t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 1, ':not end column');216 t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 2, ':not sourceIndex');217 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].source.start.line, 2, '.one start line');218 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].source.start.column, 2, '.one start column');219 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].source.end.line, 2, '.one end line');220 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].source.end.column, 5, '.one end column');221 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].sourceIndex, 9, '.one sourceIndex');222 t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].source.start.line, 3, '.two start line');223 t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].source.start.column, 2, '.two start column');224 t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].source.end.line, 3, '.two end line');225 t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].source.end.column, 5, '.two end column');226 t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].sourceIndex, 16, '.two sourceIndex');...
id.js
Source:id.js
1"use strict";2var _helpers = require("./util/helpers");3(0, _helpers.test)('id selector', '#one', function (t, tree) {4 t.deepEqual(tree.nodes[0].nodes[0].value, 'one');5 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');6});7(0, _helpers.test)('id selector with universal', '*#z98y ', function (t, tree) {8 t.deepEqual(tree.nodes[0].nodes[0].value, '*');9 t.deepEqual(tree.nodes[0].nodes[0].type, 'universal');10 t.deepEqual(tree.nodes[0].nodes[1].value, 'z98y');11 t.deepEqual(tree.nodes[0].nodes[1].type, 'id');12});13(0, _helpers.test)('id hack', '#one#two', function (t, tree) {14 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');15 t.deepEqual(tree.nodes[0].nodes[1].type, 'id');16});17(0, _helpers.test)('id and class names mixed', '#one.two.three', function (t, tree) {18 t.deepEqual(tree.nodes[0].nodes[0].value, 'one');19 t.deepEqual(tree.nodes[0].nodes[1].value, 'two');20 t.deepEqual(tree.nodes[0].nodes[2].value, 'three');21 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');22 t.deepEqual(tree.nodes[0].nodes[1].type, 'class');23 t.deepEqual(tree.nodes[0].nodes[2].type, 'class');24});25(0, _helpers.test)('qualified id', 'button#one', function (t, tree) {26 t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');27 t.deepEqual(tree.nodes[0].nodes[1].type, 'id');28});29(0, _helpers.test)('qualified id & class name', 'h1#one.two', function (t, tree) {30 t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');31 t.deepEqual(tree.nodes[0].nodes[1].type, 'id');32 t.deepEqual(tree.nodes[0].nodes[2].type, 'class');33});34(0, _helpers.test)('extraneous non-combinating whitespace', ' #h1 , #h2 ', function (t, tree) {35 t.deepEqual(tree.nodes[0].nodes[0].value, 'h1');36 t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' ');37 t.deepEqual(tree.nodes[0].nodes[0].spaces.after, ' ');38 t.deepEqual(tree.nodes[1].nodes[0].value, 'h2');39 t.deepEqual(tree.nodes[1].nodes[0].spaces.before, ' ');40 t.deepEqual(tree.nodes[1].nodes[0].spaces.after, ' ');41});42(0, _helpers.test)('Sass interpolation within a class', '.#{foo}', function (t, tree) {43 t.deepEqual(tree.nodes[0].nodes.length, 1);44 t.deepEqual(tree.nodes[0].nodes[0].type, 'class');45 t.deepEqual(tree.nodes[0].nodes[0].value, '#{foo}');46});47(0, _helpers.test)('Sass interpolation within an id', '#foo#{bar}', function (t, tree) {48 t.deepEqual(tree.nodes[0].nodes.length, 1);49 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');50 t.deepEqual(tree.nodes[0].nodes[0].value, 'foo#{bar}');51});52(0, _helpers.test)('Less interpolation within an id', '#foo@{bar}', function (t, tree) {53 t.deepEqual(tree.nodes[0].nodes.length, 1);54 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');55 t.deepEqual(tree.nodes[0].nodes[0].value, 'foo@{bar}');56});57(0, _helpers.test)('id selector with escaping', '#\\#test', function (t, tree) {58 t.deepEqual(tree.nodes[0].nodes[0].value, '#test');59 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');60 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#test');61});62(0, _helpers.test)('id selector with escaping (2)', '#-a-b-c-', function (t, tree) {63 t.deepEqual(tree.nodes[0].nodes[0].value, '-a-b-c-');64 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');65});66(0, _helpers.test)('id selector with escaping (3)', '#u-m\\00002b', function (t, tree) {67 t.deepEqual(tree.nodes[0].nodes[0].value, 'u-m+');68 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');69 t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'u-m\\00002b');70});71(0, _helpers.test)('id selector with escaping (4)', '#â¥', function (t, tree) {72 t.deepEqual(tree.nodes[0].nodes[0].value, 'â¥');73 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');74});75(0, _helpers.test)('id selector with escaping (5)', '#©', function (t, tree) {76 t.deepEqual(tree.nodes[0].nodes[0].value, '©');77 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');78});79(0, _helpers.test)('id selector with escaping (6)', '#ââââ', function (t, tree) {80 t.deepEqual(tree.nodes[0].nodes[0].value, 'ââââ');81 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');82});83(0, _helpers.test)('id selector with escaping (7)', '#âºâ', function (t, tree) {84 t.deepEqual(tree.nodes[0].nodes[0].value, 'âºâ');85 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');86});87(0, _helpers.test)('id selector with escaping (8)', '#ââ¥', function (t, tree) {88 t.deepEqual(tree.nodes[0].nodes[0].value, 'ââ¥');89 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');90});91(0, _helpers.test)('id selector with escaping (9)', '#ðâªâ©â«â¬', function (t, tree) {92 t.deepEqual(tree.nodes[0].nodes[0].value, 'ðâªâ©â«â¬');93 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');94});95(0, _helpers.test)('id selector with escaping (10)', '#ð©', function (t, tree) {96 t.deepEqual(tree.nodes[0].nodes[0].value, 'ð©');97 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');98});99(0, _helpers.test)('id selector with escaping (11)', '#\\?', function (t, tree) {100 t.deepEqual(tree.nodes[0].nodes[0].value, '?');101 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');102 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\?');103});104(0, _helpers.test)('id selector with escaping (12)', '#\\@', function (t, tree) {105 t.deepEqual(tree.nodes[0].nodes[0].value, '@');106 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');107 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\@');108});109(0, _helpers.test)('id selector with escaping (13)', '#\\.', function (t, tree) {110 t.deepEqual(tree.nodes[0].nodes[0].value, '.');111 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');112 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\.');113});114(0, _helpers.test)('id selector with escaping (14)', '#\\3A \\)', function (t, tree) {115 t.deepEqual(tree.nodes[0].nodes[0].value, ':)');116 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');117 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A \\)');118});119(0, _helpers.test)('id selector with escaping (15)', '#\\3A \\`\\(', function (t, tree) {120 t.deepEqual(tree.nodes[0].nodes[0].value, ':`(');121 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');122 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A \\`\\(');123});124(0, _helpers.test)('id selector with escaping (16)', '#\\31 23', function (t, tree) {125 t.deepEqual(tree.nodes[0].nodes[0].value, '123');126 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');127 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\31 23');128});129(0, _helpers.test)('id selector with escaping (17)', '#\\31 a2b3c', function (t, tree) {130 t.deepEqual(tree.nodes[0].nodes[0].value, '1a2b3c');131 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');132 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\31 a2b3c');133});134(0, _helpers.test)('id selector with escaping (18)', '#\\<p\\>', function (t, tree) {135 t.deepEqual(tree.nodes[0].nodes[0].value, '<p>');136 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');137 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\<p\\>');138});139(0, _helpers.test)('id selector with escaping (19)', '#\\<\\>\\<\\<\\<\\>\\>\\<\\>', function (t, tree) {140 t.deepEqual(tree.nodes[0].nodes[0].value, '<><<<>><>');141 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');142 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\<\\>\\<\\<\\<\\>\\>\\<\\>');143});144(0, _helpers.test)('id selector with escaping (20)', '#\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<\\-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.\\-\\-\\-\\-\\-\\-\\.\\-\\-\\-\\-\\-\\-\\-\\-\\.\\>\\+\\.\\>\\.', function (t, tree) {145 t.deepEqual(tree.nodes[0].nodes[0].value, '++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.');146 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');147 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<\\-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.\\-\\-\\-\\-\\-\\-\\.\\-\\-\\-\\-\\-\\-\\-\\-\\.\\>\\+\\.\\>\\.');148});149(0, _helpers.test)('id selector with escaping (21)', '#\\#', function (t, tree) {150 t.deepEqual(tree.nodes[0].nodes[0].value, '#');151 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');152 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#');153});154(0, _helpers.test)('id selector with escaping (22)', '#\\#\\#', function (t, tree) {155 t.deepEqual(tree.nodes[0].nodes[0].value, '##');156 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');157 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#\\#');158});159(0, _helpers.test)('id selector with escaping (23)', '#\\#\\.\\#\\.\\#', function (t, tree) {160 t.deepEqual(tree.nodes[0].nodes[0].value, '#.#.#');161 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');162 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#\\.\\#\\.\\#');163});164(0, _helpers.test)('id selector with escaping (24)', '#\\_', function (t, tree) {165 t.deepEqual(tree.nodes[0].nodes[0].value, '_');166 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');167 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\_');168});169(0, _helpers.test)('id selector with escaping (25)', '#\\{\\}', function (t, tree) {170 t.deepEqual(tree.nodes[0].nodes[0].value, '{}');171 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');172 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\{\\}');173});174(0, _helpers.test)('id selector with escaping (26)', '#\\.fake\\-class', function (t, tree) {175 t.deepEqual(tree.nodes[0].nodes[0].value, '.fake-class');176 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');177 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\.fake\\-class');178});179(0, _helpers.test)('id selector with escaping (27)', '#foo\\.bar', function (t, tree) {180 t.deepEqual(tree.nodes[0].nodes[0].value, 'foo.bar');181 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');182 t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'foo\\.bar');183});184(0, _helpers.test)('id selector with escaping (28)', '#\\3A hover', function (t, tree) {185 t.deepEqual(tree.nodes[0].nodes[0].value, ':hover');186 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');187 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A hover');188});189(0, _helpers.test)('id selector with escaping (29)', '#\\3A hover\\3A focus\\3A active', function (t, tree) {190 t.deepEqual(tree.nodes[0].nodes[0].value, ':hover:focus:active');191 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');192 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A hover\\3A focus\\3A active');193});194(0, _helpers.test)('id selector with escaping (30)', '#\\[attr\\=value\\]', function (t, tree) {195 t.deepEqual(tree.nodes[0].nodes[0].value, '[attr=value]');196 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');197 t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\[attr\\=value\\]');198});199(0, _helpers.test)('id selector with escaping (31)', '#f\\/o\\/o', function (t, tree) {200 t.deepEqual(tree.nodes[0].nodes[0].value, 'f/o/o');201 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');202 t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\/o\\/o');203});204(0, _helpers.test)('id selector with escaping (32)', '#f\\\\o\\\\o', function (t, tree) {205 t.deepEqual(tree.nodes[0].nodes[0].value, 'f\\o\\o');206 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');207 t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\\\o\\\\o');208});209(0, _helpers.test)('id selector with escaping (33)', '#f\\*o\\*o', function (t, tree) {210 t.deepEqual(tree.nodes[0].nodes[0].value, 'f*o*o');211 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');212 t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\*o\\*o');213});214(0, _helpers.test)('id selector with escaping (34)', '#f\\!o\\!o', function (t, tree) {215 t.deepEqual(tree.nodes[0].nodes[0].value, 'f!o!o');216 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');217 t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\!o\\!o');218});219(0, _helpers.test)('id selector with escaping (35)', '#f\\\'o\\\'o', function (t, tree) {220 t.deepEqual(tree.nodes[0].nodes[0].value, 'f\'o\'o');221 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');222 t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\\'o\\\'o');223});224(0, _helpers.test)('id selector with escaping (36)', '#f\\~o\\~o', function (t, tree) {225 t.deepEqual(tree.nodes[0].nodes[0].value, 'f~o~o');226 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');227 t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\~o\\~o');228});229(0, _helpers.test)('id selector with escaping (37)', '#f\\+o\\+o', function (t, tree) {230 t.deepEqual(tree.nodes[0].nodes[0].value, 'f+o+o');231 t.deepEqual(tree.nodes[0].nodes[0].type, 'id');232 t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\+o\\+o');...
pseudos.js
Source:pseudos.js
1"use strict";2var _helpers = require("./util/helpers");3(0, _helpers.test)('pseudo element (single colon)', 'h1:after', function (t, tree) {4 t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');5 t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo');6 t.deepEqual(tree.nodes[0].nodes[1].value, ':after');7});8(0, _helpers.test)('pseudo element (double colon)', 'h1::after', function (t, tree) {9 t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');10 t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo');11 t.deepEqual(tree.nodes[0].nodes[1].value, '::after');12});13(0, _helpers.test)('multiple pseudo elements', '*:target::before, a:after', function (t, tree) {14 t.deepEqual(tree.nodes[0].nodes[0].value, '*');15 t.deepEqual(tree.nodes[0].nodes[1].value, ':target');16 t.deepEqual(tree.nodes[0].nodes[2].value, '::before');17 t.deepEqual(tree.nodes[1].nodes[1].value, ':after');18});19(0, _helpers.test)('negation pseudo element', 'h1:not(.heading)', function (t, tree) {20 t.deepEqual(tree.nodes[0].nodes[1].value, ':not');21 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, 'heading');22});23(0, _helpers.test)('negation pseudo element (2)', 'h1:not(.heading, .title, .content)', function (t, tree) {24 t.deepEqual(tree.nodes[0].nodes[1].value, ':not');25 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, 'heading');26 t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].value, 'title');27 t.deepEqual(tree.nodes[0].nodes[1].nodes[2].nodes[0].value, 'content');28});29(0, _helpers.test)('negation pseudo element (3)', 'h1:not(.heading > .title) > h1', function (t, tree) {30 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, 'heading');31 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[1].value, '>');32 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[2].value, 'title');33 t.deepEqual(tree.nodes[0].nodes[2].value, '>');34 t.deepEqual(tree.nodes[0].nodes[3].value, 'h1');35});36(0, _helpers.test)('negation pseudo element (4)', 'h1:not(h2:not(h3))', function (t, tree) {37 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[1].nodes[0].nodes[0].value, 'h3');38 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[1].nodes[0].nodes[0].parent.type, 'selector');39});40(0, _helpers.test)('pseudo class in the middle of a selector', 'a:link.external', function (t, tree) {41 t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');42 t.deepEqual(tree.nodes[0].nodes[0].value, 'a');43 t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo');44 t.deepEqual(tree.nodes[0].nodes[1].value, ':link');45 t.deepEqual(tree.nodes[0].nodes[2].type, 'class');46 t.deepEqual(tree.nodes[0].nodes[2].value, 'external');47});48(0, _helpers.test)('extra whitespace inside parentheses', 'a:not( h2 )', function (t, tree) {49 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, 'h2');50 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].spaces.after, ' ');51 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].spaces.before, ' ');52});53(0, _helpers.test)('escaped numbers in class name with pseudo', 'a:before.\\31\\ 0', function (t, tree) {54 t.deepEqual(tree.nodes[0].nodes[2].type, 'class');55 t.deepEqual(tree.nodes[0].nodes[2].value, '1 0');56 t.deepEqual(tree.nodes[0].nodes[2].raws.value, '\\31\\ 0');57});58(0, _helpers.test)('nested pseudo', '.btn-group>.btn:last-child:not(:first-child)', function (t, tree) {59 t.deepEqual(tree.nodes[0].nodes[4].value, ':not');60});61(0, _helpers.test)('extraneous non-combinating whitespace', ' h1:after , h2:after ', function (t, tree) {62 t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' ');63 t.deepEqual(tree.nodes[0].nodes[1].value, ':after');64 t.deepEqual(tree.nodes[0].nodes[1].spaces.after, ' ');65 t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' ');66 t.deepEqual(tree.nodes[1].nodes[1].value, ':after');67 t.deepEqual(tree.nodes[1].nodes[1].spaces.after, ' ');68});69(0, _helpers.test)('negation pseudo element with quotes', 'h1:not(".heading")', function (t, tree) {70 t.deepEqual(tree.nodes[0].nodes[1].value, ':not');71 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, '".heading"');72});73(0, _helpers.test)('negation pseudo element with single quotes', "h1:not('.heading')", function (t, tree) {74 t.deepEqual(tree.nodes[0].nodes[1].value, ':not');75 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, "'.heading'");76});77(0, _helpers.test)('Issue #116', "svg:not(:root)", function (t, tree) {78 t.deepEqual(tree.nodes[0].nodes[1].value, ':not');79 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, ':root');80});81(0, _helpers.test)('alone pseudo class', ':root', function (t, tree) {82 t.deepEqual(tree.nodes[0].nodes[0].type, 'pseudo');83 t.deepEqual(tree.nodes[0].nodes[0].value, ':root');84});85(0, _helpers.test)('non standard pseudo (@custom-selector)', ":--foobar, a", function (t, tree) {86 t.deepEqual(tree.nodes[0].nodes[0].value, ':--foobar');87 t.deepEqual(tree.nodes[0].nodes[0].type, 'pseudo');88 t.deepEqual(tree.nodes[1].nodes[0].value, 'a');89 t.deepEqual(tree.nodes[1].nodes[0].type, 'tag');90});91(0, _helpers.test)('non standard pseudo (@custom-selector) (1)', "a, :--foobar", function (t, tree) {92 t.deepEqual(tree.nodes[0].nodes[0].value, 'a');93 t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');94 t.deepEqual(tree.nodes[1].nodes[0].value, ':--foobar');95 t.deepEqual(tree.nodes[1].nodes[0].type, 'pseudo');96});97(0, _helpers.test)('current pseudo class', ':current(p, li, dt, dd)', function (t, tree) {98 t.deepEqual(tree.nodes[0].nodes[0].type, 'pseudo');99 t.deepEqual(tree.nodes[0].nodes[0].value, ':current');100 t.deepEqual(tree.nodes[0].nodes[0].nodes[0].nodes[0].type, 'tag');101 t.deepEqual(tree.nodes[0].nodes[0].nodes[0].nodes[0].value, 'p');102 t.deepEqual(tree.nodes[0].nodes[0].nodes[1].nodes[0].type, 'tag');103 t.deepEqual(tree.nodes[0].nodes[0].nodes[1].nodes[0].value, 'li');104 t.deepEqual(tree.nodes[0].nodes[0].nodes[2].nodes[0].type, 'tag');105 t.deepEqual(tree.nodes[0].nodes[0].nodes[2].nodes[0].value, 'dt');106 t.deepEqual(tree.nodes[0].nodes[0].nodes[3].nodes[0].type, 'tag');107 t.deepEqual(tree.nodes[0].nodes[0].nodes[3].nodes[0].value, 'dd');108});109(0, _helpers.test)('is pseudo class', ':is(p, li, dt, dd)', function (t, tree) {110 t.deepEqual(tree.nodes[0].nodes[0].type, 'pseudo');111 t.deepEqual(tree.nodes[0].nodes[0].value, ':is');112 t.deepEqual(tree.nodes[0].nodes[0].nodes[0].nodes[0].type, 'tag');113 t.deepEqual(tree.nodes[0].nodes[0].nodes[0].nodes[0].value, 'p');114 t.deepEqual(tree.nodes[0].nodes[0].nodes[1].nodes[0].type, 'tag');115 t.deepEqual(tree.nodes[0].nodes[0].nodes[1].nodes[0].value, 'li');116 t.deepEqual(tree.nodes[0].nodes[0].nodes[2].nodes[0].type, 'tag');117 t.deepEqual(tree.nodes[0].nodes[0].nodes[2].nodes[0].value, 'dt');118 t.deepEqual(tree.nodes[0].nodes[0].nodes[3].nodes[0].type, 'tag');119 t.deepEqual(tree.nodes[0].nodes[0].nodes[3].nodes[0].value, 'dd');120});121(0, _helpers.test)('is pseudo class with namespace', '*|*:is(:hover, :focus) ', function (t, tree) {122 t.deepEqual(tree.nodes[0].nodes[0].type, 'universal');123 t.deepEqual(tree.nodes[0].nodes[0].namespace, '*');124 t.deepEqual(tree.nodes[0].nodes[0].value, '*');125 t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo');126 t.deepEqual(tree.nodes[0].nodes[1].value, ':is');127 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].type, 'pseudo');128 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, ':hover');129 t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].type, 'pseudo');130 t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].value, ':focus');131});132(0, _helpers.test)('has pseudo class', 'a:has(> img)', function (t, tree) {133 t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');134 t.deepEqual(tree.nodes[0].nodes[0].value, 'a');135 t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo');136 t.deepEqual(tree.nodes[0].nodes[1].value, ':has');137 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].type, 'combinator');138 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, '>');139 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[1].type, 'tag');140 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[1].value, 'img');141});142(0, _helpers.test)('where pseudo class', 'a:where(:not(:hover))', function (t, tree) {143 t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');144 t.deepEqual(tree.nodes[0].nodes[0].value, 'a');145 t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo');146 t.deepEqual(tree.nodes[0].nodes[1].value, ':where');147 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].type, 'pseudo');148 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, ':not');149 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[0].nodes[0].type, 'pseudo');150 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[0].nodes[0].value, ':hover');151});152(0, _helpers.test)('nested pseudo classes', "section:not( :has(h1, h2 ) )", function (t, tree) {153 t.deepEqual(tree.nodes[0].nodes[0].type, 'tag');154 t.deepEqual(tree.nodes[0].nodes[0].value, 'section');155 t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo');156 t.deepEqual(tree.nodes[0].nodes[1].value, ':not');157 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].type, 'pseudo');158 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, ':has');159 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[0].nodes[0].type, 'tag');160 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[0].nodes[0].value, 'h1');161 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[1].nodes[0].type, 'tag');162 t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[1].nodes[0].value, 'h2');...
Using AI Code Generation
1var tracetest = require('./tracetest');2tracetest.trace('test');3exports.trace = function(message) {4 console.log(message);5};6 at Function.Module._resolveFilename (module.js:338:15)7 at Function.Module._load (module.js:280:25)8 at Module.require (module.js:364:17)9 at require (module.js:380:17)10 at Object.<anonymous> (/Users/me/test.js:1:14)11 at Module._compile (module.js:456:26)12 at Object.Module._extensions..js (module.js:474:10)13 at Module.load (module.js:356:32)14 at Function.Module._load (module.js:312:12)15 at Function.Module.runMain (module.js:497:10)16require('./tracetest.js');
Using AI Code Generation
1var tracetest = require('./tracetest');2tracetest.trace("Hello World!");3exports.trace = function(msg){4 console.log(msg);5}6var tracetest = require('./tracetest');7tracetest.trace("Hello World!");8exports.trace = function(msg){9 console.log(msg);10}11var tracetest = require('./tracetest');12tracetest.trace("Hello World!");13exports.trace = function(msg){14 console.log(msg);15}16var tracetest = require('./tracetest');17tracetest.trace("Hello World!");18exports.trace = function(msg){19 console.log(msg);20}21var tracetest = require('./tracetest');22tracetest.trace("Hello World!");23exports.trace = function(msg){24 console.log(msg);25}26var tracetest = require('./tracetest');27tracetest.trace("Hello World!");28exports.trace = function(msg){29 console.log(msg);30}31var tracetest = require('./tracetest');32tracetest.trace("Hello World!");33exports.trace = function(msg){34 console.log(msg);35}36var tracetest = require('./tracetest');37tracetest.trace("Hello World!");38exports.trace = function(msg){39 console.log(msg);40}
Using AI Code Generation
1var tracetest = require('./tracetest.js');2tracetest.test();3exports.test = function() {4 console.log("hello");5};6The above code will print hello to the console. The problem is that I want to use tracetest.js in my web application. I want to use the method test() in my app.js file. I tried to use the require() function but it didn't work. I tried to use the require() function in the app.js file and it didn't work. I tried to use the require() function in the tracetest.js file and it didn't work. I tried to use the require() function in the test.js file and it didn't work. I tried to use the require() function in the tracetest.js file and it didn't work. I tried to use the require() function in the test.js file and it didn't work. I tried to use the require() function in the tracetest.js file and it didn't work. I tried to use the require() function in the test.js file and it didn't work. I tried to use the require() function in the tracetest.js file and it didn't work. I tried to use the require() function in the test.js file and it didn't work. I tried to use the require() function in the tracetest.js file and it didn't work. I tried to use the require() function in the test.js file and it didn't work. I tried to use the require() function in the tracetest.js file and it didn't work. I tried to use the require() function in the test.js file and it didn't work. I tried to use the require() function in the tracetest.js file and it didn't work. I tried to use the require() function in the test.js file and it didn't work. I tried to use the require() function in the tracetest.js file and it didn't work. I tried to use the require() function in the test.js file and it didn't work. I tried to use the require() function in the tracetest.js file and it didn't work. I tried to use the require() function in the test.js file and it didn't work. I tried to use the require() function in the tracetest.js file and it didn
Using AI Code Generation
1function traceTest()2{3 trace("test");4 trace("test");5 trace("test");6 trace("test");7 trace("test");8 trace("test");9}10function traceTest()11{12 trace("test2");13 trace("test2");14 trace("test2");15 trace("test2");16 trace("test2");17 trace("test2");18}19function traceTest()20{21 trace("test3");22 trace("test3");23 trace("test3");24 trace("test3");25 trace("test3");26 trace("test3");27}28function traceTest()29{30 trace("test4");31 trace("test4");32 trace("test4");33 trace("test4");34 trace("test4");35 trace("test4");36}37function traceTest()38{39 trace("test5");40 trace("test5");41 trace("test5");42 trace("test5");43 trace("test5");44 trace("test5");45}46function traceTest()47{48 trace("test6");49 trace("test6");50 trace("test6");51 trace("test6");52 trace("test6");53 trace("test6");54}55function traceTest()56{57 trace("test7");58 trace("test7");59 trace("test7");60 trace("test7");61 trace("test7");62 trace("test7");63}64function traceTest()65{66 trace("test8");67 trace("test8");68 trace("test8");69 trace("test8");70 trace("test8");71 trace("test8");72}73function traceTest()74{75 trace("test9");76 trace("test9");77 trace("test9");
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!