3 // There originally run inside describe method. However, since they have not
4 // been inside it, they run at jasmine compile time (not runtime). It all
5 // worked cause less.js was in async mode and custom phantom runner had
6 // different setup then grunt-contrib-jasmine. They have been created before
7 // less.js run, even as they have been defined in spec.
9 // test inline less in style tags by grabbing an assortment of less files and doing `@import`s
10 var testFiles = ['charsets', 'colors', 'comments', 'css-3', 'strings', 'media', 'mixins'],
13 // setup style tags with less and link tags pointing to expected css output
14 for (var i = 0; i < testFiles.length; i++) {
15 var file = testFiles[i],
16 lessPath = '/test/less/' + file + '.less',
17 cssPath = '/test/css/' + file + '.css',
18 lessStyle = document.createElement('style'),
19 cssLink = document.createElement('link'),
20 lessText = '@import "' + lessPath + '";';
22 lessStyle.type = 'text/less';
24 lessStyle.href = file;
26 if (lessStyle.styleSheet) {
27 lessStyle.styleSheet.cssText = lessText;
29 lessStyle.innerHTML = lessText;
32 cssLink.rel = 'stylesheet';
33 cssLink.type = 'text/css';
34 cssLink.href = cssPath;
35 cssLink.id = 'expected-' + file;
37 var head = document.getElementsByTagName('head')[0];
39 head.appendChild(lessStyle);
40 head.appendChild(cssLink);
41 testSheets[i] = lessStyle;