aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/dimensions.js
diff options
context:
space:
mode:
authorMike Sherov <mike.sherov@gmail.com>2012-08-19 16:30:10 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-08-19 22:58:05 -0400
commitad040181dc6c05fa37941a6c9bfbe98bdf7ba8f1 (patch)
treeb31b1c6a288d38d501c4ac238ec171868a1805b3 /test/unit/dimensions.js
parent9f86dc922ed832337d246d7baf8fd397dc837346 (diff)
downloadjquery-ad040181dc6c05fa37941a6c9bfbe98bdf7ba8f1.tar.gz
jquery-ad040181dc6c05fa37941a6c9bfbe98bdf7ba8f1.zip
Fix #12283. Return null for dimension getters on non elements. Fix gh-900.
Diffstat (limited to 'test/unit/dimensions.js')
-rw-r--r--test/unit/dimensions.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js
index 0b2e63600..b3c15f283 100644
--- a/test/unit/dimensions.js
+++ b/test/unit/dimensions.js
@@ -385,6 +385,22 @@ test("passing undefined is a setter #5571", function() {
equal(jQuery("#nothiddendiv").width(30).width(undefined).width(), 30, ".width(undefined) is chainable (#5571)");
});
+test( "getters on non elements should return null", function() {
+ expect( 8 );
+
+ var nonElem = jQuery("notAnElement");
+
+ strictEqual( nonElem.width(), null, ".width() is not null (#12283)" );
+ strictEqual( nonElem.innerWidth(), null, ".innerWidth() is not null (#12283)" );
+ strictEqual( nonElem.outerWidth(), null, ".outerWidth() is not null (#12283)" );
+ strictEqual( nonElem.outerWidth( true ), null, ".outerWidth(true) is not null (#12283)" );
+
+ strictEqual( nonElem.height(), null, ".height() is not null (#12283)" );
+ strictEqual( nonElem.innerHeight(), null, ".innerHeight() is not null (#12283)" );
+ strictEqual( nonElem.outerHeight(), null, ".outerHeight() is not null (#12283)" );
+ strictEqual( nonElem.outerHeight( true ), null, ".outerHeight(true) is not null (#12283)" );
+});
+
test("setters with and without box-sizing:border-box", function(){
expect(20);