Skip to content

Commit

Permalink
Add more whitespace-at-soft-break examples (based on Testcase #2) to …
Browse files Browse the repository at this point in the history
…the WPT innerText getter test.

Depends on D45159

Differential Revision: https://phabricator.services.mozilla.com/D46186

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1241631
gecko-commit: 4dc6ff8d58b31c747e519abcbe01270d01d66636
gecko-integration-branch: autoland
gecko-reviewers: mats
  • Loading branch information
jfkthame authored and moz-wptsync-bot committed Sep 18, 2019
1 parent 281b4ab commit e076f28
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions html/dom/elements/the-innertext-idl-attribute/getter-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,27 @@ testText("<div>abc <canvas style='display:block'></canvas> def", "abc\ndef", "Re
/**** Soft line breaks ****/

testText("<div style='width:0'>abc def", "abc def", "Soft line breaks ignored");
testText("<div style='width:0'>abc-def", "abc-def", "Soft line break at hyphen ignored");
testText("<div style='width:0'><span>abc</span> <span>def</span>", "abc def", "Whitespace text node preserved");

/**** Soft line breaks when word-break:break-word is in effect ****/
/* (based on Testcase #2 at https://bugzilla.mozilla.org/show_bug.cgi?id=1241631) */

testText("<div style='width:1px; word-break:break-word'>Hello Kitty</div>", "Hello Kitty", "Soft breaks ignored in presence of word-break:break-word");
testText("<div style='width:1px; word-break:break-word'><x>Hello</x> <x>Kitty</x></div>", "Hello Kitty", "Element boundaries ignored for soft break handling (1)");
testText("<div style='width:1px; word-break:break-word'><x>Hello</x> <x> Kitty</x></div>", "Hello Kitty", "Whitespace collapses across element boundaries at soft break (1)");
testText("<div style='width:1px; word-break:break-word'><x>Hello</x><x> Kitty</x></div>", "Hello Kitty", "Element boundaries ignored for soft break handling (2)");
testText("<div style='width:1px; word-break:break-word'><x>Hello </x> <x>Kitty</x></div>", "Hello Kitty", "Whitespace collapses across element boundaries at soft break (2)");
testText("<div style='width:1px; word-break:break-word'><x>Hello </x><x>Kitty</x></div>", "Hello Kitty", "Element boundaries ignored for soft break handling (3)");
testText("<div style='width:1px; word-break:break-word'><x>Hello </x><x> Kitty</x></div>", "Hello Kitty", "Whitespace collapses across element boundaries at soft break (3)");
testText("<div style='width:1px; word-break:break-word'><x>Hello </x> <x> Kitty</x></div>", "Hello Kitty", "Whitespace collapses across element boundaries at soft break (4)");
testText("<div style='width:1px; word-break:break-word'><x>Hello</x> Kitty</div>", "Hello Kitty", "Element boundaries ignored for soft break handling (4)");
testText("<div style='width:1px; word-break:break-word'><x>Hello </x>Kitty</div>", "Hello Kitty", "Element boundaries ignored for soft break handling (5)");
testText("<div style='width:1px; word-break:break-word; text-transform:uppercase'>Hello Kitty</div>", "HELLO KITTY", "Soft breaks ignored, text-transform applied");
testText("<div style='width:1px; word-break:break-word'>Hello<br> Kitty</div>", "Hello\nKitty", "<br> returned as newline, following space collapsed");
testText("<div style='width:1px; word-break:break-word'>Hello <br>Kitty</div>", "Hello\nKitty", "<br> returned as newline, preceding space collapsed");
testText("<div style='width:1px; word-break:break-word'><x>Hello </x> <br> <x> Kitty</x></div>", "Hello\nKitty", "<br> returned as newline, adjacent spaces collapsed across element boundaries");

/**** first-line/first-letter ****/

testText("<div class='first-line-uppercase' style='width:0'>abc def", "ABC def", "::first-line styles applied");
Expand Down

0 comments on commit e076f28

Please sign in to comment.