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
|
use strict;
use warnings;
use Test2::V0;
use lib 't/lib';
use WQTest;
WQTest::test {
my $class = shift;
my $wq = $class->new(<<HTML);
<div>
<p id="first" class="foo">one</p>
<p id="second">two</p>
<p class="foo">three</p>
</div>
HTML
is $wq->find('p')->not( '#second' )->size => 2, 'not';
is $wq->find('p')->filter( '#second' )->size => 1, 'filter';
subtest 'match' => sub {
is [ $wq->find('p')->match( '.foo' ) ], [ 1, '', 1 ], "list context";
is scalar $wq->find('p')->match( '.foo' ) => 1, "scalar context";
};
}
|