Add strictUnits option, add tests for legacy behaviour

This commit is contained in:
Luke Page
2013-01-30 20:31:26 +00:00
parent 988d378922
commit 3ef22f16f9
13 changed files with 79 additions and 39 deletions

View File

@@ -0,0 +1,5 @@
.test-maths-and-units {
mix-units: 2px;
invalid-units: 1px;
test-division: 7em;
}

View File

@@ -31,13 +31,13 @@
.units {
width: 1px;
z-index: 1;
square-pixel: 1px;
odd-unit: 2em;
square-pixel-divided: 1px;
odd-unit: 2;
percentage: 500%;
pixels: 500px;
conversion-metric-a: 30mm;
conversion-metric-b: 3cm;
conversion-imperial: 3in;
custom-unit: 420cheeseburgers;
custom-unit: 420octocats;
custom-unit-cancelling: 2;
}

View File

@@ -59,6 +59,7 @@ runTestSet({dumpLineNumbers: 'all'}, "debug/", null,
function(name) { return name + '-all'; });
runTestSet({relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/");
runTestSet({compress: true}, "compression/");
runTestSet({strictUnits: false, strictMaths: false}, "legacy/");
function globalReplacements(input, directory) {
var p = path.join(process.cwd(), directory),

View File

@@ -0,0 +1,5 @@
.test-maths-and-units {
mix-units: 1px + 1em;
invalid-units: 1px * 1px;
test-division: 4 / 2 + 5em;
}

View File

@@ -136,7 +136,7 @@ body {
.slash-vs-math {
.border-radius();
.border-radius(5px/10px);
.border-radius((3px * 2px));
.border-radius((3px * 2));
}
// semi-colon vs comma for delimiting

View File

@@ -69,13 +69,13 @@
.units {
width: @onePixel;
z-index: (@onePixel / @onePixel);
square-pixel: (@onePixel * @onePixel * @onePixel / @onePixel);
odd-unit: (@onePixel * 4em / 2cm);
square-pixel-divided: (@onePixel * @onePixel / @onePixel);
odd-unit: unit((@onePixel * 4em / 2cm));
percentage: (10 * 50%);
pixels: (50px * 10);
conversion-metric-a: (20mm + 1cm);
conversion-metric-b: (1cm + 20mm);
conversion-imperial: (1in + 72pt + 6pc);
custom-unit: (42octocats * 10cheeseburgers);
custom-unit: (42octocats * 10);
custom-unit-cancelling: (8cats / 4cats);
}