diff --git a/tests/Basic/ContentTest.php b/tests/Basic/ContentTest.php index f8b2d86..5cd6706 100644 --- a/tests/Basic/ContentTest.php +++ b/tests/Basic/ContentTest.php @@ -21,6 +21,21 @@ public function testOuterHtml(): void ); } + public function testGetText(): void + { + $this->getSession()->visit($this->pathTo('/index.html')); + + $element = $this->getAssertSession()->elementExists('css', '.get-text-trim'); + + /* + * Tests, these things: + * -
gets replaced with a space + * - spaces around the text are trimmed + * -   are replaced with " " (non-breakable space) and then with " " (regular space) + */ + $this->assertEquals('line 2: text inside div line 3:', $element->getText()); + } + public function testDumpingEmptyElements(): void { $this->getSession()->visit($this->pathTo('/index.html')); diff --git a/web-fixtures/index.html b/web-fixtures/index.html index cc8c821..dd11a0f 100644 --- a/web-fixtures/index.html +++ b/web-fixtures/index.html @@ -36,6 +36,10 @@

Extremely useless page

el4
+

line 2: text inside + div + line 3:
+