File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,21 @@ public function testOuterHtml(): void
2121 );
2222 }
2323
24+ public function testGetText (): void
25+ {
26+ $ this ->getSession ()->visit ($ this ->pathTo ('/index.html ' ));
27+
28+ $ element = $ this ->getAssertSession ()->elementExists ('css ' , '.get-text-trim ' );
29+
30+ /*
31+ * Tests, these things:
32+ * - <br> gets replaced with a space
33+ * - spaces around the text are trimmed
34+ * - are replaced with " " (non-breakable space) and then with " " (regular space)
35+ */
36+ $ this ->assertEquals ('line 2: text inside div line 3: ' , $ element ->getText ());
37+ }
38+
2439 public function testDumpingEmptyElements (): void
2540 {
2641 $ this ->getSession ()->visit ($ this ->pathTo ('/index.html ' ));
Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ <h1>Extremely useless page</h1>
3636
3737 < div class ="sub "> el4</ div >
3838
39+ < div class ="get-text-trim "> < br /> line 2: text < strong > inside</ strong >
40+ div
41+ line 3:< br /> </ div >
42+
3943 </ div >
4044
4145 < footer >
You can’t perform that action at this time.
0 commit comments