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

[css-values] Add tests for basic min() / max() support #19819

Merged
merged 4 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions css/css-values/attr-in-max.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
Copy link
Member

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!

Copy link
Contributor Author

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!

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>
43 changes: 43 additions & 0 deletions css/css-values/calc-in-max.html
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>
43 changes: 43 additions & 0 deletions css/css-values/max-20-arguments.html
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; }
Copy link
Member

Choose a reason for hiding this comment

The 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>
49 changes: 49 additions & 0 deletions css/css-values/max-unitless-zero-invalid.html
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>