Lines Matching +refs:find +refs:class
11 my $class = shift;
13 subtest 'data()' => sub { test_data($class) };
15 subtest 'name()' => sub { test_name($class) };
17 subtest 'id()' => sub { test_id($class) };
22 my $class = shift;
24 my $wq = $class->new_from_html(q{
31 $wq->find('a')->data( foo => 'bar' );
36 is $wq->find('a')->data('foo') => 'bar';
42 my $class = shift;
44 my $wq = $class->new_from_html(q{
53 is_deeply [ $wq->find('a,b,c')->name ], [ 'foo', undef, 'bar' ], "getter, list context";
54 is scalar $wq->find('a,b,c')->name, 'foo', "getter, scalar context";
58 $wq->find('a,b,c')->name( 'quux' );
59 is $wq->find($_)->name => 'quux' for 'a'..'c';
65 my $class = shift;
67 my $wq = $class->new_from_html(q{
77 is_deeply [ $wq->find('a')->id ] => [ undef ], "no id, list context";
78 is scalar $wq->find('a')->id => undef, "no id, scalar context";
80 is $wq->find('#foo')->id => 'foo', 'single element';
81 is scalar($wq->find('#foo')->id) => 'foo', 'single element, scalar context';
83 is_deeply [ $wq->find('c')->id ], [ 'bar', undef, 'baz' ], 'many elements, list context';
84 is_deeply scalar $wq->find('c')->id, 'bar', 'many elements, scalar context';
86 $wq->find('b')->id('fool');
87 is $wq->find('#fool')->tagname => 'b', 'change id, scalar';
89 isa_ok $wq->find('c')->id('buz'), 'Web::Query';
91 is $wq->find('c')->id('buz')->size => 1, 'only the first element';
92 is $wq->find('#buz')->text => 1, "change first element";
95 $wq->find('c')->id(sub{ 'new_'.$i++ });
97 is $wq->find('#new_'.$_)->size => 1 for 0..2;