Update web-platform-tests to revision 993a932dca2b378a44dc55f4ee80812f65d8fb4e

This commit is contained in:
WPT Sync Bot 2020-02-20 08:20:07 +00:00
parent f5ff38b875
commit af74a5d2cf
331 changed files with 3327 additions and 3531 deletions

View file

@ -500,6 +500,85 @@ test(() => {
assert_equals(sheet.cssRules[0].cssText, redStyleTexts[1]);
}, 'CSSStyleSheet.replaceSync correctly updates the style of its adopters synchronously');
test(() => {
// Attach a div inside a shadow root with the class ".red".
const span = document.createElement("span");
thirdSection.appendChild(span);
const shadowDiv = attachShadowDiv(span);
shadowDiv.classList.add("target");
// Create empty stylesheet.
const sheet = new CSSStyleSheet();
span.shadowRoot.adoptedStyleSheets = [sheet];
assert_equals(getComputedStyle(shadowDiv).color, "rgb(0, 0, 0)");
// Replace the stylesheet text that will color it red.
sheet.replaceSync(".target { color: red; }");
assert_equals(getComputedStyle(shadowDiv).color, "rgb(255, 0, 0)");
// Create a style element that will set colors to white.
const style = document.createElement("style");
style.textContent = ".target { color: white; }";
span.shadowRoot.appendChild(style)
// non-adopted styles should be ordered before adopted styles
assert_equals(getComputedStyle(shadowDiv).color, "rgb(255, 0, 0)");
span.shadowRoot.adoptedStyleSheets = [];
// with no adopted styles in conflict, the non-adopted style should take effect
assert_equals(getComputedStyle(shadowDiv).color, "rgb(255, 255, 255)");
span.shadowRoot.adoptedStyleSheets = [sheet];
// the adopted style should be ordered after the non-adopted style
assert_equals(getComputedStyle(shadowDiv).color, "rgb(255, 0, 0)");
sheet.disabled = true;
// with the adopted sheet disabled, the non-adopted style should take effect
assert_equals(getComputedStyle(shadowDiv).color, "rgb(255, 255, 255)");
sheet.disabled = false;
// the adopted sheet re-enabled, it should take effect again.
assert_equals(getComputedStyle(shadowDiv).color, "rgb(255, 0, 0)");
}, 'Adopted sheets are ordered after non-adopted sheets in the shadow root')
test(() => {
// Attach a div inside a shadow root with the class ".red".
const span = document.createElement("span");
thirdSection.appendChild(span);
span.classList.add("target");
// Create empty stylesheet.
const sheet = new CSSStyleSheet();
document.adoptedStyleSheets = [sheet];
assert_equals(getComputedStyle(span).color, "rgb(0, 0, 0)");
// Replace the stylesheet text that will color it red.
sheet.replaceSync(".target { color: red; }");
assert_equals(getComputedStyle(span).color, "rgb(255, 0, 0)");
// Create a style element that will set colors to white.
const style = document.createElement("style");
style.textContent = ".target { color: white; }";
span.appendChild(style)
// non-adopted styles should be ordered before adopted styles
assert_equals(getComputedStyle(span).color, "rgb(255, 0, 0)");
document.adoptedStyleSheets = [];
// with no adopted styles in conflict, the non-adopted style should take effect
assert_equals(getComputedStyle(span).color, "rgb(255, 255, 255)");
document.adoptedStyleSheets = [sheet];
// the adopted style should be ordered after the non-adopted style
assert_equals(getComputedStyle(span).color, "rgb(255, 0, 0)");
sheet.disabled = true;
// with the adopted sheet disabled, the non-adopted style should take effect
assert_equals(getComputedStyle(span).color, "rgb(255, 255, 255)");
sheet.disabled = false;
// the adopted sheet re-enabled, it should take effect again.
assert_equals(getComputedStyle(span).color, "rgb(255, 0, 0)")
}, 'Adopted sheets are ordered after non-adopted sheets in the document')
const import_text = '@import url("support/constructable-import.css");';
test(() => {
@ -602,6 +681,30 @@ test(() => {
assert_equals(getComputedStyle(shadowDiv).color, "rgb(0, 0, 0)");
}, 'Adopting a shadow host will empty adoptedStyleSheets if adopting to a different document');
test(() => {
const span = document.createElement("span");
const div = document.createElement("div");
thirdSection.appendChild(span);
span.appendChild(div);
const shadowDiv = attachShadowDiv(div);
const sheet = new CSSStyleSheet();
sheet.replaceSync("* { color: red; }");
div.shadowRoot.adoptedStyleSheets = [sheet];
assert_equals(getComputedStyle(shadowDiv).color, "rgb(255, 0, 0)");
document.adoptNode(span);
assert_equals(div.shadowRoot.adoptedStyleSheets.length, 1);
assert_equals(div.shadowRoot.adoptedStyleSheets[0], sheet);
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
iframe.contentDocument.adoptNode(span);
iframe.contentDocument.body.appendChild(span);
assert_not_equals(div.shadowRoot, null);
assert_equals(div.shadowRoot.adoptedStyleSheets.length, 0);
assert_equals(getComputedStyle(shadowDiv).color, "rgb(0, 0, 0)");
}, `Adopting a shadow host's ancestor will empty adoptedStyleSheets if adopting to a different document`);
test(() => {
const host = document.createElement("div");
const root = host.attachShadow({mode: "open"});