diff options
Diffstat (limited to 'contexts/data/lib/closure-library/closure/goog/async/delay_test.html')
-rw-r--r-- | contexts/data/lib/closure-library/closure/goog/async/delay_test.html | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/contexts/data/lib/closure-library/closure/goog/async/delay_test.html b/contexts/data/lib/closure-library/closure/goog/async/delay_test.html deleted file mode 100644 index 91b2583..0000000 --- a/contexts/data/lib/closure-library/closure/goog/async/delay_test.html +++ /dev/null @@ -1,148 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- -Copyright 2007 The Closure Library Authors. All Rights Reserved. - -Use of this source code is governed by the Apache License, Version 2.0. -See the COPYING file for details. ---> -<head> -<meta http-equiv="X-UA-Compatible" content="IE=edge"> -<title>Closure Unit Tests - goog.async.Delay</title> -<script src="../base.js"></script> -<script> - goog.require('goog.async.Delay'); - goog.require('goog.testing.MockClock'); - goog.require('goog.testing.jsunit'); -</script> -</head> -<body> -<script> - - -var invoked = false; -var delay = null; -var clock = null; - - -function callback() { - invoked = true; -} - - -function setUp() { - clock = new goog.testing.MockClock(true); - invoked = false; - delay = new goog.async.Delay(callback, 200); -} - -function tearDown() { - clock.dispose(); - delay.dispose(); -} - - -function testDelay() { - delay.start(); - assertFalse(invoked); - - clock.tick(100); - assertFalse(invoked); - - clock.tick(100); - assertTrue(invoked); -} - - -function testStop() { - delay.start(); - - clock.tick(100); - assertFalse(invoked); - - delay.stop(); - clock.tick(100); - assertFalse(invoked); -} - - -function testIsActive() { - assertFalse(delay.isActive()); - delay.start(); - assertTrue(delay.isActive()); - clock.tick(200); - assertFalse(delay.isActive()); -} - - -function testRestart() { - delay.start(); - clock.tick(100); - - delay.stop(); - assertFalse(invoked); - - delay.start(); - clock.tick(199); - assertFalse(invoked); - - clock.tick(1); - assertTrue(invoked); - - invoked = false; - delay.start(); - clock.tick(200); - assertTrue(invoked); -} - - -function testOverride() { - delay.start(50); - clock.tick(49); - assertFalse(invoked); - - clock.tick(1); - assertTrue(invoked); -} - - -function testDispose() { - delay.start(); - delay.dispose(); - assertTrue(delay.isDisposed()); - - clock.tick(500); - assertFalse(invoked); -} - - -function testFire() { - delay.start(); - - clock.tick(50); - delay.fire(); - assertTrue(invoked); - assertFalse(delay.isActive()); - - invoked = false; - clock.tick(200); - assertFalse('Delay fired early with fire call, timeout should have been ' + - 'cleared', invoked); -} - -function testFireIfActive() { - delay.fireIfActive(); - assertFalse(invoked); - - delay.start(); - delay.fireIfActive(); - assertTrue(invoked); - invoked = false; - clock.tick(300); - assertFalse('Delay fired early with fireIfActive, timeout should have been ' + - 'cleared', invoked); -} - -</script> -</body> -</html> |