minor code style
[redakcja.git] / apps / wiki / static--wiki--editor--node_modules--grunt-contrib-less--node_modules--less--test / browser / runner-browser-options.js
1 var less = {};
2
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.
8
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'],
11     testSheets = [];
12
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 + '";';
21
22   lessStyle.type = 'text/less';
23   lessStyle.id = file;
24   lessStyle.href = file;
25
26   if (lessStyle.styleSheet) {
27     lessStyle.styleSheet.cssText = lessText;
28   } else {
29     lessStyle.innerHTML = lessText;
30   }
31
32   cssLink.rel = 'stylesheet';
33   cssLink.type = 'text/css';
34   cssLink.href = cssPath;
35   cssLink.id = 'expected-' + file;
36
37   var head = document.getElementsByTagName('head')[0];
38
39   head.appendChild(lessStyle);
40   head.appendChild(cssLink);
41   testSheets[i] = lessStyle;
42 }