mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +01:00
Update web-platform-tests to revision b'ee6da9d71d0268d7fdb04e8e5b26858f46ee0cc4'
This commit is contained in:
parent
4401622eb1
commit
b77ad115f6
16832 changed files with 270819 additions and 87621 deletions
|
@ -0,0 +1,154 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Resolving @property name conflicts with cascade layers</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-cascade-5/#layering">
|
||||
<link rel="author" href="mailto:xiaochengh@chromium.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
#target, #reference {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
#reference {
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="target"></div>
|
||||
<div id="reference"></div>
|
||||
|
||||
<script>
|
||||
// In all tests, background color of #target should be green, same as #reference
|
||||
|
||||
const testCases = [
|
||||
{
|
||||
title: '@property unlayered overrides layered',
|
||||
style: `
|
||||
#target {
|
||||
background-color: var(--foo);
|
||||
}
|
||||
|
||||
@property --foo {
|
||||
syntax: '<color>';
|
||||
inherits: false;
|
||||
initial-value: green;
|
||||
}
|
||||
|
||||
@layer {
|
||||
@property --foo {
|
||||
syntax: '<color>';
|
||||
inherits: false;
|
||||
initial-value: red;
|
||||
}
|
||||
}
|
||||
`
|
||||
},
|
||||
|
||||
{
|
||||
title: '@property override between layers',
|
||||
style: `
|
||||
@layer base, override;
|
||||
|
||||
#target {
|
||||
background-color: var(--foo);
|
||||
}
|
||||
|
||||
@layer override {
|
||||
@property --foo {
|
||||
syntax: '<color>';
|
||||
inherits: false;
|
||||
initial-value: green;
|
||||
}
|
||||
}
|
||||
|
||||
@layer base {
|
||||
@property --foo {
|
||||
syntax: '<color>';
|
||||
inherits: false;
|
||||
initial-value: red;
|
||||
}
|
||||
}
|
||||
`
|
||||
},
|
||||
|
||||
{
|
||||
title: '@property override update with appended sheet 1',
|
||||
style: `
|
||||
@layer base, override;
|
||||
|
||||
#target {
|
||||
background-color: var(--foo);
|
||||
}
|
||||
|
||||
@layer override {
|
||||
@property --foo {
|
||||
syntax: '<color>';
|
||||
inherits: false;
|
||||
initial-value: green;
|
||||
}
|
||||
}
|
||||
`,
|
||||
append: `
|
||||
@layer base {
|
||||
@property --foo {
|
||||
syntax: '<color>';
|
||||
inherits: false;
|
||||
initial-value: red;
|
||||
}
|
||||
}
|
||||
`
|
||||
},
|
||||
|
||||
{
|
||||
title: '@property override update with appended sheet 2',
|
||||
style: `
|
||||
@layer base, override;
|
||||
|
||||
#target {
|
||||
background-color: var(--foo);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
@property --foo {
|
||||
syntax: '<color>';
|
||||
inherits: false;
|
||||
initial-value: red;
|
||||
}
|
||||
}
|
||||
`,
|
||||
append: `
|
||||
@layer override {
|
||||
@property --foo {
|
||||
syntax: '<color>';
|
||||
inherits: false;
|
||||
initial-value: green;
|
||||
}
|
||||
}
|
||||
`
|
||||
},
|
||||
];
|
||||
|
||||
for (let testCase of testCases) {
|
||||
var documentStyle = document.createElement('style');
|
||||
documentStyle.appendChild(document.createTextNode(testCase['style']));
|
||||
document.head.appendChild(documentStyle);
|
||||
|
||||
var appendedStyle;
|
||||
if (testCase['append']) {
|
||||
document.body.offsetLeft; // Force style update
|
||||
appendedStyle = document.createElement('style');
|
||||
appendedStyle.appendChild(document.createTextNode(testCase['append']));
|
||||
document.head.appendChild(appendedStyle);
|
||||
}
|
||||
|
||||
test(function () {
|
||||
assert_equals(getComputedStyle(target).backgroundColor,
|
||||
getComputedStyle(reference).backgroundColor);
|
||||
}, testCase['title']);
|
||||
|
||||
if (appendedStyle)
|
||||
appendedStyle.remove();
|
||||
documentStyle.remove();
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue