Skip to content

Commit 9131d63

Browse files
Krinklejdforrester
authored andcommitted
test: Add test for 3-values border-radius (#49)
Should help increase the code coverage and overall stability. This wasn't previously done because the test runner insisted on roundtripping all test cases, which isn't possible in this case. > input: 1px 2px 3px -> output: 2px 1px 2px 3px > // Same as: > input: 1px 2px 3px 2px -> output: 2px 1px 2px 3px and: > input: 2px 1px 2px 3px -> output: 1px 2px 3px 2px > // of which the output is effectively the same as "1px 2px 3px" When 3 values are given in CSS, the fourth value is implied to be the same as the second value: > (top, [right=top], [bottom=top], [left=right]) Add a "roundtrip" setting to disable roundtripping where needed.
1 parent 4457e78 commit 9131d63

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

build/tasks/unit.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = function ( grunt ) {
77
testData = require( '../../test/data.json' ),
88
failures = 0,
99
tests = 0,
10-
name, test, args, i, input, noop, output;
10+
name, test, args, i, input, noop, roundtrip, output;
1111

1212
for ( name in testData ) {
1313
tests++;
@@ -19,6 +19,7 @@ module.exports = function ( grunt ) {
1919
input = test.cases[ i ][ 0 ];
2020
noop = test.cases[ i ][ 1 ] === undefined;
2121
output = noop ? input : test.cases[ i ][ 1 ];
22+
roundtrip = test.roundtrip !== undefined ? test.roundtrip : !noop;
2223

2324
assert.equal(
2425
cssjanus.transform(
@@ -29,7 +30,7 @@ module.exports = function ( grunt ) {
2930
output
3031
);
3132

32-
if ( !noop ) {
33+
if ( roundtrip ) {
3334
// Round-trip
3435
assert.equal(
3536
cssjanus.transform(

test/data.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,15 @@
391391
]
392392
]
393393
},
394+
"flip border-radius (one-way)": {
395+
"roundtrip": false,
396+
"cases": [
397+
[
398+
".foo { border-radius: 1px 2px 3px; }",
399+
".foo { border-radius: 2px 1px 2px 3px; }"
400+
]
401+
]
402+
},
394403
"flip border-top-{edge}-radius": {
395404
"cases": [
396405
[

0 commit comments

Comments
 (0)