1 description("This test checks to see if setting document.title works even if the title element has multiple children.");
3 // Setup - create title element.
4 shouldBe("document.getElementsByTagName('title').length", "0");
5 var titleElement
= document
.createElement("title");
6 document
.body
.appendChild(titleElement
);
8 // For case with no children.
9 shouldBe("document.title", "''");
10 shouldBe("titleElement.text", "''");
12 // For case with single children.
13 var firstText
= "First";
14 titleElement
.appendChild(document
.createTextNode(firstText
));
15 shouldBe("document.title", "firstText");
16 shouldBe("titleElement.text", "firstText");
18 // For case with 2 children.
19 var secondText
= "Second";
20 titleElement
.appendChild(document
.createTextNode(secondText
));
21 shouldBe("document.title", "firstText + secondText");
22 shouldBe("titleElement.text", "firstText + secondText");
24 // override title with setting document.title with multiple title children.
25 var expected
= "This title is set by property";
26 document
.title
= expected
;
27 shouldBe("document.title", "expected");
28 shouldBe("titleElement.text", "expected");