-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathIssue49Test.php
More file actions
31 lines (24 loc) · 841 Bytes
/
Issue49Test.php
File metadata and controls
31 lines (24 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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'));
}
}