From d12d8b499622637b0a6cfef2d38444c8819b49ff Mon Sep 17 00:00:00 2001 From: Jake Jackson Date: Fri, 22 Mar 2024 10:24:35 +1100 Subject: [PATCH] Unit tests that need to pass for issue 49 --- tests/Issues/Issue49Test.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/Issues/Issue49Test.php diff --git a/tests/Issues/Issue49Test.php b/tests/Issues/Issue49Test.php new file mode 100644 index 0000000..2ccabfd --- /dev/null +++ b/tests/Issues/Issue49Test.php @@ -0,0 +1,31 @@ +', 'div'); + + /* Check if the DOMNode or its children matches */ + $this->assertTrue($q->is(':text')); + $this->assertCount(2, $q->find(':text')); + + $textNode = $q->find('div')->contents()->eq(0); + $this->assertTrue($textNode->is(':text')); + } + + public function testCheckingForEmptyTextInputs(): void + { + $q = html5qp('
Sample
', 'div'); + + /* Check if the DOMNode or its children matches */ + $this->assertFalse($q->is(':text')); + $this->assertCount(0, $q->find(':text')); + + /* check if a text node matches */ + $textNode = $q->find('div')->contents()->eq(0); + $this->assertFalse($textNode->is(':text')); + } +} \ No newline at end of file