Skip to content

Commit

Permalink
more test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcal committed Jan 23, 2021
1 parent face1e8 commit f199c45
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/BasicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,23 @@ public function testTags(){
$this->assertEquals(1, count($obj->find('b')));
}

public function testClass(){

$html = '<p><b class="a">foo</b><b class="b">bar</b><i class="a b">baz</i></p>';
$obj = pQuery::fromHTML($html);

$this->assertEquals(1, count($obj->find('b.a')));
$this->assertEquals(2, count($obj->find('.a')));
}

public function testID(){

$html = '<p><b id="a">foo</b><b id="b">bar</b></p>';
$obj = pQuery::fromHTML($html);

$this->assertEquals(1, count($obj->find('b#a')));
$this->assertEquals(1, count($obj->find('#b')));
$this->assertEquals(0, count($obj->find('#c')));
}

}

0 comments on commit f199c45

Please sign in to comment.