Skip to content

Commit 1a71c02

Browse files
committed
Improve return type of getPageTitle test helper
1 parent 051ccd2 commit 1a71c02

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Testem appends progress to the title...
22
// and there's no way to stop this at the moment
33

4-
export function getPageTitle(doc: Document) {
4+
export function getPageTitle(doc?: Document): string {
55
// In Fastboot context we get 2 title elements if we don't remove one from app/index.html
66
// In real world applications, it is mandatory to remove <title> from app/index.html
77
// We are keeping both for sake for testing browser and fastboot scenarios
88
const element = [
99
...(doc || window.document).querySelectorAll('head title'),
1010
].pop();
1111

12-
return (
13-
element &&
14-
element instanceof HTMLTitleElement &&
15-
element.innerText.trim().replace(/^\(\d+\/\d+\)/, '')
16-
);
12+
if (element instanceof HTMLTitleElement) {
13+
return element.innerText.trim().replace(/^\(\d+\/\d+\)/, '');
14+
}
15+
16+
return '';
1717
}

0 commit comments

Comments
 (0)