aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorOleg Gaidarenko <markelog@gmail.com>2014-06-16 02:59:41 +0400
committerOleg Gaidarenko <markelog@gmail.com>2014-06-16 03:21:53 +0400
commit9dc29a2b130e6bbcdbcaf8fdc1433a41e6b7a585 (patch)
tree315f93166d47201d58232408754aa5380cadaa38 /test
parent06a45406966ee8cde31c4f128d7ee68d727880c1 (diff)
downloadjquery-9dc29a2b130e6bbcdbcaf8fdc1433a41e6b7a585.tar.gz
jquery-9dc29a2b130e6bbcdbcaf8fdc1433a41e6b7a585.zip
Effects: Improve raf logic
* Make animation behave as if jQuery.fx.off = true if document is hidden * Use cancelAnimationFrame in jQuery.fx.stop Ref 708764f47b0c8de152bbb444d0f608db558b76ed
Diffstat (limited to 'test')
-rw-r--r--test/unit/effects.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/unit/effects.js b/test/unit/effects.js
index 30d58ccd3..8e1f914cf 100644
--- a/test/unit/effects.js
+++ b/test/unit/effects.js
@@ -2239,4 +2239,32 @@ test( "Respect display value on inline elements (#14824)", 2, function() {
clock.tick( 800 );
});
+test( "Animation should go to its end state if document.hidden = true", 1, function() {
+ var height;
+ if ( Object.defineProperty ) {
+
+ // Can't rewrite document.hidden property if its host property
+ try {
+ Object.defineProperty( document, "hidden", {
+ get: function() {
+ return true;
+ }
+ });
+ } catch ( e ) {}
+ } else {
+ document.hidden = true;
+ }
+
+ if ( document.hidden ) {
+ height = jQuery( "#qunit-fixture" ).animate({ height: 500 } ).height();
+
+ equal( height, 500, "Animation should happen immediately if document.hidden = true" );
+ jQuery( document ).removeProp( "hidden" );
+
+ } else {
+ ok( true, "Can't run the test since we can't reproduce correct environment for it" );
+ }
+});
+
+
})();