2 #use warnings FATAL => 'all';
10 <span prop='moo' class="hilight name">Bob</span>
11 <span class="career">Builder</span>
17 my $stub = '<div class="waargh"></div>';
20 is( HTML::Zoom->from_html('<div id="yo"></div>'.$stub)
22 ->replace_content('grg')
24 '<div id="yo">grg</div>'.$stub,
28 is( HTML::Zoom->from_html('<div class="yo"></div>'.$stub)
30 ->replace_content('grg')
32 '<div class="yo">grg</div>'.$stub,
36 is( HTML::Zoom->from_html('<div frew="yo"></div>'.$stub)
38 ->replace_content('grg')
40 '<div frew="yo">grg</div>'.$stub,
44 is( HTML::Zoom->from_html('<div frew="yo"></div>'.$stub)
45 ->select('div[frew="yo"]')
46 ->replace_content('grg')
48 '<div frew="yo">grg</div>'.$stub,
49 'E[attr="val"] works' );
52 is( HTML::Zoom->from_html('<div frew="yo"></div>'.$stub)
53 ->select('div[frew=yo]')
54 ->replace_content('grg')
56 '<div frew="yo">grg</div>'.$stub,
57 'E[attr=val] works' );
61 is( HTML::Zoom->from_html('<div f="frew goog"></div>'.$stub)
62 ->select('div[f*="oo"]')
63 ->replace_content('grg')
65 '<div f="frew goog">grg</div>'.$stub,
66 'E[attr*="val"] works' );
69 is( HTML::Zoom->from_html('<div f="foobar"></div>'.$stub)
70 ->select('div[f^="foo"]')
71 ->replace_content('grg')
73 '<div f="foobar">grg</div>'.$stub,
74 'E[attr^="val"] works' );
77 is( HTML::Zoom->from_html('<div f="foobar"></div>'.$stub)
78 ->select('div[f$="bar"]')
79 ->replace_content('grg')
81 '<div f="foobar">grg</div>'.$stub,
82 'E[attr$="val"] works' );
85 is( HTML::Zoom->from_html('<div f="foo bar"></div>'.$stub)
86 ->select('div[f*="bar"]')
87 ->replace_content('grg')
89 '<div f="foo bar">grg</div>'.$stub,
90 'E[attr*="val"] works' );
93 ok( check_select( '[prop=moo]'), '[attr=bar]' );
95 # el[attr=bar],[prop=foo]
96 is( check_select('span[class=career],[prop=moo]'), 2,
97 'Multiple selectors: el[attr=bar],[attr=foo]');
102 is( HTML::Zoom->from_html('<table><tr></tr><tr></tr></table>')
104 ->replace_content(\'<td></td>')
106 '<table><tr><td></td></tr><tr><td></td></tr></table>',
111 is( HTML::Zoom->from_html('<table><tr><td></td></tr><tr><td></td></tr></table>')
112 ->select('table tr td')
113 ->replace_content('frew')
115 '<table><tr><td>frew</td></tr><tr><td>frew</td></tr></table>',
116 'sel1 sel2 sel3 works' );
125 my $output = HTML::Zoom
127 ->select(shift)->replace("the monkey")->to_html;
129 while ( $output =~ /the monkey/g ){