less 3.0.0-pre.2 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/.eslintrc.json +88 -0
  2. package/.github/stale.yml +17 -0
  3. package/.project +17 -0
  4. package/.settings/org.eclipse.buildship.core.prefs +2 -0
  5. package/.travis.yml +22 -3
  6. package/.vscode/launch.json +14 -0
  7. package/CHANGELOG.md +27 -0
  8. package/Gruntfile.js +191 -86
  9. package/README.md +5 -7
  10. package/appveyor.yml +9 -10
  11. package/bin/lessc +37 -50
  12. package/dist/less.js +1357 -1269
  13. package/dist/less.min.js +7 -7
  14. package/lib/less/contexts.js +20 -16
  15. package/lib/less/default-options.js +65 -0
  16. package/lib/less/environment/abstract-file-manager.js +13 -14
  17. package/lib/less/environment/abstract-plugin-loader.js +45 -36
  18. package/lib/less/environment/environment.js +5 -0
  19. package/lib/less/functions/boolean.js +15 -0
  20. package/lib/less/functions/color.js +54 -24
  21. package/lib/less/functions/data-uri.js +5 -2
  22. package/lib/less/functions/function-registry.js +1 -1
  23. package/lib/less/functions/index.js +2 -1
  24. package/lib/less/functions/number.js +2 -2
  25. package/lib/less/functions/string.js +2 -2
  26. package/lib/less/functions/svg.js +4 -4
  27. package/lib/less/import-manager.js +41 -29
  28. package/lib/less/index.js +28 -3
  29. package/lib/less/less-error.js +112 -13
  30. package/lib/less/parse.js +18 -15
  31. package/lib/less/parser/parser-input.js +4 -4
  32. package/lib/less/parser/parser.js +208 -114
  33. package/lib/less/plugin-manager.js +8 -33
  34. package/lib/less/render.js +6 -2
  35. package/lib/less/source-map-builder.js +3 -0
  36. package/lib/less/source-map-output.js +13 -8
  37. package/lib/less/transform-tree.js +2 -2
  38. package/lib/less/tree/anonymous.js +4 -1
  39. package/lib/less/tree/atrule.js +7 -6
  40. package/lib/less/tree/call.js +25 -3
  41. package/lib/less/tree/color.js +2 -2
  42. package/lib/less/tree/debug-info.js +1 -1
  43. package/lib/less/tree/declaration.js +6 -5
  44. package/lib/less/tree/dimension.js +4 -1
  45. package/lib/less/tree/extend.js +2 -2
  46. package/lib/less/tree/import.js +17 -9
  47. package/lib/less/tree/index.js +3 -7
  48. package/lib/less/tree/js-eval-node.js +1 -1
  49. package/lib/less/tree/media.js +3 -14
  50. package/lib/less/tree/mixin-definition.js +3 -3
  51. package/lib/less/tree/node.js +9 -6
  52. package/lib/less/tree/operation.js +1 -1
  53. package/lib/less/tree/property.js +70 -0
  54. package/lib/less/tree/quoted.js +11 -10
  55. package/lib/less/tree/ruleset.js +115 -71
  56. package/lib/less/tree/selector.js +38 -23
  57. package/lib/less/tree/unit.js +1 -1
  58. package/lib/less/tree/value.js +6 -1
  59. package/lib/less/tree/{ruleset-call.js → variable-call.js} +5 -5
  60. package/lib/less/tree/variable.js +6 -6
  61. package/lib/less/utils.js +40 -0
  62. package/lib/less/visitors/extend-visitor.js +14 -14
  63. package/lib/less/visitors/import-visitor.js +2 -2
  64. package/lib/less/visitors/join-selector-visitor.js +1 -1
  65. package/lib/less/visitors/to-css-visitor.js +51 -84
  66. package/lib/less/visitors/visitor.js +15 -15
  67. package/lib/less-browser/bootstrap.js +21 -5
  68. package/lib/less-browser/cache.js +2 -2
  69. package/lib/less-browser/error-reporting.js +5 -5
  70. package/lib/less-browser/file-manager.js +27 -35
  71. package/lib/less-browser/index.js +12 -17
  72. package/lib/less-browser/plugin-loader.js +8 -45
  73. package/lib/less-browser/utils.js +1 -1
  74. package/lib/less-node/file-manager.js +99 -69
  75. package/lib/less-node/fs.js +1 -1
  76. package/lib/less-node/image-size.js +2 -2
  77. package/lib/less-node/index.js +7 -57
  78. package/lib/less-node/lessc-helper.js +38 -38
  79. package/lib/less-node/plugin-loader.js +18 -79
  80. package/lib/less-node/url-file-manager.js +1 -1
  81. package/lib/less-rhino/index.js +29 -44
  82. package/package.json +16 -9
  83. package/test/browser/common.js +54 -18
  84. package/test/browser/css/plugin/plugin.css +3 -0
  85. package/test/browser/jasmine-jsreporter.js +4 -4
  86. package/test/browser/less/plugin/plugin.js +7 -0
  87. package/test/browser/less/plugin/plugin.less +4 -0
  88. package/test/browser/less.js +11685 -13
  89. package/test/browser/runner-browser-options.js +6 -1
  90. package/test/browser/runner-filemanagerPlugin-options.js +3 -2
  91. package/test/browser/runner-legacy-options.js +2 -1
  92. package/test/browser/runner-main-options.js +0 -1
  93. package/test/browser/runner-modify-vars-spec.js +2 -2
  94. package/test/browser/test-runner-template.tmpl +38 -14
  95. package/test/copy-bom.js +1 -1
  96. package/test/css/calc.css +5 -0
  97. package/test/css/comments2.css +1 -1
  98. package/test/css/compression/compression.css +1 -1
  99. package/test/css/css-grid.css +11 -0
  100. package/test/css/debug/linenumbers-all.css +0 -1
  101. package/test/css/debug/linenumbers-comments.css +0 -1
  102. package/test/css/debug/linenumbers-mediaquery.css +0 -1
  103. package/test/css/functions.css +16 -3
  104. package/test/css/import-module.css +9 -0
  105. package/test/css/import.css +0 -1
  106. package/test/css/legacy/legacy.css +1 -1
  107. package/test/css/merge.css +5 -4
  108. package/test/css/plugin-module.css +1 -0
  109. package/test/css/plugin.css +20 -0
  110. package/test/css/property-accessors.css +49 -0
  111. package/test/css/{css.css → strict-math/css.css} +0 -0
  112. package/test/css/{mixins-args.css → strict-math/mixins-args.css} +0 -0
  113. package/test/css/{parens.css → strict-math/parens.css} +0 -0
  114. package/test/import-module/one/1.less +3 -0
  115. package/test/import-module/one/two/2.less +3 -0
  116. package/test/import-module/one/two/three/3.less +3 -0
  117. package/test/import-module/package.json +11 -0
  118. package/test/index.js +55 -49
  119. package/test/less/calc.less +7 -0
  120. package/test/less/css-grid.less +15 -0
  121. package/test/less/detached-rulesets.less +2 -2
  122. package/test/less/errors/color-invalid-hex-code.less +1 -0
  123. package/test/less/errors/color-invalid-hex-code.txt +1 -1
  124. package/test/less/errors/color-invalid-hex-code2.less +1 -0
  125. package/test/less/errors/color-invalid-hex-code2.txt +1 -1
  126. package/test/less/errors/import-missing.txt +1 -1
  127. package/test/less/errors/plugin/plugin-error-2.js +5 -0
  128. package/test/less/errors/plugin/plugin-error-3.js +5 -0
  129. package/test/less/errors/plugin/plugin-error.js +1 -0
  130. package/test/less/errors/plugin-1.less +1 -0
  131. package/test/less/errors/plugin-1.txt +2 -0
  132. package/test/less/errors/plugin-2.less +1 -0
  133. package/test/less/errors/plugin-2.txt +5 -0
  134. package/test/less/errors/plugin-3.less +1 -0
  135. package/test/less/errors/plugin-3.txt +5 -0
  136. package/test/less/functions.less +18 -0
  137. package/test/less/import-module.less +3 -0
  138. package/test/less/import.less +0 -2
  139. package/test/less/legacy/legacy.less +1 -1
  140. package/test/less/media.less +2 -2
  141. package/test/less/merge.less +6 -3
  142. package/test/less/plugin/plugin-collection.js +9 -0
  143. package/test/less/plugin/plugin-local.js +2 -2
  144. package/test/less/plugin/plugin-scope1.js +3 -0
  145. package/test/less/plugin/plugin-scope2.js +3 -0
  146. package/test/less/plugin/plugin-simple.js +7 -0
  147. package/test/less/plugin/plugin-tree-nodes.js +33 -31
  148. package/test/less/plugin-module.less +7 -0
  149. package/test/less/plugin.less +33 -3
  150. package/test/less/property-accessors.less +67 -0
  151. package/test/less/root-registry/file.less +1 -0
  152. package/test/less/root-registry/root.less +3 -0
  153. package/test/less/{css.less → strict-math/css.less} +0 -0
  154. package/test/less/{mixins-args.less → strict-math/mixins-args.less} +0 -0
  155. package/test/less/{parens.less → strict-math/parens.less} +0 -0
  156. package/test/less-bom/calc.less +7 -0
  157. package/test/less-bom/css-grid.less +15 -0
  158. package/test/less-bom/detached-rulesets.less +2 -2
  159. package/test/less-bom/errors/color-invalid-hex-code.less +1 -0
  160. package/test/less-bom/errors/color-invalid-hex-code.txt +1 -1
  161. package/test/less-bom/errors/color-invalid-hex-code2.less +1 -0
  162. package/test/less-bom/errors/color-invalid-hex-code2.txt +1 -1
  163. package/test/less-bom/errors/import-missing.txt +1 -1
  164. package/test/less-bom/errors/plugin/plugin-error-2.js +5 -0
  165. package/test/less-bom/errors/plugin/plugin-error-3.js +5 -0
  166. package/test/less-bom/errors/plugin/plugin-error.js +1 -0
  167. package/test/less-bom/errors/plugin-1.less +1 -0
  168. package/test/less-bom/errors/plugin-1.txt +2 -0
  169. package/test/less-bom/errors/plugin-2.less +1 -0
  170. package/test/less-bom/errors/plugin-2.txt +5 -0
  171. package/test/less-bom/errors/plugin-3.less +1 -0
  172. package/test/less-bom/errors/plugin-3.txt +5 -0
  173. package/test/less-bom/functions.less +18 -0
  174. package/test/less-bom/import-module.less +3 -0
  175. package/test/less-bom/import.less +0 -2
  176. package/test/less-bom/legacy/legacy.less +1 -1
  177. package/test/less-bom/media.less +2 -2
  178. package/test/less-bom/merge.less +6 -3
  179. package/test/less-bom/plugin/plugin-collection.js +9 -0
  180. package/test/less-bom/plugin/plugin-local.js +2 -2
  181. package/test/less-bom/plugin/plugin-scope1.js +3 -0
  182. package/test/less-bom/plugin/plugin-scope2.js +3 -0
  183. package/test/less-bom/plugin/plugin-simple.js +7 -0
  184. package/test/less-bom/plugin/plugin-tree-nodes.js +33 -31
  185. package/test/less-bom/plugin-module.less +7 -0
  186. package/test/less-bom/plugin.less +33 -3
  187. package/test/less-bom/property-accessors.less +67 -0
  188. package/test/less-bom/root-registry/file.less +1 -0
  189. package/test/less-bom/root-registry/root.less +3 -0
  190. package/test/less-bom/{css.less → strict-math/css.less} +0 -0
  191. package/test/less-bom/{mixins-args.less → strict-math/mixins-args.less} +0 -0
  192. package/test/less-bom/{parens.less → strict-math/parens.less} +0 -0
  193. package/test/less-test.js +75 -17
  194. package/test/modify-vars.js +1 -1
  195. package/test/plugins/visitor/index.js +1 -1
  196. package/.jscsrc +0 -73
  197. package/.jshintrc +0 -11
  198. package/lib/less/tree/alpha.js +0 -28
  199. package/lib/less/tree/directive.js +0 -12
  200. package/lib/less/tree/rule.js +0 -12
  201. package/test/less/errors/functions-2-alpha.less +0 -2
  202. package/test/less/errors/functions-2-alpha.txt +0 -3
  203. package/test/less-bom/errors/functions-2-alpha.less +0 -2
  204. package/test/less-bom/errors/functions-2-alpha.txt +0 -3
  205. package/test/sourcemaps/maps/import-map.map +0 -1
@@ -1,4 +1,9 @@
1
- var less = {logLevel: 4, errorReporting: "console", javascriptEnabled: true};
1
+ var less = {
2
+ logLevel: 4,
3
+ errorReporting: "console",
4
+ javascriptEnabled: true,
5
+ strictMath: false
6
+ };
2
7
 
3
8
  // There originally run inside describe method. However, since they have not
4
9
  // been inside it, they run at jasmine compile time (not runtime). It all
@@ -1,4 +1,5 @@
1
- var less = {logLevel: 4,
1
+ var less = {
2
+ logLevel: 4,
2
3
  errorReporting: "console",
3
4
  plugins: [AddFilePlugin]
4
- };
5
+ };
@@ -2,4 +2,5 @@ var less = {
2
2
  logLevel: 4,
3
3
  errorReporting: "console",
4
4
  strictMath: false,
5
- strictUnits: false };
5
+ strictUnits: false
6
+ };
@@ -2,7 +2,6 @@ var less = {
2
2
  logLevel: 4,
3
3
  errorReporting: "console"
4
4
  };
5
- less.strictMath = true;
6
5
  less.functions = {
7
6
  add: function(a, b) {
8
7
  return new(less.tree.Dimension)(a.value + b.value);
@@ -17,8 +17,8 @@ describe("less.js modify vars", function () {
17
17
  var2: "purple",
18
18
  scale: 20
19
19
  }).then(function () {
20
- done();
21
- });
20
+ done();
21
+ });
22
22
  });
23
23
  });
24
24
 
@@ -2,7 +2,29 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8">
5
+ <script>
6
+ // allow sauce to query for the jasmine report
7
+ // because we have to load the page before starting the test, so the thing
8
+ // sauce queries for might not be setup yet
9
+ var JASMINE;
10
+ if(Object.defineProperty) {
11
+ Object.defineProperty(window, 'jasmine', {
12
+ get: function() { return JASMINE; },
13
+ set: function(jsm) {
14
+ JASMINE = jsm || {};
15
+ if(!JASMINE.getJSReport || typeof JASMINE.getJSReport !== 'function') {
16
+ JASMINE.getJSReport = function() { };
17
+ }
18
+ }
19
+ });
20
+ }
21
+ else {
22
+ window.jasmine = { getJSReport: function() { } };
23
+ }
24
+ </script>
25
+
5
26
  <title>Jasmine Spec Runner</title>
27
+
6
28
  <!-- generate script tags for tests -->
7
29
  <% var generateScriptTags = function(allScripts) { allScripts.forEach(function(script){ %>
8
30
  <script src="<%= script %>"></script>
@@ -56,27 +78,29 @@
56
78
  document.body.appendChild(script);
57
79
  };
58
80
 
59
-
60
- // allow sauce to query for the jasmine report
61
- // because we have to load the page before starting the test, so the thing
62
- // sauce queries for might not be setup yet
63
- window.jasmine = { getJSReport: function() { } };
64
- setTimeout(function() {
65
- var jasmine = <% toArray([].concat(scripts.polyfills, scripts.jasmine, scripts.boot)) %>,
81
+ var jasmine = <% toArray([].concat(scripts.polyfills, scripts.jasmine, scripts.boot)) %>,
66
82
  helpers = <% toArray(scripts.helpers) %>,
67
83
  vendor = <% toArray(scripts.vendor) %>,
68
84
  specs = <% toArray(scripts.specs) %>,
69
85
  reporters = <% toArray([].concat(scripts.reporters)) %>,
70
- allScripts = jasmine.concat(helpers).concat(vendor).concat(specs).concat(reporters);
86
+ setupScripts = jasmine.concat(helpers).concat(vendor),
87
+ runScripts = specs.concat(reporters);
88
+ </script>
89
+
90
+ <% generateScriptTags(scripts.polyfills); %>
91
+ <% generateScriptTags(scripts.jasmine); %>
92
+ <% generateScriptTags(scripts.boot); %>
93
+ <% generateScriptTags(scripts.helpers); %>
94
+ <% generateScriptTags(scripts.vendor); %>
95
+
96
+ <script>
97
+ setTimeout(function() {
71
98
 
72
99
  function addNextScript() {
73
100
  // for sauce, see above. Additional step needed between loading jasmine and loading
74
101
  // the js reporter
75
- if (!jasmine.getJSReport) {
76
- jasmine.getJSReport = function() {};
77
- }
78
- if (allScripts.length) {
79
- var scriptSrc = allScripts.shift();
102
+ if (runScripts.length) {
103
+ var scriptSrc = runScripts.shift();
80
104
  loadScript(scriptSrc, addNextScript);
81
105
  } else {
82
106
  window.onload();
@@ -91,4 +115,4 @@
91
115
  <body>
92
116
  <!-- content -->
93
117
  </body>
94
- </html>
118
+ </html>
package/test/copy-bom.js CHANGED
@@ -1,4 +1,4 @@
1
- /*jshint latedef: nofunc */
1
+ /* jshint latedef: nofunc */
2
2
 
3
3
  // This is used to copy a folder (the test/less/* files & sub-folders), adding a BOM to the start of each LESS and CSS file.
4
4
  // This is a based on the copySync method from fs-extra (https://github.com/jprichardson/node-fs-extra/).
@@ -0,0 +1,5 @@
1
+ .no-math {
2
+ width: calc(50% + (25vh - 20px));
3
+ foo: 3 calc(3 + 4) 11;
4
+ bar: calc(1 + 20%);
5
+ }
@@ -8,7 +8,7 @@
8
8
  .first,
9
9
  .planning {
10
10
  margin: 10px;
11
- total-width: (1 * 6em * 12) + (2em * 12);
11
+ total-width: 96em;
12
12
  }
13
13
  .some-inline-comments {
14
14
  a: yes /* comment */;
@@ -1,3 +1,3 @@
1
1
  #colours{color1:#fea;color2:#ffeeaa;color3:rgba(255,238,170,0.1);string:"#fea";/*! but not this type
2
2
  Note preserved whitespace
3
- */}dimensions{val:.1px;val:0;val:4cm;val:.2;val:5;angles-must-have-unit:0deg;durations-must-have-unit:0s;length-doesnt-have-unit:0;width:auto\9}@page{marks:none;@top-left-corner{vertical-align:top}@top-left{vertical-align:top}}.shadow^.dom,body^^.shadow{display:done}
3
+ */}dimensions{val:0.1px;val:0em;val:4cm;val:0.2;val:5;angles-must-have-unit:0deg;durations-must-have-unit:0s;length-doesnt-have-unit:0px;width:auto\9}@page{marks:none;@top-left-corner{vertical-align:top}@top-left{vertical-align:top}}.shadow^.dom,body^^.shadow{display:done}
@@ -0,0 +1,11 @@
1
+ .wrapper {
2
+ display: grid;
3
+ grid-template-columns: [col1-start] 9fr [col1-end] 10px [col2-start] 3fr [col2-end];
4
+ grid-template-rows: auto;
5
+ }
6
+ .wrapper {
7
+ display: grid;
8
+ grid-template-columns: 9fr 1.875em 3fr;
9
+ grid-template-rows: auto;
10
+ grid-template-areas: "header header header" "content . sidebar" "footer footer footer";
11
+ }
@@ -2,7 +2,6 @@
2
2
  /* line 1, {pathimport}test.less */
3
3
  @media -sass-debug-info{filename{font-family:file\:\/\/{pathimportesc}test\.less}line{font-family:\000031}}
4
4
  /* @charset "ISO-8859-1"; */
5
-
6
5
  /* line 23, {pathimport}test.less */
7
6
  @media -sass-debug-info{filename{font-family:file\:\/\/{pathimportesc}test\.less}line{font-family:\0000323}}
8
7
  .tst3 {
@@ -1,7 +1,6 @@
1
1
  @charset "UTF-8";
2
2
  /* line 1, {pathimport}test.less */
3
3
  /* @charset "ISO-8859-1"; */
4
-
5
4
  /* line 23, {pathimport}test.less */
6
5
  .tst3 {
7
6
  color: grey;
@@ -1,7 +1,6 @@
1
1
  @charset "UTF-8";
2
2
  @media -sass-debug-info{filename{font-family:file\:\/\/{pathimportesc}test\.less}line{font-family:\000031}}
3
3
  /* @charset "ISO-8859-1"; */
4
-
5
4
  @media -sass-debug-info{filename{font-family:file\:\/\/{pathimportesc}test\.less}line{font-family:\0000323}}
6
5
  .tst3 {
7
6
  color: grey;
@@ -38,7 +38,7 @@
38
38
  saturate-filter: saturate(5%);
39
39
  contrast-white: #000000;
40
40
  contrast-black: #ffffff;
41
- contrast-red: #000000;
41
+ contrast-red: #ffffff;
42
42
  contrast-green: #000000;
43
43
  contrast-blue: #ffffff;
44
44
  contrast-yellow: #000000;
@@ -49,11 +49,11 @@
49
49
  contrast-light-thresh: #111111;
50
50
  contrast-dark-thresh: #eeeeee;
51
51
  contrast-high-thresh: #eeeeee;
52
- contrast-low-thresh: #eeeeee;
52
+ contrast-low-thresh: #111111;
53
53
  contrast-light-thresh-per: #111111;
54
54
  contrast-dark-thresh-per: #eeeeee;
55
55
  contrast-high-thresh-per: #eeeeee;
56
- contrast-low-thresh-per: #eeeeee;
56
+ contrast-low-thresh-per: #111111;
57
57
  replace: "Hello, World!";
58
58
  replace-captured: "This is a new string.";
59
59
  replace-with-flags: "2 + 2 = 4";
@@ -199,3 +199,16 @@
199
199
  html {
200
200
  color: #8080ff;
201
201
  }
202
+ #boolean {
203
+ a: true;
204
+ b: false;
205
+ c: false;
206
+ }
207
+ #if {
208
+ a: 1;
209
+ b: 2;
210
+ c: 3;
211
+ e: ;
212
+ f: 6;
213
+ /* results in void */
214
+ }
@@ -0,0 +1,9 @@
1
+ .three {
2
+ color: green;
3
+ }
4
+ .two {
5
+ color: blue;
6
+ }
7
+ .one {
8
+ color: red;
9
+ }
@@ -1,6 +1,5 @@
1
1
  @charset "UTF-8";
2
2
  /** comment at the top**/
3
- @import url(http://fonts.googleapis.com/css?family=Open+Sans);
4
3
  @import url(/absolute/something.css) screen and (color) and (max-width: 600px);
5
4
  @import url("//ha.com/file.css") (min-width: 100px);
6
5
  #import-test {
@@ -1,4 +1,4 @@
1
- @media (-o-min-device-pixel-ratio: 2/1) {
1
+ @media (-o-min-device-pixel-ratio: 2) {
2
2
  .test-math-and-units {
3
3
  font: ignores 0/0 rules;
4
4
  test-division: 7em;
@@ -10,16 +10,17 @@
10
10
  background: url(data://img1.png);
11
11
  }
12
12
  .test4 {
13
- transform: rotate(90deg), skew(30deg);
14
- transform: scale(2, 4) !important;
13
+ transform: rotate(90deg), skew(30deg), scale(2, 4) !important;
15
14
  }
16
15
  .test5 {
17
- transform: rotate(90deg), skew(30deg);
18
- transform: scale(2, 4) !important;
16
+ transform: rotate(90deg), skew(30deg), scale(2, 4) !important;
19
17
  }
20
18
  .test6 {
21
19
  transform: scale(2, 4);
22
20
  }
21
+ .test7 {
22
+ transform: scale(2, 4), scale(2, 4), scale(2, 4) !important;
23
+ }
23
24
  .test-interleaved {
24
25
  transform: t1, t2, t3;
25
26
  background: b1, b2, b3;
@@ -0,0 +1 @@
1
+ a{background:0 0}
@@ -46,4 +46,24 @@
46
46
  .root {
47
47
  prop: value;
48
48
  }
49
+ .test-empty {
50
+ val1: foo;
51
+ val2: foo;
52
+ }
53
+ .test-simple {
54
+ value: 3.141592653589793;
55
+ value: 6.28318531;
56
+ }
57
+ .test-conflicts {
58
+ value: foo;
59
+ }
60
+ .test-conflicts {
61
+ value: bar;
62
+ }
63
+ .test-conflicts {
64
+ value: foo;
65
+ }
66
+ .test-collection {
67
+ list: 32, 5, "bird";
68
+ }
49
69
  @arbitrary value after ();
@@ -0,0 +1,49 @@
1
+ .block_1 {
2
+ color: red;
3
+ background-color: red;
4
+ width: 50px;
5
+ height: 25px;
6
+ border: 1px solid #ff3333;
7
+ content: "red";
8
+ prop: red;
9
+ }
10
+ .block_1:hover {
11
+ background-color: green;
12
+ color: green;
13
+ }
14
+ .block_1 .one {
15
+ background: red;
16
+ }
17
+ .block_2 {
18
+ color: red;
19
+ color: blue;
20
+ }
21
+ .block_2 .two {
22
+ background-color: blue;
23
+ }
24
+ .block_3 {
25
+ color: red;
26
+ color: yellow;
27
+ color: blue;
28
+ }
29
+ .block_3 .three {
30
+ background-color: blue;
31
+ }
32
+ .block_4 {
33
+ color: red;
34
+ color: blue;
35
+ color: yellow;
36
+ }
37
+ .block_4 .four {
38
+ background-color: yellow;
39
+ }
40
+ a {
41
+ background-color: red, foo;
42
+ }
43
+ ab {
44
+ background: red, foo;
45
+ }
46
+ .value_as_property {
47
+ prop1: color;
48
+ color: #FF0000;
49
+ }
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ .one {
2
+ color: red;
3
+ }
@@ -0,0 +1,3 @@
1
+ .two {
2
+ color: blue;
3
+ }
@@ -0,0 +1,3 @@
1
+ .three {
2
+ color: green;
3
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "import-module",
3
+ "version": "1.0.0",
4
+ "description": "Less files to be included in node_modules directory for testing import from node_modules",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "Rob Huzzey <robert.huzzey@holidayextras.com>",
10
+ "license": "ISC"
11
+ }
package/test/index.js CHANGED
@@ -3,58 +3,64 @@ var lessTest = require("./less-test"),
3
3
  path = require("path"),
4
4
  stylize = require('../lib/less-node/lessc-helper').stylize;
5
5
 
6
- function getErrorPathReplacementFunction(dir) {
7
- return function(input, baseDir) {
8
- return input.replace(/\{path\}/g, path.join(process.cwd(), baseDir, dir + "/"))
9
- .replace(/\{node\}/g, "")
10
- .replace(/\{\/node\}/g, "")
11
- .replace(/\{pathrel\}/g, path.join(baseDir, dir + "/"))
12
- .replace(/\{pathhref\}/g, "")
13
- .replace(/\{404status\}/g, "")
14
- .replace(/\r\n/g, '\n');
15
- };
16
- }
17
-
18
6
  console.log("\n" + stylize("Less", 'underline') + "\n");
19
7
 
20
8
  lessTester.prepBomTest();
21
- lessTester.runTestSet({strictMath: true, relativeUrls: true, silent: true, javascriptEnabled: true});
22
- lessTester.runTestSet({strictMath: true, strictUnits: true, javascriptEnabled: true}, "errors/",
23
- lessTester.testErrors, null, getErrorPathReplacementFunction("errors"));
24
- lessTester.runTestSet({strictMath: true, strictUnits: true, javascriptEnabled: false}, "no-js-errors/",
25
- lessTester.testErrors, null, getErrorPathReplacementFunction("no-js-errors"));
26
- lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'comments'}, "debug/", null,
27
- function(name) { return name + '-comments'; });
28
- lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'mediaquery'}, "debug/", null,
29
- function(name) { return name + '-mediaquery'; });
30
- lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'all'}, "debug/", null,
31
- function(name) { return name + '-all'; });
32
- lessTester.runTestSet({strictMath: true, relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/");
33
- lessTester.runTestSet({strictMath: true, compress: true}, "compression/");
34
- lessTester.runTestSet({strictMath: true, strictUnits: true}, "strict-units/");
35
- lessTester.runTestSet({}, "legacy/");
36
- lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: true, globalVars: true }, "sourcemaps/",
37
- lessTester.testSourcemap, null, null,
38
- function(filename, type, baseFolder) {
39
- if (type === "vars") {
40
- return path.join(baseFolder, filename) + '.json';
41
- }
42
- return path.join('test/sourcemaps', filename) + '.json';
43
- });
44
- lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: {sourceMapFileInline: true}}, "sourcemaps-empty/", lessTester.testEmptySourcemap);
45
- lessTester.runTestSet({globalVars: true, banner: "/**\n * Test\n */\n"}, "globalVars/",
46
- null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; });
47
- lessTester.runTestSet({modifyVars: true}, "modifyVars/",
48
- null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; });
49
- lessTester.runTestSet({urlArgs: '424242'}, "url-args/");
50
- lessTester.runTestSet({paths: ['test/data/', 'test/less/import/']}, "include-path/");
51
- lessTester.runTestSet({paths: 'test/data/'}, "include-path-string/");
52
- lessTester.runTestSet({plugin: 'test/plugins/postprocess/'}, "postProcessorPlugin/");
53
- lessTester.runTestSet({plugin: 'test/plugins/preprocess/'}, "preProcessorPlugin/");
54
- lessTester.runTestSet({plugin: 'test/plugins/visitor/'}, "visitorPlugin/");
55
- lessTester.runTestSet({plugin: 'test/plugins/filemanager/'}, "filemanagerPlugin/");
56
- lessTester.runTestSet({}, "no-strict-math/");
9
+ var testMap = [
10
+ [{
11
+ strictMath: false,
12
+ relativeUrls: true,
13
+ silent: true,
14
+ javascriptEnabled: true,
15
+ // Set explicitly for legacy tests for >3.0
16
+ ieCompat: true
17
+ }],
18
+ [{
19
+ strictMath: true,
20
+ ieCompat: true
21
+ }, "strict-math/"],
22
+ [{strictMath: true, strictUnits: true, javascriptEnabled: true}, "errors/",
23
+ lessTester.testErrors, null],
24
+ [{strictMath: true, strictUnits: true, javascriptEnabled: false}, "no-js-errors/",
25
+ lessTester.testErrors, null],
26
+ [{strictMath: true, dumpLineNumbers: 'comments'}, "debug/", null,
27
+ function(name) { return name + '-comments'; }],
28
+ [{strictMath: true, dumpLineNumbers: 'mediaquery'}, "debug/", null,
29
+ function(name) { return name + '-mediaquery'; }],
30
+ [{strictMath: true, dumpLineNumbers: 'all'}, "debug/", null,
31
+ function(name) { return name + '-all'; }],
32
+ [{strictMath: true, relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/"],
33
+ [{strictMath: true, compress: true}, "compression/"],
34
+ [{strictMath: false, strictUnits: true}, "strict-units/"],
35
+ [{}, "legacy/"],
36
+ [{strictMath: true, strictUnits: true, sourceMap: true, globalVars: true }, "sourcemaps/",
37
+ lessTester.testSourcemap, null, null,
38
+ function(filename, type, baseFolder) {
39
+ if (type === "vars") {
40
+ return path.join(baseFolder, filename) + '.json';
41
+ }
42
+ return path.join('test/sourcemaps', filename) + '.json';
43
+ }],
44
+ [{strictMath: true, strictUnits: true, sourceMap: {sourceMapFileInline: true}},
45
+ "sourcemaps-empty/", lessTester.testEmptySourcemap],
46
+ [{globalVars: true, banner: "/**\n * Test\n */\n"}, "globalVars/",
47
+ null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; }],
48
+ [{modifyVars: true}, "modifyVars/",
49
+ null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; }],
50
+ [{urlArgs: '424242'}, "url-args/"],
51
+ [{paths: ['test/data/', 'test/less/import/']}, "include-path/"],
52
+ [{paths: 'test/data/'}, "include-path-string/"],
53
+ [{plugin: 'test/plugins/postprocess/'}, "postProcessorPlugin/"],
54
+ [{plugin: 'test/plugins/preprocess/'}, "preProcessorPlugin/"],
55
+ [{plugin: 'test/plugins/visitor/'}, "visitorPlugin/"],
56
+ [{plugin: 'test/plugins/filemanager/'}, "filemanagerPlugin/"],
57
+ [{}, "no-strict-math/"]
58
+ ];
59
+ testMap.forEach(function(args) {
60
+ lessTester.runTestSet.apply(lessTester, args)
61
+ });
57
62
  lessTester.testSyncronous({syncImport: true}, "import");
58
- lessTester.testSyncronous({syncImport: true}, "css");
63
+ lessTester.testSyncronous({syncImport: true}, "strict-math/css");
59
64
  lessTester.testNoOptions();
65
+ lessTester.testJSImport();
60
66
  lessTester.finished();
@@ -0,0 +1,7 @@
1
+ .no-math {
2
+ @var: 50vh/2;
3
+ width: calc(50% + (@var - 20px));
4
+ foo: 1 + 2 calc(3 + 4) 5 + 6;
5
+ @floor: floor(1 + .1);
6
+ bar: calc(@floor + 20%);
7
+ }
@@ -0,0 +1,15 @@
1
+ .wrapper {
2
+ display: grid;
3
+ grid-template-columns: [col1-start] 9fr [col1-end] 10px [col2-start] 3fr [col2-end];
4
+ grid-template-rows: auto;
5
+ }
6
+
7
+ .wrapper {
8
+ display: grid;
9
+ grid-template-columns: 9fr 1.875em 3fr;
10
+ grid-template-rows: auto;
11
+ grid-template-areas:
12
+ "header header header"
13
+ "content . sidebar"
14
+ "footer footer footer";
15
+ }
@@ -31,8 +31,8 @@
31
31
  .wrap-mixin(@ruleset);
32
32
 
33
33
  .desktop-and-old-ie(@rules) {
34
- @media screen and (min-width: 1200) { @rules(); }
35
- html.lt-ie9 & { @rules(); }
34
+ @media screen and (min-width: 1200) { @rules() }
35
+ html.lt-ie9 & { @rules() }
36
36
  }
37
37
 
38
38
  header {
@@ -1,3 +1,4 @@
1
1
  .a {
2
2
  @wrongHEXColorCode: #DCALLB;
3
+ color: @wrongHEXColorCode;
3
4
  }
@@ -1,4 +1,4 @@
1
1
  SyntaxError: Invalid HEX color code in {path}color-invalid-hex-code.less on line 2, column 29:
2
2
  1 .a {
3
3
  2 @wrongHEXColorCode: #DCALLB;
4
- 3 }
4
+ 3 color: @wrongHEXColorCode;
@@ -1,3 +1,4 @@
1
1
  .a {
2
2
  @wrongHEXColorCode: #fffblack;
3
+ color: @wrongHEXColorCode;
3
4
  }
@@ -1,4 +1,4 @@
1
1
  SyntaxError: Invalid HEX color code in {path}color-invalid-hex-code2.less on line 2, column 29:
2
2
  1 .a {
3
3
  2 @wrongHEXColorCode: #fffblack;
4
- 3 }
4
+ 3 color: @wrongHEXColorCode;
@@ -1,3 +1,3 @@
1
- FileError: '{pathhref}file-does-not-exist.less' wasn't found{404status}{node}. Tried - {path}file-does-not-exist.less,{pathrel}file-does-not-exist.less,file-does-not-exist.less{/node} in {path}import-missing.less on line 6, column 1:
1
+ FileError: '{pathhref}file-does-not-exist.less' wasn't found{404status}{node}. Tried - {path}file-does-not-exist.less,{pathrel}file-does-not-exist.less,{nodepath}file-does-not-exist.less,file-does-not-exist.less{/node} in {path}import-missing.less on line 6, column 1:
2
2
  5
3
3
  6 @import "file-does-not-exist.less";
@@ -0,0 +1,5 @@
1
+ registerPlugin({
2
+ use: function() {
3
+ throw new Error("An error was here.")
4
+ }
5
+ });
@@ -0,0 +1,5 @@
1
+ registerPlugin({
2
+ eval: function() {
3
+ throw new Error("An error was here.")
4
+ }
5
+ });
@@ -0,0 +1 @@
1
+ throw new Error('Error');
@@ -0,0 +1 @@
1
+ @plugin "plugin/plugin-error";
@@ -0,0 +1,2 @@
1
+ SyntaxError: Error in {path}plugin-error.js{node} on line 1, column 8:
2
+ 1 throw new Error('Error');{/node}
@@ -0,0 +1 @@
1
+ @plugin "plugin/plugin-error-2";
@@ -0,0 +1,5 @@
1
+ SyntaxError: Error during @plugin call in {path}plugin-error-2.js{node} on line 3, column 16:
2
+ 2 use: function() {
3
+ 3 throw new Error("An error was here.")
4
+ 4 }
5
+ {/node}
@@ -0,0 +1 @@
1
+ @plugin "plugin/plugin-error-3";
@@ -0,0 +1,5 @@
1
+ SyntaxError: Plugin error during evaluation in {path}plugin-error-3.js{node} on line 3, column 16:
2
+ 2 eval: function() {
3
+ 3 throw new Error("An error was here.")
4
+ 4 }
5
+ {/node}