1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 01:45:08 +00:00
serenity/Libraries/LibWeb/Tests/DOM/Node.js
Nico Weber 2460980d2c LibWeb: Implement Element.innerText
Reading the property has a few warts (see FIXMEs in the included
tests), but with this the timestamps on http://45.33.8.238/
get localized :^)

Since the Date() constructor currently ignores all arguments,
they don't get localized correctly but are all set to the current
time, but hey, it's still progress from a certain point of view.
2020-08-18 16:58:46 +02:00

28 lines
1 KiB
JavaScript

loadPage("file:///res/html/misc/innertext_textcontent.html");
afterInitialPageLoad(() => {
test("Node.textContent", () => {
var p = document.getElementsByTagName("p")[0];
expect(p.textContent).toBe("This is a very small test page :^)");
expect(p.firstChild.textContent).toBe("This is a ");
expect(p.firstChild.firstChild).toBe(null);
p.firstChild.textContent = "foo";
expect(p.firstChild.textContent).toBe("foo");
expect(p.firstChild.firstChild).toBe(null);
expect(p.textContent).toBe("foovery small test page :^)");
p.textContent = "bar";
expect(p.textContent).toBe("bar");
expect(p.firstChild.textContent).toBe("bar");
expect(p.firstChild.firstChild).toBe(null);
var p = document.getElementById("source");
expect(p.textContent).toBe(`
#source { color: red; } #text { text-transform: uppercase; }
Take a look athow this textis interpreted
below.
HIDDEN TEXT
`);
});
});