mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Address review comments
This commit is contained in:
parent
5ac205b3e5
commit
cdae523cd4
8 changed files with 97 additions and 25 deletions
|
@ -299,6 +299,12 @@
|
|||
"url": "/_mozilla/mozilla/body_listener.html"
|
||||
}
|
||||
],
|
||||
"mozilla/calc.html": [
|
||||
{
|
||||
"path": "mozilla/calc.html",
|
||||
"url": "/_mozilla/mozilla/calc.html"
|
||||
}
|
||||
],
|
||||
"mozilla/caption.html": [
|
||||
{
|
||||
"path": "mozilla/caption.html",
|
||||
|
|
8
tests/wpt/mozilla/meta/mozilla/calc.html.ini
Normal file
8
tests/wpt/mozilla/meta/mozilla/calc.html.ini
Normal file
|
@ -0,0 +1,8 @@
|
|||
[calc.html]
|
||||
type: testharness
|
||||
[calc(1px + 1pt + 1pc + 1in + 1cm + 1mm)]
|
||||
expected: FAIL
|
||||
|
||||
[calc(0px + 0pt + 0pc + 0in + 0cm + 0mm + 0rem + 0em + 0ex + 0% + 0vw + 0vh + 0vmin + 0vmax)]
|
||||
expected: FAIL
|
||||
|
62
tests/wpt/mozilla/tests/mozilla/calc.html
Normal file
62
tests/wpt/mozilla/tests/mozilla/calc.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
#outer {
|
||||
width: 1000px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="outer">FOO<div id="inner"></div></div>
|
||||
<script>
|
||||
|
||||
var div = document.getElementById('inner');
|
||||
|
||||
var widthTests = [
|
||||
['calc(10px)', '10px', '10px'],
|
||||
|
||||
// Basic Arithmetic
|
||||
['calc(10px + 10px)', '20px', '20px'],
|
||||
['calc(10px - 5px)', '5px', '5px'],
|
||||
['calc(2 * 10px)', '20px', '20px'],
|
||||
['calc(10px / 2)', '5px', '5px'],
|
||||
|
||||
// Parse ok
|
||||
['calc(20px/2)', '10px', '10px'],
|
||||
['calc(10px*2)', '20px', '20px'],
|
||||
|
||||
// Parse errors - value left over from previous test
|
||||
['calc(10px-10px)', '20px', '20px'],
|
||||
['calc(5px+5px)', '20px', '20px'],
|
||||
|
||||
// Combining units
|
||||
['calc(10px + 10em)', 'calc(10em + 10px)', '170px'],
|
||||
['calc(10px + 10em - 10px)', 'calc(10em + 0px)', '160px'],
|
||||
|
||||
// Fold absolute units
|
||||
['calc(1px + 1pt + 1pc + 1in + 1cm + 1mm)', '155.88333333333333px', '155.88333333333333px'],
|
||||
|
||||
// Alphabetical order
|
||||
['calc(0px + 0pt + 0pc + 0in + 0cm + 0mm + 0rem + 0em + 0ex + 0% + 0vw + 0vh + 0vmin + 0vmax)',
|
||||
'calc(0em + 0ex + 0px + 0rem + 0vh + 0vmax + 0vmin + 0vw + 0%)',
|
||||
'0px'],
|
||||
|
||||
// Simplification
|
||||
['calc((2 - 1) * 10px)', '10px', '10px'],
|
||||
['calc(((3 - 1) * (8 + 4)) * 10px)', '240px', '240px'],
|
||||
['calc(5 * (20px / 2 + 7 * (3em + 12px/4 + (8 - 2) * 2rem)))', 'calc(105em + 155px + 420rem)', '8555px'],
|
||||
|
||||
];
|
||||
|
||||
widthTests.forEach(function(item) {
|
||||
test(function() {
|
||||
div.style.setProperty('width', item[0]);
|
||||
assert_equals(div.style.getPropertyValue('width'), item[1]);
|
||||
assert_equals(window.getComputedStyle(div).getPropertyValue('width'), item[2]);
|
||||
}, item[0]);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue