aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/lib/closure-library/closure/goog/fx/css3/transition_test.html
diff options
context:
space:
mode:
Diffstat (limited to 'contexts/data/lib/closure-library/closure/goog/fx/css3/transition_test.html')
-rw-r--r--contexts/data/lib/closure-library/closure/goog/fx/css3/transition_test.html224
1 files changed, 0 insertions, 224 deletions
diff --git a/contexts/data/lib/closure-library/closure/goog/fx/css3/transition_test.html b/contexts/data/lib/closure-library/closure/goog/fx/css3/transition_test.html
deleted file mode 100644
index 0f24cf8..0000000
--- a/contexts/data/lib/closure-library/closure/goog/fx/css3/transition_test.html
+++ /dev/null
@@ -1,224 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-Copyright 2011 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.fx.css3.Transition</title>
-<script src="../../base.js"></script>
-<script>
- goog.require('goog.Timer');
- goog.require('goog.dispose');
- goog.require('goog.dom');
- goog.require('goog.events');
- goog.require('goog.fx.css3.Transition');
- goog.require('goog.style.transition');
- goog.require('goog.testing.MockClock');
- goog.require('goog.testing.jsunit');
- goog.require('goog.testing.recordFunction');
-</script>
-</head>
-<body>
-<script>
-
-var transition;
-var element;
-var mockClock;
-
-
-function createTransition(element, duration) {
- return new goog.fx.css3.Transition(
- element, duration, {'opacity': 0}, {'opacity': 1},
- {property: 'opacity', duration: duration, timing: 'ease-in', delay: 0});
-}
-
-
-function setUp() {
- mockClock = new goog.testing.MockClock(true);
- element = goog.dom.createElement('div');
- document.body.appendChild(element);
-}
-
-
-function tearDown() {
- goog.dispose(transition);
- goog.dispose(mockClock);
- goog.dom.removeNode(element);
-}
-
-
-function testPlayEventFiredOnPlay() {
- if (!goog.style.transition.isSupported()) return;
-
- transition = createTransition(element, 10);
- var handlerCalled = false;
- goog.events.listen(transition, goog.fx.Transition.EventType.PLAY,
- function() {
- handlerCalled = true;
- });
-
- transition.play();
- assertTrue(handlerCalled);
-}
-
-
-function testBeginEventFiredOnPlay() {
- if (!goog.style.transition.isSupported()) return;
-
- transition = createTransition(element, 10);
- var handlerCalled = false;
- goog.events.listen(transition, goog.fx.Transition.EventType.BEGIN,
- function() {
- handlerCalled = true;
- });
-
- transition.play();
- assertTrue(handlerCalled);
-}
-
-
-function testFinishEventsFiredAfterFinish() {
- if (!goog.style.transition.isSupported()) return;
-
- transition = createTransition(element, 10);
- var finishHandlerCalled = false;
- var endHandlerCalled = false;
- goog.events.listen(transition, goog.fx.Transition.EventType.FINISH,
- function() {
- finishHandlerCalled = true;
- });
- goog.events.listen(transition, goog.fx.Transition.EventType.END,
- function() {
- endHandlerCalled = true;
- });
-
- transition.play();
-
- mockClock.tick(10000);
-
- assertTrue(finishHandlerCalled);
- assertTrue(endHandlerCalled);
-}
-
-
-function testEventsWhenTransitionIsUnsupported() {
- if (goog.style.transition.isSupported()) return;
-
- transition = createTransition(element, 10);
-
- var stopHandlerCalled = false;
- var finishHandlerCalled = false, endHandlerCalled = false;
- var beginHandlerCalled = false, playHandlerCalled = false;
- goog.events.listen(transition, goog.fx.Transition.EventType.BEGIN,
- function() {
- beginHandlerCalled = true;
- });
- goog.events.listen(transition, goog.fx.Transition.EventType.PLAY,
- function() {
- playHandlerCalled = true;
- });
- goog.events.listen(transition, goog.fx.Transition.EventType.FINISH,
- function() {
- finishHandlerCalled = true;
- });
- goog.events.listen(transition, goog.fx.Transition.EventType.END,
- function() {
- endHandlerCalled = true;
- });
- goog.events.listen(transition, goog.fx.Transition.EventType.STOP,
- function() {
- stopHandlerCalled = true;
- });
-
- assertFalse(transition.play());
-
- assertTrue(beginHandlerCalled);
- assertTrue(playHandlerCalled);
- assertTrue(endHandlerCalled);
- assertTrue(finishHandlerCalled);
-
- transition.stop();
-
- assertFalse(stopHandlerCalled);
-}
-
-
-function testCallingStopDuringAnimationWorks() {
- if (!goog.style.transition.isSupported()) return;
-
- transition = createTransition(element, 10);
-
- var stopHandler = goog.testing.recordFunction();
- var endHandler = goog.testing.recordFunction();
- var finishHandler = goog.testing.recordFunction();
- goog.events.listen(transition, goog.fx.Transition.EventType.STOP,
- stopHandler);
- goog.events.listen(transition, goog.fx.Transition.EventType.END,
- endHandler);
- goog.events.listen(transition, goog.fx.Transition.EventType.FINISH,
- finishHandler);
-
- transition.play();
- mockClock.tick(1);
- transition.stop();
- assertEquals(1, stopHandler.getCallCount());
- assertEquals(1, endHandler.getCallCount());
- mockClock.tick(10000);
- assertEquals(0, finishHandler.getCallCount());
-}
-
-
-function testCallingStopImmediatelyWorks() {
- if (!goog.style.transition.isSupported()) return;
-
- transition = createTransition(element, 10);
-
- var stopHandler = goog.testing.recordFunction();
- var endHandler = goog.testing.recordFunction();
- var finishHandler = goog.testing.recordFunction();
- goog.events.listen(transition, goog.fx.Transition.EventType.STOP,
- stopHandler);
- goog.events.listen(transition, goog.fx.Transition.EventType.END,
- endHandler);
- goog.events.listen(transition, goog.fx.Transition.EventType.FINISH,
- finishHandler);
-
- transition.play();
- transition.stop();
- assertEquals(1, stopHandler.getCallCount());
- assertEquals(1, endHandler.getCallCount());
- mockClock.tick(10000);
- assertEquals(0, finishHandler.getCallCount());
-}
-
-function testCallingStopAfterAnimationDoesNothing() {
- if (!goog.style.transition.isSupported()) return;
-
- transition = createTransition(element, 10);
-
- var stopHandler = goog.testing.recordFunction();
- var endHandler = goog.testing.recordFunction();
- var finishHandler = goog.testing.recordFunction();
- goog.events.listen(transition, goog.fx.Transition.EventType.STOP,
- stopHandler);
- goog.events.listen(transition, goog.fx.Transition.EventType.END,
- endHandler);
- goog.events.listen(transition, goog.fx.Transition.EventType.FINISH,
- finishHandler);
-
- transition.play();
- mockClock.tick(10000);
- transition.stop();
- assertEquals(0, stopHandler.getCallCount());
- assertEquals(1, endHandler.getCallCount());
- assertEquals(1, finishHandler.getCallCount());
-}
-</script>
-</body>
-</html>