-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[css-values] Add tests for basic min() / max() support #19819
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title> | ||
CSS Values and Units Test: | ||
attr() in max() | ||
</title> | ||
<meta name="assert" content=" | ||
The attr() function notation is allowed inside a max() notation. | ||
" /> | ||
|
||
<link | ||
rel="author" | ||
title="Fuqiao Xue" | ||
href="mailto:[email protected]" | ||
/> | ||
|
||
<link rel="help" href="https://drafts.csswg.org/css-values/#attr-notation"/> | ||
|
||
<link rel="help" href="https://drafts.csswg.org/css-values/#calc-notation"/> | ||
|
||
<link | ||
rel="match" | ||
href="reference/200-200-green.html" | ||
/> | ||
|
||
<style> | ||
|
||
html, body { margin: 0px; padding: 0px; } | ||
|
||
html { background: white; overflow: hidden; } | ||
#outer { position: relative; background: green; } | ||
|
||
#outer { width: max(attr(data-test length)); height: 200px; } | ||
|
||
</style> | ||
|
||
</head> | ||
<body> | ||
|
||
<div id="outer" data-test="200px"></div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title> | ||
CSS Values and Units Test: | ||
calc() in max() | ||
</title> | ||
<meta name="assert" content=" | ||
The calc() function notation is allowed inside a max() notation. | ||
" /> | ||
|
||
<link | ||
rel="author" | ||
title="Fuqiao Xue" | ||
href="mailto:[email protected]" | ||
/> | ||
|
||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-syntax"/> | ||
|
||
<link | ||
rel="match" | ||
href="reference/all-green.html" | ||
/> | ||
|
||
<style> | ||
|
||
html, body { margin: 0px; padding: 0px; } | ||
|
||
html { background: red; overflow: hidden; } | ||
#outer { position: absolute; top: 0px; left: 0px; background: green; width: 100%; } | ||
|
||
#outer { height: max(calc(100%)); } | ||
|
||
</style> | ||
|
||
</head> | ||
<body> | ||
|
||
<div id="outer"></div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title> | ||
CSS Values and Units Test: | ||
max() with 20 arguments | ||
</title> | ||
<meta name="assert" content=" | ||
UAs must support math function expressions of at least 20 terms. | ||
" /> | ||
|
||
<link | ||
rel="author" | ||
title="Fuqiao Xue" | ||
href="mailto:[email protected]" | ||
/> | ||
|
||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-syntax"/> | ||
|
||
<link | ||
rel="match" | ||
href="reference/all-green.html" | ||
/> | ||
|
||
<style> | ||
|
||
html, body { margin: 0px; padding: 0px; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is indented very deeply. It's probably best to replace tabs with spaces so that we're all seeing the same thing, since tabs can be any number of spaces... |
||
|
||
html { background: red; overflow: hidden; } | ||
#outer { position: absolute; top: 0px; left: 0px; background: green; width: 100%; } | ||
|
||
#outer { height: max(5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 55%, 60%, 65%, 70%, 75%, 80%, 85%, 90%, 95%, 100%); } | ||
|
||
</style> | ||
|
||
</head> | ||
<body> | ||
|
||
<div id="outer"></div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title> | ||
CSS Values and Units Test: | ||
min() with unitless 0 | ||
</title> | ||
<meta name="assert" content=" | ||
Unitless 0 isn't supported in math functions. | ||
" /> | ||
|
||
<link | ||
rel="author" | ||
title="Fuqiao Xue" | ||
href="mailto:[email protected]" | ||
/> | ||
|
||
<link rel="help" href="https://drafts.csswg.org/css-values/#calc-type-checking"/> | ||
|
||
<link | ||
rel="match" | ||
href="reference/all-green.html" | ||
/> | ||
|
||
<style> | ||
|
||
html, body { margin: 0px; padding: 0px; } | ||
|
||
html { background: red; overflow: hidden; } | ||
#outer { position: absolute; top: 0px; left: 0px; background: green; width: 100%; } | ||
|
||
#outer { | ||
/* Assert that min() is supported */ | ||
height: min(100%); | ||
|
||
/* The min() expression (thus the declaration) should be invalid */ | ||
height: min(0, 100%); | ||
} | ||
|
||
</style> | ||
|
||
</head> | ||
<body> | ||
|
||
<div id="outer"></div> | ||
|
||
</body> | ||
</html> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you compact the markup up a bit? The "INDENT TABS" lint rule is disabled for this directory and there's no rules for indentation, but the more compact style of 076ec51 or 07c52e7 (the two most recent commits in this directory) would be great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@foolip Just pushed a commit to compact the markup. Thanks!