Node.js 1.0 KB

12345678910111213141516171819202122232425262728
  1. loadPage("file:///res/html/misc/innertext_textcontent.html");
  2. afterInitialPageLoad(() => {
  3. test("Node.textContent", () => {
  4. var p = document.getElementsByTagName("p")[0];
  5. expect(p.textContent).toBe("This is a very small test page :^)");
  6. expect(p.firstChild.textContent).toBe("This is a ");
  7. expect(p.firstChild.firstChild).toBe(null);
  8. p.firstChild.textContent = "foo";
  9. expect(p.firstChild.textContent).toBe("foo");
  10. expect(p.firstChild.firstChild).toBe(null);
  11. expect(p.textContent).toBe("foovery small test page :^)");
  12. p.textContent = "bar";
  13. expect(p.textContent).toBe("bar");
  14. expect(p.firstChild.textContent).toBe("bar");
  15. expect(p.firstChild.firstChild).toBe(null);
  16. var p = document.getElementById("source");
  17. expect(p.textContent).toBe(`
  18. #source { color: red; } #text { text-transform: uppercase; }
  19. Take a look athow this textis interpreted
  20. below.
  21. HIDDEN TEXT
  22. `);
  23. });
  24. });