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

Unified Diff: third_party/pkg/angular/test/directive/ng_style_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/directive/ng_style_spec.dart
diff --git a/third_party/pkg/angular/test/directive/ng_style_spec.dart b/third_party/pkg/angular/test/directive/ng_style_spec.dart
index 8406a14cc287eddf9c32ec97d4cfdcb31ac3fea3..ccbac6174b22ced579f1bc0bfed7da07b5ef6d90 100644
--- a/third_party/pkg/angular/test/directive/ng_style_spec.dart
+++ b/third_party/pkg/angular/test/directive/ng_style_spec.dart
@@ -3,84 +3,82 @@ library ng_style_spec;
import '../_specs.dart';
import 'dart:html' as dom;
-main() => describe('NgStyle', () {
- TestBed _;
+void main() {
+ describe('NgStyle', () {
+ TestBed _;
- beforeEach(inject((TestBed tb) => _ = tb));
+ beforeEach((TestBed tb) => _ = tb);
- it('should set', () {
- dom.Element element = _.compile('<div ng-style="{height: \'40px\'}"></div>');
- _.rootScope.apply();
- expect(element.style.height).toEqual('40px');
- });
-
-
- it('should silently ignore undefined style', () {
- dom.Element element = _.compile('<div ng-style="myStyle"></div>');
- _.rootScope.apply();
- expect(element.classes.contains('ng-exception')).toBeFalsy();
- });
-
-
- describe('preserving styles set before and after compilation', () {
- var scope, preCompStyle, preCompVal, postCompStyle, postCompVal, element;
-
- beforeEach(inject(() {
- preCompStyle = 'width';
- preCompVal = '300px';
- postCompStyle = 'height';
- postCompVal = '100px';
- element = $('<div ng-style="styleObj"></div>');
- element.css(preCompStyle, preCompVal);
- document.body.append(element[0]);
- _.compile(element);
- scope = _.rootScope;
- scope.context['styleObj'] = {'margin-top': '44px'};
- scope.apply();
- element.css(postCompStyle, postCompVal);
- }));
-
- afterEach(() {
- element.remove(null);
- });
-
-
- it('should not mess up stuff after compilation', () {
- element.css('margin', '44px');
- expect(element.css(preCompStyle)).toEqual(preCompVal);
- expect(element.css('margin-top')).toEqual('44px');
- expect(element.css(postCompStyle)).toEqual(postCompVal);
- });
-
- it(r'should not mess up stuff after $apply with no model changes', () {
- element.css('padding-top', '33px');
- scope.apply();
- expect(element.css(preCompStyle)).toEqual(preCompVal);
- expect(element.css('margin-top')).toEqual('44px');
- expect(element.css(postCompStyle)).toEqual(postCompVal);
- expect(element.css('padding-top')).toEqual('33px');
+ it('should set', () {
+ dom.Element element = _.compile('<div ng-style="{height: \'40px\'}"></div>');
+ _.rootScope.apply();
+ expect(element.style.height).toEqual('40px');
});
- it(r'should not mess up stuff after $apply with non-colliding model changes', () {
- scope.context['styleObj'] = {'padding-top': '99px'};
- scope.apply();
- expect(element.css(preCompStyle)).toEqual(preCompVal);
- expect(element.css('margin-top')).not.toEqual('44px');
- expect(element.css('padding-top')).toEqual('99px');
- expect(element.css(postCompStyle)).toEqual(postCompVal);
+ it('should silently ignore undefined style', () {
+ dom.Element element = _.compile('<div ng-style="myStyle"></div>');
+ _.rootScope.apply();
+ expect(element).not.toHaveClass('ng-exception');
});
- it(r'should overwrite original styles after a colliding model change', () {
- scope.context['styleObj'] = {'height': '99px', 'width': '88px'};
- scope.apply();
- expect(element.css(preCompStyle)).toEqual('88px');
- expect(element.css(postCompStyle)).toEqual('99px');
- scope.context['styleObj'] = {};
- scope.apply();
- expect(element.css(preCompStyle)).not.toEqual('88px');
- expect(element.css(postCompStyle)).not.toEqual('99px');
+ describe('preserving styles set before and after compilation', () {
+ var scope, preCompStyle, widthVal, postCompStyle, heightVal;
+ Element element;
+
+ beforeEach(() {
+ preCompStyle = 'width';
+ widthVal = '300px';
+ postCompStyle = 'height';
+ heightVal = '100px';
+ element = e('<div ng-style="styleObj"></div>');
+ element.style.width = widthVal;
+ document.body.append(element);
+ _.compile(element);
+ scope = _.rootScope;
+ scope.context['styleObj'] = {'margin-top': '44px'};
+ scope.apply();
+ element.style.height = heightVal;
+ });
+
+ it('should not mess up stuff after compilation', () {
+ element.style.margin = '44px';
+ expect(element.style.width).toEqual(widthVal);
+ expect(element.style.marginTop).toEqual('44px');
+ expect(element.style.height).toEqual(heightVal);
+ });
+
+ it(r'should not mess up stuff after $apply with no model changes', () {
+ element.style.paddingTop = '33px';
+ scope.apply();
+ expect(element.style.width).toEqual(widthVal);
+ expect(element.style.marginTop).toEqual('44px');
+ expect(element.style.height).toEqual(heightVal);
+ expect(element.style.paddingTop).toEqual('33px');
+ });
+
+
+ it(r'should not mess up stuff after $apply with non-colliding model changes', () {
+ scope.context['styleObj'] = {'padding-top': '99px'};
+ scope.apply();
+ expect(element.style.width).toEqual(widthVal);
+ expect(element.style.marginTop).not.toEqual('44px');
+ expect(element.style.paddingTop).toEqual('99px');
+ expect(element.style.height).toEqual(heightVal);
+ });
+
+
+ it(r'should overwrite original styles after a colliding model change', () {
+ scope.context['styleObj'] = {'height': '99px', 'width': '88px'};
+ scope.apply();
+ expect(element.style.width).toEqual('88px');
+ expect(element.style.height).toEqual('99px');
+ scope.context['styleObj'] = {};
+ scope.apply();
+ expect(element.style.width).not.toEqual('88px');
+ expect(element.style.height).not.toEqual('99px');
+ });
});
});
-});
+}

Powered by Google App Engine
This is Rietveld 408576698