зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1696215 - Add basic parsing web platform tests for page-size r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D107085
This commit is contained in:
Родитель
04281bb9b8
Коммит
4924ceb1f9
|
@ -0,0 +1,3 @@
|
|||
[size-001.html]
|
||||
prefs: [layout.css.page-size.enabled:true]
|
||||
expected: FAIL
|
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="author" title="Mozilla" href="https://mozilla.org">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-page-3/#page-size-prop">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
@page{
|
||||
size: 640px 480px;
|
||||
}
|
||||
@page{
|
||||
size: 8.5in 11in;
|
||||
}
|
||||
@page{
|
||||
size: A4;
|
||||
}
|
||||
@page{
|
||||
size: 3in 10in;
|
||||
}
|
||||
@page{
|
||||
size: jis-B5;
|
||||
}
|
||||
@page{
|
||||
size: auto;
|
||||
}
|
||||
@page{
|
||||
size: landscape;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
const expectedSizes = [
|
||||
"640px 480px",
|
||||
"8.5in 11in",
|
||||
"a4",
|
||||
"3in 10in",
|
||||
"jis-b5",
|
||||
"auto",
|
||||
"landscape"
|
||||
];
|
||||
const sizePrefix = "size: ";
|
||||
|
||||
test(t => {
|
||||
assert_equals(document.styleSheets.length, 1);
|
||||
let styleSheet = document.styleSheets[0];
|
||||
assert_equals(styleSheet.rules.length, expectedSizes.length);
|
||||
for(let i = 0; i < expectedSizes.length; i++){
|
||||
let cssText = styleSheet.cssRules[i].style.cssText;
|
||||
assert_true(cssText.startsWith(sizePrefix));
|
||||
cssText = cssText.slice(sizePrefix.length);
|
||||
assert_equals(cssText, expectedSizes[i] + ";", "for rule " + i);
|
||||
}
|
||||
});
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче