Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add test for 3-values border-radius #49

Merged
merged 1 commit into from
Oct 23, 2017
Merged

Conversation

Krinkle
Copy link
Member

@Krinkle Krinkle commented Oct 23, 2017

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.

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.
@@ -29,7 +30,7 @@ module.exports = function ( grunt ) {
output
);

if ( !noop ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were we never setting noop, then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we were and still are. On line 20. A test case's first value is the input, and the optional second value is the expected output after flipping. If no second value is provided (which we do in quite a few cases), then we simply assert the value is not affected by flipping (e.g. non-flippable properties and things like @noflip). In those cases, no need for a roundtrip given it would be the same assertion.

By default, we always roundtrip if the test isn't noop. But this commit introduces the ability to disable roundtrip.

@jdforrester jdforrester merged commit 9131d63 into master Oct 23, 2017
@jdforrester jdforrester deleted the unit/border-radius branch October 23, 2017 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants