-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit tests that need to pass for issue 49
- Loading branch information
1 parent
a9da950
commit d12d8b4
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace QueryPathTests; | ||
|
||
class Issue49Test extends TestCase | ||
{ | ||
public function testCheckingForMatchingTextInputs(): void | ||
{ | ||
$q = html5qp('<div><input name="text1" type="text" /><input name="text2" /></div>', '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('<div>Sample</div>', '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')); | ||
} | ||
} |