mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Add some tests for jQuery.isWindow and make sure that we're operating against an object before testing.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user