aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/core.js
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-09-22 16:50:38 -0400
committerjeresig <jeresig@gmail.com>2010-09-22 16:50:38 -0400
commitd7a6e75241ecc433cd5228174960dd8465ca3ff7 (patch)
tree0fd3d160b9486738d594651a35db5a272c466fb0 /test/unit/core.js
parentc8dd49f756562fef68f664869952e4f5aab08acd (diff)
downloadjquery-d7a6e75241ecc433cd5228174960dd8465ca3ff7.tar.gz
jquery-d7a6e75241ecc433cd5228174960dd8465ca3ff7.zip
Add some tests for jQuery.isWindow and make sure that we're operating against an object before testing.
Diffstat (limited to 'test/unit/core.js')
-rw-r--r--test/unit/core.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/core.js b/test/unit/core.js
index 811d13fb4..eec3d7cdf 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -432,6 +432,25 @@ test("isXMLDoc - XML", function() {
});
}
+test("isWindow", function() {
+ expect( 12 );
+
+ ok( jQuery.isWindow(window), "window" );
+ ok( !jQuery.isWindow(), "empty" );
+ ok( !jQuery.isWindow(null), "null" );
+ ok( !jQuery.isWindow(undefined), "undefined" );
+ ok( !jQuery.isWindow(document), "document" );
+ ok( !jQuery.isWindow(document.documentElement), "documentElement" );
+ ok( !jQuery.isWindow(""), "string" );
+ ok( !jQuery.isWindow(1), "number" );
+ ok( !jQuery.isWindow(true), "boolean" );
+ ok( !jQuery.isWindow({}), "object" );
+ // HMMM
+ // ok( !jQuery.isWindow({ setInterval: function(){} }), "fake window" );
+ ok( !jQuery.isWindow(/window/), "regexp" );
+ ok( !jQuery.isWindow(function(){}), "function" );
+});
+
test("jQuery('html')", function() {
expect(15);