Bug 1330375 - P3: Add WPT test to ensure innerText works with dynamic changes. r=heycam

To check that changes in P1 still work when layout is required.

MozReview-Commit-ID: ArqwDQXQwnR

--HG--
extra : rebase_source : 28cec6a6805bbd3c993c91115c663b791e35a20d
This commit is contained in:
Dan Glastonbury 2018-07-12 13:25:56 +10:00
Родитель 19dd66bbb1
Коммит 04130fc7b4
2 изменённых файлов: 116 добавлений и 15 удалений

Просмотреть файл

@ -184511,6 +184511,18 @@
{}
]
],
"svg/linking/reftests/use-descendant-combinator-003.html": [
[
"/svg/linking/reftests/use-descendant-combinator-003.html",
[
[
"/svg/linking/reftests/use-descendant-combinator-ref.html",
"=="
]
],
{}
]
],
"svg/painting/currentColor-override-pserver-fallback.svg": [
[
"/svg/painting/currentColor-override-pserver-fallback.svg",
@ -184547,18 +184559,6 @@
{}
]
],
"svg/linking/reftests/use-descendant-combinator-003.html": [
[
"/svg/linking/reftests/use-descendant-combinator-003.html",
[
[
"/svg/linking/reftests/use-descendant-combinator-ref.html",
"=="
]
],
{}
]
],
"svg/painting/reftests/paint-context-001.svg": [
[
"/svg/painting/reftests/paint-context-001.svg",
@ -342496,6 +342496,12 @@
{}
]
],
"html/dom/elements/the-innertext-idl-attribute/dynamic-getter.html": [
[
"/html/dom/elements/the-innertext-idl-attribute/dynamic-getter.html",
{}
]
],
"html/dom/elements/the-innertext-idl-attribute/getter.html": [
[
"/html/dom/elements/the-innertext-idl-attribute/getter.html",
@ -439008,7 +439014,7 @@
"testharness"
],
"content-security-policy/securitypolicyviolation/img-src-redirect-upgrade-reporting.https.html": [
"e338e94ea726419db64ed5b98c95b862c394409e",
"f6623c80b2b4be3fd9dd0f5dc0a6417652f1b797",
"testharness"
],
"content-security-policy/securitypolicyviolation/img-src-redirect-upgrade-reporting.https.html.headers": [
@ -439060,7 +439066,7 @@
"testharness"
],
"content-security-policy/securitypolicyviolation/support/inside-worker.sub.js": [
"f425a7ae6c167bfe9857f08f460897e16bf6ca95",
"d94662579190653a3b3e9d076b79d7b0f01f2dc7",
"support"
],
"content-security-policy/securitypolicyviolation/support/inside-worker.sub.js.headers": [
@ -576691,6 +576697,10 @@
"45472ac8906e7b383d80ab0b92ecddd6b900f726",
"support"
],
"html/dom/elements/the-innertext-idl-attribute/dynamic-getter.html": [
"68d7f1a50956a99ac6724aef2f0b4abed3a78bb5",
"testharness"
],
"html/dom/elements/the-innertext-idl-attribute/getter-tests.js": [
"0ffc6d2bf3011a376f85b45090c63de07ac023d5",
"support"
@ -619083,6 +619093,10 @@
"3d51ca0fc007d52147e7ea03493cac7ee1bb7903",
"reftest"
],
"svg/linking/reftests/use-descendant-combinator-003.html": [
"d9155d3b92ecf0735f82ed9a0f2a8fd3fc380d55",
"reftest"
],
"svg/linking/reftests/use-descendant-combinator-ref.html": [
"fb8aec792684b97151d2964b85d1e70829e141ad",
"support"
@ -622188,7 +622202,7 @@
"support"
],
"webaudio/historical.html": [
"93068df297042344669093ce899f0230c87ebf54",
"c6e3c7d6751731c708edfb0f4e32df8a6a3b80b0",
"testharness"
],
"webaudio/idlharness.https.html": [

Просмотреть файл

@ -0,0 +1,87 @@
<!DOCTYPE html>
<title>innerText getter test with dynamic style changes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="container"></div>
<script>
let container = document.querySelector('#container');
function testText(html, expectedPlain, msg, mutate) {
test(function() {
container.innerHTML = html;
// Cause a flush of style and layout
document.body.offsetTop;
mutate();
var e = document.getElementById('target');
if (!e) {
e = container.firstChild;
}
assert_equals(e.innerText, expectedPlain);
container.textContext = '';
}, msg + ' (' + format_value(html) + ')');
}
function setStyle(id, attr, value) {
let el = document.getElementById(id);
if (el) {
el.style[attr] = value;
}
}
testText("<div id='target'><div id='child'>abc", "ABC",
"text-transform applied to child element", function() {
setStyle("child", "text-transform", "uppercase");
});
testText("<div id='parent'><div id='target'>abc", "ABC",
"text-transform applied to parent element", function() {
setStyle("parent", "text-transform", "uppercase");
});
testText("<div id='target'>abc<div id='child'>def", "abc",
"display: none applied to child element", function() {
setStyle("child", "display", "none");
});
testText("<div id='parent'>invisible<div id='target'>abc", "abc",
"display: none applied to parent element", function() {
setStyle("parent", "display", "none");
});
testText("<div id='target'>abc", "abc\ndef",
"insert node into sub-tree", function() {
let el = document.getElementById("target");
if (el) {
let c = document.createTextNode("def");
let d = document.createElement("div");
d.appendChild(c);
el.appendChild(d);
}
});
testText("<div id='target'>abc<div id='remove'>def", "abc",
"remove node from sub-tree", function() {
let el = document.getElementById("target");
let victim = document.getElementById("remove");
if (el && victim) {
el.removeChild(victim);
}
});
testText("<div id='target'>", "abcdef",
"insert whole sub-tree", function() {
var el = document.getElementById("target");
if (el) {
var def = document.createTextNode("def");
var s = document.createElement("span");
s.appendChild(def);
var abc = document.createTextNode("abc");
var d = document.createElement("div");
d.appendChild(abc);
d.appendChild(s);
el.appendChild(d);
}
});
</script>