| 138 | | }) |
| | 138 | }); |
| | 139 | |
| | 140 | test("has(Element)", function() { |
| | 141 | expect(2); |
| | 142 | |
| | 143 | var obj = jQuery("#main").has(jQuery("#sndp")[0]); |
| | 144 | isSet( obj, q("main"), "Keeps elements that have the element as a descendant" ); |
| | 145 | |
| | 146 | var multipleParent = jQuery("#main, #header").has(jQuery("#sndp")[0]); |
| | 147 | isSet( obj, q("main"), "Does not include elements that do not have the element as a descendant" ); |
| | 148 | }); |
| | 149 | |
| | 150 | test("has(Selector)", function() { |
| | 151 | expect(3); |
| | 152 | |
| | 153 | var obj = jQuery("#main").has("#sndp"); |
| | 154 | isSet( obj, q("main"), "Keeps elements that have any element matching the selector as a descendant" ); |
| | 155 | |
| | 156 | var multipleParent = jQuery("#main, #header").has("#sndp"); |
| | 157 | isSet( obj, q("main"), "Does not include elements that do not have the element as a descendant" ); |
| | 158 | |
| | 159 | var multipleHas = jQuery("#main").has("#sndp, #first"); |
| | 160 | isSet( multipleHas, q("main"), "Only adds elements once" ); |
| | 161 | }); |
| | 162 | |
| | 163 | test("has(Arrayish)", function() { |
| | 164 | expect(3); |
| | 165 | |
| | 166 | var simple = jQuery("#main").has(jQuery("#sndp")); |
| | 167 | isSet( simple, q("main"), "Keeps elements that have any element in the jQuery list as a descendant" ); |
| | 168 | |
| | 169 | var multipleParent = jQuery("#main, #header").has(jQuery("#sndp")); |
| | 170 | isSet( multipleParent, q("main"), "Does not include elements that do not have an element in the jQuery list as a descendant" ); |
| | 171 | |
| | 172 | var multipleHas = jQuery("#main").has(jQuery("#sndp, #first")); |
| | 173 | isSet( simple, q("main"), "Only adds elements once" ); |
| | 174 | }); |