Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: third_party/pkg/angular/test/animate/ng_animate_spec.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/test/animate/ng_animate_spec.dart
diff --git a/third_party/pkg/angular/test/animate/ng_animate_spec.dart b/third_party/pkg/angular/test/animate/ng_animate_spec.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f9479c58361ab469db9c39010eec09b25c593e8c
--- /dev/null
+++ b/third_party/pkg/angular/test/animate/ng_animate_spec.dart
@@ -0,0 +1,87 @@
+library ng_animate_spec;
+
+import '../_specs.dart';
+
+main() {
+ module((Module module) {
+ module
+ ..type(AnimationOptimizer)
+ ..type(NgAnimate)
+ ..type(NgAnimateChildren);
+ });
+ describe('ng-animate', () {
+ TestBed _;
+ AnimationOptimizer optimizer;
+ beforeEach(() {
+ setUpInjector();
+ module((Module module) {
+ module
+ ..type(AnimationOptimizer)
+ ..type(NgAnimate)
+ ..type(NgAnimateChildren);
+ });
+ inject((TestBed tb, AnimationOptimizer opt) {
+ _ = tb;
+ optimizer = opt;
+ });
+ });
+
+ afterEach(() {
+ tearDownInjector();
+ });
+
+ it('should control animations on elements', () {
+ _.compile('<div ng-animate="never"><div></div></div>');
+ _.rootScope.apply();
+
+ expect(optimizer.shouldAnimate(_.rootElement)).toBeFalsy();
+ expect(optimizer.shouldAnimate(_.rootElement.children[0])).toBeTruthy();
+
+ _.compile('<div ng-animate="always">'
+ + '<div ng-animate="never"></div></div>');
+ _.rootScope.apply();
+ expect(optimizer.shouldAnimate(_.rootElement)).toBeTruthy();
+ expect(optimizer.shouldAnimate(_.rootElement.children[0])).toBeFalsy();
+
+
+ _.compile('<div ng-animate="never">'
+ + '<div ng-animate="always"></div></div>');
+ _.rootScope.apply();
+ expect(optimizer.shouldAnimate(_.rootElement)).toBeFalsy();
+ expect(optimizer.shouldAnimate(_.rootElement.children[0])).toBeTruthy();
+ });
+
+ it('should control animations and override running animations', () {
+ var animation = new NoOpAnimation();
+ _.compile('<div><div ng-animate="always"></div></div>');
+ _.rootScope.apply();
+ optimizer.track(animation, _.rootElement);
+ expect(optimizer.shouldAnimate(_.rootElement)).toBeTruthy();
+ expect(optimizer.shouldAnimate(_.rootElement.children[0])).toBeTruthy();
+
+ animation = new NoOpAnimation();
+ _.compile('<div><div ng-animate="auto"></div></div>');
+ _.rootScope.apply();
+ optimizer.track(animation, _.rootElement);
+ expect(optimizer.shouldAnimate(_.rootElement)).toBeTruthy();
+ expect(optimizer.shouldAnimate(_.rootElement.children[0])).toBeFalsy();
+ });
+
+ describe("children", () {
+ it('should prevent child animations', () {
+ _.compile('<div ng-animate-children="never"><div></div></div>');
+
+ expect(optimizer.shouldAnimate(_.rootElement)).toBeTruthy();
+ expect(optimizer.shouldAnimate(_.rootElement.children[0])).toBeFalsy();
+ });
+
+ it('should forcibly allow child animations', () {
+ _.compile('<div ng-animate-children="always"><div></div></div>');
+ optimizer.track(new NoOpAnimation(), _.rootElement);
+
+ expect(optimizer.shouldAnimate(_.rootElement)).toBeTruthy();
+ expect(optimizer.shouldAnimate(_.rootElement.children[0])).toBeTruthy();
+ });
+ });
+ });
+}
« no previous file with comments | « third_party/pkg/angular/test/animate/css_animation_spec.dart ('k') | third_party/pkg/angular/test/bootstrap_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698