mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
I was looking at implementing something else, and saw this was low hanging fruit, that brings the browser closer to standards conformance. Add a basic test as well to validate it's implementation.
40 lines
1.4 KiB
JavaScript
40 lines
1.4 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
|
|
`);
|
|
});
|
|
|
|
test("Node.isConnected", () => {
|
|
var element = document.createElement("p");
|
|
expect(element.isConnected).toBeFalse();
|
|
|
|
document.body.appendChild(element);
|
|
expect(element.isConnected).toBeTrue();
|
|
|
|
document.body.removeChild(element);
|
|
expect(element.isConnected).toBeFalse();
|
|
});
|
|
});
|