mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'
This commit is contained in:
parent
ace9b32b1c
commit
df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions
|
@ -2,22 +2,12 @@
|
|||
<meta charset="utf-8">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="support/utils.js"></script>
|
||||
|
||||
<link rel=stylesheet href=stylesheet.py>
|
||||
<link rel=stylesheet media="screen and (max-width:10px)" href=stylesheet.py?stylesNotMatchingEnvironment&delay=2>
|
||||
<h1>Dominic Farolino</h1>
|
||||
<script>
|
||||
function styleExists(styleText) {
|
||||
for (let styleRule of document.styleSheets) {
|
||||
let currentStyleText = styleRule.cssRules["0"].cssText;
|
||||
if (currentStyleText == styleText) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
test(() => {
|
||||
const h1 = document.querySelector('h1');
|
||||
const computedColor = getComputedStyle(h1).color;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Script-created render-blocking link stylesheet is not script-blocking</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/utils.js"></script>
|
||||
<script>
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = 'stylesheet.py?delay=1';
|
||||
link.blocking = 'render';
|
||||
document.head.appendChild(link);
|
||||
</script>
|
||||
<h1>Some text</h1>
|
||||
<script>
|
||||
test(() => {
|
||||
assert_false(styleExists("h1 { color: purple; }"),
|
||||
'stylesheet should still be pending');
|
||||
const h1 = document.querySelector('h1');
|
||||
assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Script-created render-blocking style element is not script-blocking</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/utils.js"></script>
|
||||
<script>
|
||||
const style = document.createElement('style');
|
||||
const sheet = document.createTextNode('@import url(stylesheet.py?delay=1);');
|
||||
style.appendChild(sheet);
|
||||
style.blocking = 'render';
|
||||
document.head.appendChild(style);
|
||||
</script>
|
||||
<h1>Some text</h1>
|
||||
<script>
|
||||
test(() => {
|
||||
assert_false(styleExists("h1 { color: purple; }"),
|
||||
'stylesheet should still be pending');
|
||||
const h1 = document.querySelector('h1');
|
||||
assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Script-created link stylesheet is not script-blocking</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/utils.js"></script>
|
||||
<script>
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = 'stylesheet.py?delay=1';
|
||||
document.head.appendChild(link);
|
||||
</script>
|
||||
<h1>Some text</h1>
|
||||
<script>
|
||||
test(() => {
|
||||
assert_false(styleExists("h1 { color: purple; }"),
|
||||
'stylesheet should still be pending');
|
||||
const h1 = document.querySelector('h1');
|
||||
assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Script-created style element is not script-blocking</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/utils.js"></script>
|
||||
<script>
|
||||
const style = document.createElement('style');
|
||||
const sheet = document.createTextNode('@import url(stylesheet.py?delay=1);');
|
||||
style.appendChild(sheet);
|
||||
document.head.appendChild(style);
|
||||
</script>
|
||||
<h1>Some text</h1>
|
||||
<script>
|
||||
test(() => {
|
||||
assert_false(styleExists("h1 { color: purple; }"),
|
||||
'stylesheet should still be pending');
|
||||
const h1 = document.querySelector('h1');
|
||||
assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Style element is script-blocking when media matches</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/utils.js"></script>
|
||||
<style>
|
||||
@import url('stylesheet.py?delay=1');
|
||||
</style>
|
||||
<h1>Some text</h1>
|
||||
<script>
|
||||
test(() => {
|
||||
assert_true(styleExists("h1 { color: purple; }"),
|
||||
'script should be blocked until the stylesheet is loaded');
|
||||
const h1 = document.querySelector('h1');
|
||||
assert_equals(getComputedStyle(h1).color, 'rgb(128, 0, 128)');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Style element is not script-blocking when media doesn't match</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/utils.js"></script>
|
||||
<style media="print">
|
||||
@import url('stylesheet.py?delay=1');
|
||||
</style>
|
||||
<h1>Some text</h1>
|
||||
<script>
|
||||
test(() => {
|
||||
assert_false(styleExists("h1 { color: purple; }"),
|
||||
'stylesheet should still be pending');
|
||||
const h1 = document.querySelector('h1');
|
||||
assert_equals(getComputedStyle(h1).color, 'rgb(0, 0, 0)');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,20 @@
|
|||
function styleExistsInSheet(styleText, sheet) {
|
||||
for (let rule of sheet.cssRules) {
|
||||
if (styleText == rule.cssText)
|
||||
return true;
|
||||
if (rule instanceof CSSImportRule) {
|
||||
if (rule.styleSheet && styleExistsInSheet(styleText, rule.styleSheet))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function styleExists(styleText) {
|
||||
for (let sheet of document.styleSheets) {
|
||||
if (styleExistsInSheet(styleText, sheet))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<title>Change color-scheme meta tag affecting normal descendant</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#meta-color-scheme">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<meta id="meta" name="color-scheme" content="dark">
|
||||
<div style="color-scheme: dark; color: CanvasText" id="dark">
|
||||
<div style="color-scheme: normal; color: CanvasText" id="normal"></div>
|
||||
</div>
|
||||
<script>
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(dark).color, getComputedStyle(normal).color);
|
||||
}, "Normal initially dark");
|
||||
|
||||
meta.content = "light";
|
||||
|
||||
test(() => {
|
||||
assert_not_equals(getComputedStyle(dark).color, getComputedStyle(normal).color);
|
||||
}, "Normal should change to light from page color schemes");
|
||||
</script>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<title>The 'load' event on the style element should still fire after mutation</title>
|
||||
<link rel="help" href="https://crbug.com/1323319">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
promise_test(async () => {
|
||||
const style = document.createElement('style');
|
||||
document.head.appendChild(style);
|
||||
style.appendChild(document.createTextNode('@import url(/support/css-red.txt);'));
|
||||
style.appendChild(document.createTextNode('body {color: green; }'));
|
||||
|
||||
// The 'load' event should fire.
|
||||
await new Promise(resolve => style.onload = resolve);
|
||||
});
|
||||
</script>
|
|
@ -5,29 +5,24 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<style id=target onload="load()">
|
||||
.box { color:red; }
|
||||
</style>
|
||||
<div class='box'></div>
|
||||
<div id="log"></div>
|
||||
|
||||
<script>
|
||||
var loadCount = 0;
|
||||
function load() { loadCount++; }
|
||||
</script>
|
||||
|
||||
function styleLoad() {
|
||||
return new Promise((resolve) => {
|
||||
document.getElementById('target').addEventListener('load', () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
<style id=target onload="load()">
|
||||
.box { color:red; }
|
||||
</style>
|
||||
<div class='box'>Box</div>
|
||||
|
||||
<script>
|
||||
window.onload = () => {
|
||||
const target = document.getElementById('target');
|
||||
promise_test(async t => {
|
||||
await styleLoad();
|
||||
assert_equals(loadCount,1,"Style element should have loaded once by now");
|
||||
target.textContent = `.box { color: green; }`;
|
||||
await styleLoad();
|
||||
await new Promise(resolve => target.addEventListener('load', resolve));
|
||||
assert_equals(loadCount,2,"Style element should fire the load event when textContent changes");
|
||||
},"style load event should fire when textContent changed");
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue