runner-browser-options.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. var less = {
  2. logLevel: 4,
  3. errorReporting: 'console',
  4. javascriptEnabled: true,
  5. math: 'always'
  6. };
  7. // test inline less in style tags by grabbing an assortment of less files and doing `@import`s
  8. var testFiles = ['charsets', 'colors', 'comments', 'css-3', 'strings', 'media', 'mixins'],
  9. testSheets = [];
  10. // setup style tags with less and link tags pointing to expected css output
  11. for (var i = 0; i < testFiles.length; i++) {
  12. var file = testFiles[i],
  13. lessPath = '/test/less/' + file + '.less',
  14. cssPath = '/test/css/' + file + '.css',
  15. lessStyle = document.createElement('style'),
  16. cssLink = document.createElement('link'),
  17. lessText = '@import "' + lessPath + '";';
  18. lessStyle.type = 'text/less';
  19. lessStyle.id = file;
  20. lessStyle.href = file;
  21. if (lessStyle.styleSheet === undefined) {
  22. lessStyle.appendChild(document.createTextNode(lessText));
  23. }
  24. cssLink.rel = 'stylesheet';
  25. cssLink.type = 'text/css';
  26. cssLink.href = cssPath;
  27. cssLink.id = 'expected-' + file;
  28. var head = document.getElementsByTagName('head')[0];
  29. head.appendChild(lessStyle);
  30. if (lessStyle.styleSheet) {
  31. lessStyle.styleSheet.cssText = lessText;
  32. }
  33. head.appendChild(cssLink);
  34. testSheets[i] = lessStyle;
  35. }