From 27e5052a7bd9e8d0af1a94ec2ad0c2c2317c3b50 Mon Sep 17 00:00:00 2001 From: rwldrn Date: Tue, 21 Jun 2011 14:04:06 -0400 Subject: [PATCH] Assert that .contents().hasClass() works as expected. Fixes #9630 --- test/unit/attributes.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 4716e5b53..bc3eb25f5 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -1055,3 +1055,13 @@ test("addClass, removeClass, hasClass", function() { jq.removeClass("class4"); ok( jq.hasClass("class4")==false, "Check the class has been properly removed" ); }); + +test("contents().hasClass() returns correct values", function() { + expect(2); + + var $div = jQuery("
text
"), + $contents = $div.contents(); + + ok( $contents.hasClass("foo"), "Found 'foo' in $contents" ); + ok( $contents.hasClass("undefined"), "Did not find 'undefined' in $contents (correctly)" ); +});