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.
- package/.eslintrc.json +88 -0
- package/.github/stale.yml +17 -0
- package/.project +17 -0
- package/.settings/org.eclipse.buildship.core.prefs +2 -0
- package/.travis.yml +22 -3
- package/.vscode/launch.json +14 -0
- package/CHANGELOG.md +27 -0
- package/Gruntfile.js +191 -86
- package/README.md +5 -7
- package/appveyor.yml +9 -10
- package/bin/lessc +37 -50
- package/dist/less.js +1357 -1269
- package/dist/less.min.js +7 -7
- package/lib/less/contexts.js +20 -16
- package/lib/less/default-options.js +65 -0
- package/lib/less/environment/abstract-file-manager.js +13 -14
- package/lib/less/environment/abstract-plugin-loader.js +45 -36
- package/lib/less/environment/environment.js +5 -0
- package/lib/less/functions/boolean.js +15 -0
- package/lib/less/functions/color.js +54 -24
- package/lib/less/functions/data-uri.js +5 -2
- package/lib/less/functions/function-registry.js +1 -1
- package/lib/less/functions/index.js +2 -1
- package/lib/less/functions/number.js +2 -2
- package/lib/less/functions/string.js +2 -2
- package/lib/less/functions/svg.js +4 -4
- package/lib/less/import-manager.js +41 -29
- package/lib/less/index.js +28 -3
- package/lib/less/less-error.js +112 -13
- package/lib/less/parse.js +18 -15
- package/lib/less/parser/parser-input.js +4 -4
- package/lib/less/parser/parser.js +208 -114
- package/lib/less/plugin-manager.js +8 -33
- package/lib/less/render.js +6 -2
- package/lib/less/source-map-builder.js +3 -0
- package/lib/less/source-map-output.js +13 -8
- package/lib/less/transform-tree.js +2 -2
- package/lib/less/tree/anonymous.js +4 -1
- package/lib/less/tree/atrule.js +7 -6
- package/lib/less/tree/call.js +25 -3
- package/lib/less/tree/color.js +2 -2
- package/lib/less/tree/debug-info.js +1 -1
- package/lib/less/tree/declaration.js +6 -5
- package/lib/less/tree/dimension.js +4 -1
- package/lib/less/tree/extend.js +2 -2
- package/lib/less/tree/import.js +17 -9
- package/lib/less/tree/index.js +3 -7
- package/lib/less/tree/js-eval-node.js +1 -1
- package/lib/less/tree/media.js +3 -14
- package/lib/less/tree/mixin-definition.js +3 -3
- package/lib/less/tree/node.js +9 -6
- package/lib/less/tree/operation.js +1 -1
- package/lib/less/tree/property.js +70 -0
- package/lib/less/tree/quoted.js +11 -10
- package/lib/less/tree/ruleset.js +115 -71
- package/lib/less/tree/selector.js +38 -23
- package/lib/less/tree/unit.js +1 -1
- package/lib/less/tree/value.js +6 -1
- package/lib/less/tree/{ruleset-call.js → variable-call.js} +5 -5
- package/lib/less/tree/variable.js +6 -6
- package/lib/less/utils.js +40 -0
- package/lib/less/visitors/extend-visitor.js +14 -14
- package/lib/less/visitors/import-visitor.js +2 -2
- package/lib/less/visitors/join-selector-visitor.js +1 -1
- package/lib/less/visitors/to-css-visitor.js +51 -84
- package/lib/less/visitors/visitor.js +15 -15
- package/lib/less-browser/bootstrap.js +21 -5
- package/lib/less-browser/cache.js +2 -2
- package/lib/less-browser/error-reporting.js +5 -5
- package/lib/less-browser/file-manager.js +27 -35
- package/lib/less-browser/index.js +12 -17
- package/lib/less-browser/plugin-loader.js +8 -45
- package/lib/less-browser/utils.js +1 -1
- package/lib/less-node/file-manager.js +99 -69
- package/lib/less-node/fs.js +1 -1
- package/lib/less-node/image-size.js +2 -2
- package/lib/less-node/index.js +7 -57
- package/lib/less-node/lessc-helper.js +38 -38
- package/lib/less-node/plugin-loader.js +18 -79
- package/lib/less-node/url-file-manager.js +1 -1
- package/lib/less-rhino/index.js +29 -44
- package/package.json +16 -9
- package/test/browser/common.js +54 -18
- package/test/browser/css/plugin/plugin.css +3 -0
- package/test/browser/jasmine-jsreporter.js +4 -4
- package/test/browser/less/plugin/plugin.js +7 -0
- package/test/browser/less/plugin/plugin.less +4 -0
- package/test/browser/less.js +11685 -13
- package/test/browser/runner-browser-options.js +6 -1
- package/test/browser/runner-filemanagerPlugin-options.js +3 -2
- package/test/browser/runner-legacy-options.js +2 -1
- package/test/browser/runner-main-options.js +0 -1
- package/test/browser/runner-modify-vars-spec.js +2 -2
- package/test/browser/test-runner-template.tmpl +38 -14
- package/test/copy-bom.js +1 -1
- package/test/css/calc.css +5 -0
- package/test/css/comments2.css +1 -1
- package/test/css/compression/compression.css +1 -1
- package/test/css/css-grid.css +11 -0
- package/test/css/debug/linenumbers-all.css +0 -1
- package/test/css/debug/linenumbers-comments.css +0 -1
- package/test/css/debug/linenumbers-mediaquery.css +0 -1
- package/test/css/functions.css +16 -3
- package/test/css/import-module.css +9 -0
- package/test/css/import.css +0 -1
- package/test/css/legacy/legacy.css +1 -1
- package/test/css/merge.css +5 -4
- package/test/css/plugin-module.css +1 -0
- package/test/css/plugin.css +20 -0
- package/test/css/property-accessors.css +49 -0
- package/test/css/{css.css → strict-math/css.css} +0 -0
- package/test/css/{mixins-args.css → strict-math/mixins-args.css} +0 -0
- package/test/css/{parens.css → strict-math/parens.css} +0 -0
- package/test/import-module/one/1.less +3 -0
- package/test/import-module/one/two/2.less +3 -0
- package/test/import-module/one/two/three/3.less +3 -0
- package/test/import-module/package.json +11 -0
- package/test/index.js +55 -49
- package/test/less/calc.less +7 -0
- package/test/less/css-grid.less +15 -0
- package/test/less/detached-rulesets.less +2 -2
- package/test/less/errors/color-invalid-hex-code.less +1 -0
- package/test/less/errors/color-invalid-hex-code.txt +1 -1
- package/test/less/errors/color-invalid-hex-code2.less +1 -0
- package/test/less/errors/color-invalid-hex-code2.txt +1 -1
- package/test/less/errors/import-missing.txt +1 -1
- package/test/less/errors/plugin/plugin-error-2.js +5 -0
- package/test/less/errors/plugin/plugin-error-3.js +5 -0
- package/test/less/errors/plugin/plugin-error.js +1 -0
- package/test/less/errors/plugin-1.less +1 -0
- package/test/less/errors/plugin-1.txt +2 -0
- package/test/less/errors/plugin-2.less +1 -0
- package/test/less/errors/plugin-2.txt +5 -0
- package/test/less/errors/plugin-3.less +1 -0
- package/test/less/errors/plugin-3.txt +5 -0
- package/test/less/functions.less +18 -0
- package/test/less/import-module.less +3 -0
- package/test/less/import.less +0 -2
- package/test/less/legacy/legacy.less +1 -1
- package/test/less/media.less +2 -2
- package/test/less/merge.less +6 -3
- package/test/less/plugin/plugin-collection.js +9 -0
- package/test/less/plugin/plugin-local.js +2 -2
- package/test/less/plugin/plugin-scope1.js +3 -0
- package/test/less/plugin/plugin-scope2.js +3 -0
- package/test/less/plugin/plugin-simple.js +7 -0
- package/test/less/plugin/plugin-tree-nodes.js +33 -31
- package/test/less/plugin-module.less +7 -0
- package/test/less/plugin.less +33 -3
- package/test/less/property-accessors.less +67 -0
- package/test/less/root-registry/file.less +1 -0
- package/test/less/root-registry/root.less +3 -0
- package/test/less/{css.less → strict-math/css.less} +0 -0
- package/test/less/{mixins-args.less → strict-math/mixins-args.less} +0 -0
- package/test/less/{parens.less → strict-math/parens.less} +0 -0
- package/test/less-bom/calc.less +7 -0
- package/test/less-bom/css-grid.less +15 -0
- package/test/less-bom/detached-rulesets.less +2 -2
- package/test/less-bom/errors/color-invalid-hex-code.less +1 -0
- package/test/less-bom/errors/color-invalid-hex-code.txt +1 -1
- package/test/less-bom/errors/color-invalid-hex-code2.less +1 -0
- package/test/less-bom/errors/color-invalid-hex-code2.txt +1 -1
- package/test/less-bom/errors/import-missing.txt +1 -1
- package/test/less-bom/errors/plugin/plugin-error-2.js +5 -0
- package/test/less-bom/errors/plugin/plugin-error-3.js +5 -0
- package/test/less-bom/errors/plugin/plugin-error.js +1 -0
- package/test/less-bom/errors/plugin-1.less +1 -0
- package/test/less-bom/errors/plugin-1.txt +2 -0
- package/test/less-bom/errors/plugin-2.less +1 -0
- package/test/less-bom/errors/plugin-2.txt +5 -0
- package/test/less-bom/errors/plugin-3.less +1 -0
- package/test/less-bom/errors/plugin-3.txt +5 -0
- package/test/less-bom/functions.less +18 -0
- package/test/less-bom/import-module.less +3 -0
- package/test/less-bom/import.less +0 -2
- package/test/less-bom/legacy/legacy.less +1 -1
- package/test/less-bom/media.less +2 -2
- package/test/less-bom/merge.less +6 -3
- package/test/less-bom/plugin/plugin-collection.js +9 -0
- package/test/less-bom/plugin/plugin-local.js +2 -2
- package/test/less-bom/plugin/plugin-scope1.js +3 -0
- package/test/less-bom/plugin/plugin-scope2.js +3 -0
- package/test/less-bom/plugin/plugin-simple.js +7 -0
- package/test/less-bom/plugin/plugin-tree-nodes.js +33 -31
- package/test/less-bom/plugin-module.less +7 -0
- package/test/less-bom/plugin.less +33 -3
- package/test/less-bom/property-accessors.less +67 -0
- package/test/less-bom/root-registry/file.less +1 -0
- package/test/less-bom/root-registry/root.less +3 -0
- package/test/less-bom/{css.less → strict-math/css.less} +0 -0
- package/test/less-bom/{mixins-args.less → strict-math/mixins-args.less} +0 -0
- package/test/less-bom/{parens.less → strict-math/parens.less} +0 -0
- package/test/less-test.js +75 -17
- package/test/modify-vars.js +1 -1
- package/test/plugins/visitor/index.js +1 -1
- package/.jscsrc +0 -73
- package/.jshintrc +0 -11
- package/lib/less/tree/alpha.js +0 -28
- package/lib/less/tree/directive.js +0 -12
- package/lib/less/tree/rule.js +0 -12
- package/test/less/errors/functions-2-alpha.less +0 -2
- package/test/less/errors/functions-2-alpha.txt +0 -3
- package/test/less-bom/errors/functions-2-alpha.less +0 -2
- package/test/less-bom/errors/functions-2-alpha.txt +0 -3
- package/test/sourcemaps/maps/import-map.map +0 -1
package/lib/less-rhino/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* jshint rhino:true, unused: false */
|
|
2
|
-
/*
|
|
3
|
-
/*global name:true, less, loadStyleSheet, os */
|
|
2
|
+
/* global name:true, less, loadStyleSheet, os */
|
|
4
3
|
|
|
5
4
|
function formatError(ctx, options) {
|
|
6
5
|
options = options || {};
|
|
@@ -9,7 +8,7 @@ function formatError(ctx, options) {
|
|
|
9
8
|
var extract = ctx.extract;
|
|
10
9
|
var error = [];
|
|
11
10
|
|
|
12
|
-
//
|
|
11
|
+
// var stylize = options.color ? require('./lessc_helper').stylize : function (str) { return str; };
|
|
13
12
|
var stylize = function (str) { return str; };
|
|
14
13
|
|
|
15
14
|
// only output a stack if it isn't a less error
|
|
@@ -81,7 +80,7 @@ function loadStyleSheet(sheet, callback, reload, remaining) {
|
|
|
81
80
|
}
|
|
82
81
|
try {
|
|
83
82
|
callback(e, root, input, sheet, { local: false, lastModified: 0, remaining: remaining }, sheetName);
|
|
84
|
-
} catch(e) {
|
|
83
|
+
} catch (e) {
|
|
85
84
|
writeError(e);
|
|
86
85
|
}
|
|
87
86
|
});
|
|
@@ -146,25 +145,10 @@ function writeFile(filename, content) {
|
|
|
146
145
|
// Command line integration via Rhino
|
|
147
146
|
(function (args) {
|
|
148
147
|
|
|
149
|
-
var options =
|
|
150
|
-
|
|
151
|
-
compress: false,
|
|
152
|
-
cleancss: false,
|
|
153
|
-
max_line_len: -1,
|
|
154
|
-
silent: false,
|
|
155
|
-
verbose: false,
|
|
156
|
-
lint: false,
|
|
157
|
-
paths: [],
|
|
158
|
-
color: true,
|
|
159
|
-
strictImports: false,
|
|
160
|
-
rootpath: '',
|
|
161
|
-
relativeUrls: false,
|
|
162
|
-
ieCompat: true,
|
|
163
|
-
strictMath: false,
|
|
164
|
-
strictUnits: false
|
|
165
|
-
};
|
|
148
|
+
var options = require('../default-options');
|
|
149
|
+
|
|
166
150
|
var continueProcessing = true,
|
|
167
|
-
|
|
151
|
+
currentErrorcode;
|
|
168
152
|
|
|
169
153
|
var checkArgFunc = function(arg, option) {
|
|
170
154
|
if (!option) {
|
|
@@ -226,8 +210,8 @@ function writeFile(filename, content) {
|
|
|
226
210
|
break;
|
|
227
211
|
case 'h':
|
|
228
212
|
case 'help':
|
|
229
|
-
|
|
230
|
-
//
|
|
213
|
+
// TODO
|
|
214
|
+
// require('../lib/less/lessc_helper').printUsage();
|
|
231
215
|
continueProcessing = false;
|
|
232
216
|
break;
|
|
233
217
|
case 'x':
|
|
@@ -270,7 +254,7 @@ function writeFile(filename, content) {
|
|
|
270
254
|
.split(os.type().match(/Windows/) ? /:(?!\\)|;/ : ':')
|
|
271
255
|
.map(function(p) {
|
|
272
256
|
if (p) {
|
|
273
|
-
//
|
|
257
|
+
// return path.resolve(process.cwd(), p);
|
|
274
258
|
return p;
|
|
275
259
|
}
|
|
276
260
|
});
|
|
@@ -351,20 +335,20 @@ function writeFile(filename, content) {
|
|
|
351
335
|
|
|
352
336
|
var name = args[0];
|
|
353
337
|
if (name && name != '-') {
|
|
354
|
-
//
|
|
338
|
+
// name = path.resolve(process.cwd(), name);
|
|
355
339
|
}
|
|
356
340
|
var output = args[1];
|
|
357
341
|
var outputbase = args[1];
|
|
358
342
|
if (output) {
|
|
359
343
|
options.sourceMapOutputFilename = output;
|
|
360
|
-
//
|
|
344
|
+
// output = path.resolve(process.cwd(), output);
|
|
361
345
|
if (warningMessages) {
|
|
362
346
|
console.log(warningMessages);
|
|
363
347
|
}
|
|
364
348
|
}
|
|
365
349
|
|
|
366
|
-
//
|
|
367
|
-
//
|
|
350
|
+
// options.sourceMapBasepath = process.cwd();
|
|
351
|
+
// options.sourceMapBasepath = '';
|
|
368
352
|
|
|
369
353
|
if (options.sourceMap === true) {
|
|
370
354
|
console.log("output: " + output);
|
|
@@ -382,24 +366,25 @@ function writeFile(filename, content) {
|
|
|
382
366
|
console.log("lessc: no inout files");
|
|
383
367
|
console.log("");
|
|
384
368
|
// TODO
|
|
385
|
-
//
|
|
369
|
+
// require('../lib/less/lessc_helper').printUsage();
|
|
386
370
|
currentErrorcode = 1;
|
|
387
371
|
return;
|
|
388
372
|
}
|
|
389
373
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
374
|
+
/*
|
|
375
|
+
var ensureDirectory = function (filepath) {
|
|
376
|
+
var dir = path.dirname(filepath),
|
|
377
|
+
cmd,
|
|
378
|
+
existsSync = fs.existsSync || path.existsSync;
|
|
379
|
+
if (!existsSync(dir)) {
|
|
380
|
+
if (mkdirp === undefined) {
|
|
381
|
+
try {mkdirp = require('mkdirp');}
|
|
382
|
+
catch(e) { mkdirp = null; }
|
|
383
|
+
}
|
|
384
|
+
cmd = mkdirp && mkdirp.sync || fs.mkdirSync;
|
|
385
|
+
cmd(dir);
|
|
386
|
+
}
|
|
387
|
+
}; */
|
|
403
388
|
|
|
404
389
|
if (options.depends) {
|
|
405
390
|
if (!outputbase) {
|
|
@@ -443,7 +428,7 @@ function writeFile(filename, content) {
|
|
|
443
428
|
}
|
|
444
429
|
});
|
|
445
430
|
}
|
|
446
|
-
catch(e) {
|
|
431
|
+
catch (e) {
|
|
447
432
|
writeError(e, options);
|
|
448
433
|
quit(1);
|
|
449
434
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Leaner CSS",
|
|
5
5
|
"homepage": "http://lesscss.org",
|
|
6
6
|
"author": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"browser": "./dist/less.js",
|
|
36
36
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
37
|
+
"node": ">=4"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"test": "grunt test"
|
|
@@ -43,26 +43,32 @@
|
|
|
43
43
|
"errno": "^0.1.1",
|
|
44
44
|
"graceful-fs": "^4.1.2",
|
|
45
45
|
"image-size": "~0.5.0",
|
|
46
|
-
"mime": "^1.
|
|
46
|
+
"mime": "^1.4.1",
|
|
47
47
|
"mkdirp": "^0.5.0",
|
|
48
48
|
"promise": "^7.1.1",
|
|
49
|
-
"source-map": "^0.5.3"
|
|
49
|
+
"source-map": "^0.5.3",
|
|
50
|
+
"request": "2.81.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"diff": "^
|
|
53
|
+
"diff": "^3.2.0",
|
|
54
|
+
"git-rev": "^0.2.1",
|
|
53
55
|
"grunt": "~0.4.5",
|
|
54
56
|
"grunt-browserify": "^5.0.0",
|
|
55
57
|
"grunt-contrib-clean": "^1.0.0",
|
|
56
58
|
"grunt-contrib-concat": "^1.0.1",
|
|
57
59
|
"grunt-contrib-connect": "^1.0.2",
|
|
58
60
|
"grunt-contrib-jasmine": "^1.0.3",
|
|
59
|
-
"grunt-contrib-jshint": "^1.0.0",
|
|
60
61
|
"grunt-contrib-uglify": "^1.0.1",
|
|
61
|
-
"grunt-
|
|
62
|
-
"grunt-saucelabs": "^
|
|
62
|
+
"grunt-eslint": "^19.0.0",
|
|
63
|
+
"grunt-saucelabs": "^9.0.0",
|
|
63
64
|
"grunt-shell": "^1.3.0",
|
|
65
|
+
"import-module": "file:test/import-module",
|
|
64
66
|
"jit-grunt": "^0.10.0",
|
|
67
|
+
"less-plugin-clean-css": "^1.5.1",
|
|
68
|
+
"performance-now": "^0.2.0",
|
|
65
69
|
"phantomjs-prebuilt": "^2.1.7",
|
|
70
|
+
"phin": "^2.2.3",
|
|
71
|
+
"promise": "^7.1.1",
|
|
66
72
|
"time-grunt": "^1.3.0"
|
|
67
73
|
},
|
|
68
74
|
"keywords": [
|
|
@@ -91,5 +97,6 @@
|
|
|
91
97
|
"css less"
|
|
92
98
|
],
|
|
93
99
|
"rawcurrent": "https://raw.github.com/less/less.js/v",
|
|
94
|
-
"sourcearchive": "https://github.com/less/less.js/archive/v"
|
|
100
|
+
"sourcearchive": "https://github.com/less/less.js/archive/v",
|
|
101
|
+
"dependencies": {}
|
|
95
102
|
}
|
package/test/browser/common.js
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
1
|
/* Add js reporter for sauce */
|
|
2
|
-
|
|
3
2
|
jasmine.getEnv().addReporter(new jasmine.JSReporter2());
|
|
4
3
|
jasmine.getEnv().defaultTimeoutInterval = 3000;
|
|
5
4
|
|
|
5
|
+
// From https://github.com/axemclion/grunt-saucelabs/issues/109#issuecomment-166767282
|
|
6
|
+
// (function () {
|
|
7
|
+
// var oldJSReport = window.jasmine.getJSReport;
|
|
8
|
+
// window.jasmine.getJSReport = function () {
|
|
9
|
+
// var results = oldJSReport();
|
|
10
|
+
// if (results) {
|
|
11
|
+
// return {
|
|
12
|
+
// durationSec: results.durationSec,
|
|
13
|
+
// suites: removePassingTests(results.suites),
|
|
14
|
+
// passed: results.passed
|
|
15
|
+
// };
|
|
16
|
+
// } else {
|
|
17
|
+
// return null;
|
|
18
|
+
// }
|
|
19
|
+
// };
|
|
20
|
+
|
|
21
|
+
// function removePassingTests (suites) {
|
|
22
|
+
// return suites.filter(specFailed)
|
|
23
|
+
// .map(mapSuite);
|
|
24
|
+
// }
|
|
25
|
+
|
|
26
|
+
// function mapSuite (suite) {
|
|
27
|
+
// var result = {};
|
|
28
|
+
// for (var s in suite) {
|
|
29
|
+
// result[s] = suite[s];
|
|
30
|
+
// }
|
|
31
|
+
// result.specs = suite.specs.filter(specFailed);
|
|
32
|
+
// result.suites = removePassingTests(suite.suites);
|
|
33
|
+
// return result;
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
// function specFailed (item) {
|
|
37
|
+
// return !item.passed;
|
|
38
|
+
// }
|
|
39
|
+
// })();
|
|
6
40
|
/* record log messages for testing */
|
|
7
41
|
|
|
8
42
|
var logMessages = [];
|
|
@@ -45,15 +79,15 @@ less.loggers = [
|
|
|
45
79
|
}
|
|
46
80
|
];
|
|
47
81
|
|
|
48
|
-
|
|
82
|
+
testLessEqualsInDocument = function () {
|
|
49
83
|
testLessInDocument(testSheet);
|
|
50
84
|
};
|
|
51
85
|
|
|
52
|
-
|
|
86
|
+
testLessErrorsInDocument = function (isConsole) {
|
|
53
87
|
testLessInDocument(isConsole ? testErrorSheetConsole : testErrorSheet);
|
|
54
88
|
};
|
|
55
89
|
|
|
56
|
-
|
|
90
|
+
testLessInDocument = function (testFunc) {
|
|
57
91
|
var links = document.getElementsByTagName('link'),
|
|
58
92
|
typePattern = /^text\/(x-)?less$/;
|
|
59
93
|
|
|
@@ -65,7 +99,7 @@ var testLessInDocument = function (testFunc) {
|
|
|
65
99
|
}
|
|
66
100
|
};
|
|
67
101
|
|
|
68
|
-
|
|
102
|
+
ieFormat = function(text) {
|
|
69
103
|
var styleNode = document.createElement('style');
|
|
70
104
|
styleNode.setAttribute('type', 'text/css');
|
|
71
105
|
var headNode = document.getElementsByTagName('head')[0];
|
|
@@ -84,7 +118,7 @@ var ieFormat = function(text) {
|
|
|
84
118
|
return transformedText;
|
|
85
119
|
};
|
|
86
120
|
|
|
87
|
-
|
|
121
|
+
testSheet = function (sheet) {
|
|
88
122
|
it(sheet.id + " should match the expected output", function (done) {
|
|
89
123
|
var lessOutputId = sheet.id.replace("original-", ""),
|
|
90
124
|
expectedOutputId = "expected-" + lessOutputId,
|
|
@@ -113,7 +147,7 @@ var testSheet = function (sheet) {
|
|
|
113
147
|
});
|
|
114
148
|
};
|
|
115
149
|
|
|
116
|
-
//TODO: do it cleaner - the same way as in css
|
|
150
|
+
// TODO: do it cleaner - the same way as in css
|
|
117
151
|
|
|
118
152
|
function extractId(href) {
|
|
119
153
|
return href.replace(/^[a-z-]+:\/+?[^\/]+/i, '') // Remove protocol & domain
|
|
@@ -123,7 +157,7 @@ function extractId(href) {
|
|
|
123
157
|
.replace(/\./g, ':'); // Replace dots with colons(for valid id)
|
|
124
158
|
}
|
|
125
159
|
|
|
126
|
-
|
|
160
|
+
waitFor = function (waitFunc) {
|
|
127
161
|
return new Promise(function (resolve) {
|
|
128
162
|
var timeoutId = setInterval(function () {
|
|
129
163
|
if (waitFunc()) {
|
|
@@ -134,7 +168,7 @@ var waitFor = function (waitFunc) {
|
|
|
134
168
|
});
|
|
135
169
|
};
|
|
136
170
|
|
|
137
|
-
|
|
171
|
+
testErrorSheet = function (sheet) {
|
|
138
172
|
it(sheet.id + " should match an error", function (done) {
|
|
139
173
|
var lessHref = sheet.href,
|
|
140
174
|
id = "less-error-message:" + extractId(lessHref),
|
|
@@ -148,7 +182,7 @@ var testErrorSheet = function (sheet) {
|
|
|
148
182
|
actualErrorElement = document.getElementById(id);
|
|
149
183
|
return actualErrorElement !== null;
|
|
150
184
|
}).then(function () {
|
|
151
|
-
|
|
185
|
+
var innerText = (actualErrorElement.innerHTML
|
|
152
186
|
.replace(/<h3>|<\/?p>|<a href="[^"]*">|<\/a>|<ul>|<\/?pre( class="?[^">]*"?)?>|<\/li>|<\/?label>/ig, "")
|
|
153
187
|
.replace(/<\/h3>/ig, " ")
|
|
154
188
|
.replace(/<li>|<\/ul>|<br>/ig, "\n"))
|
|
@@ -156,34 +190,36 @@ var testErrorSheet = function (sheet) {
|
|
|
156
190
|
// for IE8
|
|
157
191
|
.replace(/\r\n/g, "\n")
|
|
158
192
|
.replace(/\. \nin/, ". in");
|
|
159
|
-
|
|
193
|
+
actualErrorMsg = innerText
|
|
160
194
|
.replace(/\n\d+/g, function (lineNo) {
|
|
161
195
|
return lineNo + " ";
|
|
162
196
|
})
|
|
163
197
|
.replace(/\n\s*in /g, " in ")
|
|
164
198
|
.replace(/\n{2,}/g, "\n")
|
|
165
199
|
.replace(/\nStack Trace\n[\s\S]*/i, "")
|
|
166
|
-
.replace(/\n$/, "")
|
|
167
|
-
|
|
200
|
+
.replace(/\n$/, "")
|
|
201
|
+
.trim();
|
|
202
|
+
errorFile
|
|
168
203
|
.then(function (errorTxt) {
|
|
169
204
|
errorTxt = errorTxt
|
|
170
205
|
.replace(/\{path\}/g, "")
|
|
171
206
|
.replace(/\{pathrel\}/g, "")
|
|
172
207
|
.replace(/\{pathhref\}/g, "http://localhost:8081/test/less/errors/")
|
|
173
208
|
.replace(/\{404status\}/g, " (404)")
|
|
174
|
-
.replace(/\{node\}
|
|
175
|
-
.replace(/\n$/, "")
|
|
209
|
+
.replace(/\{node\}[\s\S]*\{\/node\}/g, "")
|
|
210
|
+
.replace(/\n$/, "")
|
|
211
|
+
.trim();
|
|
176
212
|
expect(actualErrorMsg).toEqual(errorTxt);
|
|
177
213
|
if (errorTxt == actualErrorMsg) {
|
|
178
214
|
actualErrorElement.style.display = "none";
|
|
179
215
|
}
|
|
180
216
|
done();
|
|
181
217
|
});
|
|
182
|
-
|
|
218
|
+
});
|
|
183
219
|
});
|
|
184
220
|
};
|
|
185
221
|
|
|
186
|
-
|
|
222
|
+
testErrorSheetConsole = function (sheet) {
|
|
187
223
|
it(sheet.id + " should match an error", function (done) {
|
|
188
224
|
var lessHref = sheet.href,
|
|
189
225
|
id = sheet.id.replace(/^original-less:/, "less-error-message:"),
|
|
@@ -212,7 +248,7 @@ var testErrorSheetConsole = function (sheet) {
|
|
|
212
248
|
});
|
|
213
249
|
};
|
|
214
250
|
|
|
215
|
-
|
|
251
|
+
loadFile = function (href) {
|
|
216
252
|
return new Promise(function (resolve, reject) {
|
|
217
253
|
var request = new XMLHttpRequest();
|
|
218
254
|
request.open('GET', href, true);
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* @param startMs Start time in Milliseconds
|
|
43
43
|
* @param finishMs Finish time in Milliseconds
|
|
44
44
|
* @return Elapsed time in Seconds */
|
|
45
|
-
function elapsedSec
|
|
45
|
+
function elapsedSec(startMs, finishMs) {
|
|
46
46
|
return (finishMs - startMs) / 1000;
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
* @param amount Amount to round
|
|
53
53
|
* @param numOfDecDigits Number of Digits to round to. Default value is '2'.
|
|
54
54
|
* @return Rounded amount */
|
|
55
|
-
function round
|
|
55
|
+
function round(amount, numOfDecDigits) {
|
|
56
56
|
numOfDecDigits = numOfDecDigits || 2;
|
|
57
57
|
return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits);
|
|
58
58
|
}
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
* Create a new array which contains only the failed items.
|
|
62
62
|
* @param items Items which will be filtered
|
|
63
63
|
* @returns {Array} of failed items */
|
|
64
|
-
function failures
|
|
64
|
+
function failures(items) {
|
|
65
65
|
var fs = [], i, v;
|
|
66
66
|
for (i = 0; i < items.length; i += 1) {
|
|
67
67
|
v = items[i];
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
* Collect information about a Suite, recursively, and return a JSON result.
|
|
77
77
|
* @param suite The Jasmine Suite to get data from
|
|
78
78
|
*/
|
|
79
|
-
function getSuiteData
|
|
79
|
+
function getSuiteData(suite) {
|
|
80
80
|
var suiteData = {
|
|
81
81
|
description : suite.description,
|
|
82
82
|
durationSec : 0,
|