orientation support tests for native vs resize

This commit is contained in:
John Bender 2010-12-11 00:39:27 -08:00
parent 7f51d4fcf5
commit 6f8aada084

View file

@ -311,4 +311,43 @@
$($.event.special.swipe).trigger("touchmove");
});
var nativeSupportTest = function(opts){
$.support.orientation = opts.orientationSupport;
same($.event.special.orientationchange[opts.method](),
opts.returnValue);
};
test( "orientation change setup should do nothing when natively supported", function(){
nativeSupportTest({
method: 'setup',
orientationSupport: true,
returnValue: false
});
});
test( "orientation change setup should bind resize when not supported natively", function(){
nativeSupportTest({
method: 'setup',
orientationSupport: false,
returnValue: undefined //NOTE result of bind function call
});
});
test( "orientation change teardown should do nothing when natively supported", function(){
nativeSupportTest({
method: 'teardown',
orientationSupport: true,
returnValue: false
});
});
test( "orientation change teardown should unbind resize when not supported natively", function(){
nativeSupportTest({
method: 'teardown',
orientationSupport: false,
returnValue: undefined //NOTE result of unbind function call
});
});
})(jQuery);