| Index: third_party/pkg/angular/test/directive/ng_src_boolean_spec.dart
|
| diff --git a/third_party/pkg/angular/test/directive/ng_src_boolean_spec.dart b/third_party/pkg/angular/test/directive/ng_src_boolean_spec.dart
|
| index e9a8a17954328fb652f06df915cd3cf1ab7824b5..8062ded57d478b1f7d785576b40cc88d1f9c30a8 100644
|
| --- a/third_party/pkg/angular/test/directive/ng_src_boolean_spec.dart
|
| +++ b/third_party/pkg/angular/test/directive/ng_src_boolean_spec.dart
|
| @@ -6,10 +6,10 @@ import 'dart:html' as dom;
|
| main() {
|
| describe('boolean attr directives', () {
|
| TestBed _;
|
| - beforeEach(inject((TestBed tb) => _ = tb));
|
| + beforeEach((TestBed tb) => _ = tb);
|
|
|
|
|
| - it('should properly evaluate 0 as false', inject(() {
|
| + it('should properly evaluate 0 as false', () {
|
| _.compile('<button ng-disabled="isDisabled">Button</button>');
|
| _.rootScope.context['isDisabled'] = 0;
|
| _.rootScope.apply();
|
| @@ -17,10 +17,10 @@ main() {
|
| _.rootScope.context['isDisabled'] = 1;
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['disabled']).toBeTruthy();
|
| - }));
|
| + });
|
|
|
|
|
| - it('should bind disabled', inject(() {
|
| + it('should bind disabled', () {
|
| _.compile('<button ng-disabled="isDisabled">Button</button>');
|
| _.rootScope.context['isDisabled'] = false;
|
| _.rootScope.apply();
|
| @@ -28,10 +28,10 @@ main() {
|
| _.rootScope.context['isDisabled'] = true;
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['disabled']).toBeTruthy();
|
| - }));
|
| + });
|
|
|
|
|
| - it('should bind checked', inject(() {
|
| + it('should bind checked', () {
|
| _.compile('<input type="checkbox" ng-checked="isChecked" />');
|
| _.rootScope.context['isChecked'] = false;
|
| _.rootScope.apply();
|
| @@ -39,10 +39,10 @@ main() {
|
| _.rootScope.context['isChecked']=true;
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['checked']).toBeTruthy();
|
| - }));
|
| + });
|
|
|
|
|
| - it('should bind selected', inject(() {
|
| + it('should bind selected', () {
|
| _.compile('<select><option value=""></option><option ng-selected="isSelected">Greetings!</option></select>');
|
| _.rootScope.context['isSelected']=false;
|
| _.rootScope.apply();
|
| @@ -50,10 +50,10 @@ main() {
|
| _.rootScope.context['isSelected']=true;
|
| _.rootScope.apply();
|
| expect((_.rootElement.childNodes[1] as dom.OptionElement).selected).toBeTruthy();
|
| - }));
|
| + });
|
|
|
|
|
| - it('should bind readonly', inject(() {
|
| + it('should bind readonly', () {
|
| _.compile('<input type="text" ng-readonly="isReadonly" />');
|
| _.rootScope.context['isReadonly']=false;
|
| _.rootScope.apply();
|
| @@ -61,10 +61,10 @@ main() {
|
| _.rootScope.context['isReadonly']=true;
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['readOnly']).toBeTruthy();
|
| - }));
|
| + });
|
|
|
|
|
| - it('should bind open', inject(() {
|
| + it('should bind open', () {
|
| _.compile('<details ng-open="isOpen"></details>');
|
| _.rootScope.context['isOpen']=false;
|
| _.rootScope.apply();
|
| @@ -72,11 +72,11 @@ main() {
|
| _.rootScope.context['isOpen']=true;
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['open']).toBeTruthy();
|
| - }));
|
| + });
|
|
|
|
|
| describe('multiple', () {
|
| - it('should NOT bind to multiple via ngMultiple', inject(() {
|
| + it('should NOT bind to multiple via ngMultiple', () {
|
| _.compile('<select ng-multiple="isMultiple"></select>');
|
| _.rootScope.context['isMultiple']=false;
|
| _.rootScope.apply();
|
| @@ -84,52 +84,51 @@ main() {
|
| _.rootScope.context['isMultiple']='multiple';
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['multiple']).toBeFalsy(); // ignore
|
| - }));
|
| + });
|
| });
|
| });
|
|
|
|
|
| describe('ngSrc', () {
|
| TestBed _;
|
| - beforeEach(inject((TestBed tb) => _ = tb));
|
| + beforeEach((TestBed tb) => _ = tb);
|
|
|
| - it('should interpolate the expression and bind to src with raw same-domain value',
|
| - inject(() {
|
| + it('should interpolate the expression and bind to src with raw same-domain value', () {
|
| _.compile('<div ng-src="{{id}}"></div>');
|
|
|
| _.rootScope.apply();
|
| - expect(_.rootElement.attributes['src']).toEqual('');
|
| + expect(_.rootElement.attributes['src']).toEqual(null);
|
|
|
| _.rootScope.apply(() {
|
| _.rootScope.context['id'] = '/somewhere/here';
|
| });
|
| expect(_.rootElement.attributes['src']).toEqual('/somewhere/here');
|
| - }));
|
| + });
|
|
|
|
|
| - xit('should interpolate the expression and bind to src with a trusted value', inject(($sce) {
|
| + xit('should interpolate the expression and bind to src with a trusted value', (sce) {
|
| _.compile('<div ng-src="{{id}}"></div>');
|
|
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['src']).toEqual(null);
|
|
|
| _.rootScope.apply(() {
|
| - _.rootScope.context['id'] = $sce.trustAsResourceUrl('http://somewhere');
|
| + _.rootScope.context['id'] = sce.trustAsResourceUrl('http://somewhere');
|
| });
|
| expect(_.rootElement.attributes['src']).toEqual('http://somewhere');
|
| - }));
|
| + });
|
|
|
|
|
| - xit('should NOT interpolate a multi-part expression for non-img src attribute', inject(() {
|
| + xit('should NOT interpolate a multi-part expression for non-img src attribute', () {
|
| expect(() {
|
| _.compile('<div ng-src="some/{{id}}"></div>');
|
| }).toThrow("Error while interpolating: some/{{id}}\nStrict " +
|
| "Contextual Escaping disallows interpolations that concatenate multiple expressions " +
|
| - "when a trusted value is required. See http://docs.angularjs.org/api/ng.\$sce");
|
| - }));
|
| + "when a trusted value is required. See http://docs.angularjs.org/api/ng.sce");
|
| + });
|
|
|
|
|
| - it('should interpolate a multi-part expression for regular attributes', inject(() {
|
| + it('should interpolate a multi-part expression for regular attributes', () {
|
| _.compile('<div foo="some/{{id}}"></div>');
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['foo']).toEqual('some/');
|
| @@ -137,28 +136,28 @@ main() {
|
| _.rootScope.context['id'] = 1;
|
| });
|
| expect(_.rootElement.attributes['foo']).toEqual('some/1');
|
| - }));
|
| + });
|
|
|
|
|
| - xit('should NOT interpolate a wrongly typed expression', inject(($sce) {
|
| + xit('should NOT interpolate a wrongly typed expression', (sce) {
|
| expect(() {
|
| _.compile('<div ng-src="{{id}}"></div>');
|
| _.rootScope.apply(() {
|
| - _.rootScope.context['id'] = $sce.trustAsUrl('http://somewhere');
|
| + _.rootScope.context['id'] = sce.trustAsUrl('http://somewhere');
|
| });
|
| _.rootElement.attributes['src'];
|
| - }).toThrow("Can't interpolate: {{id}}\nError: [\$sce:insecurl] Blocked " +
|
| - "loading resource from url not allowed by \$sceDelegate policy. URL: http://somewhere");
|
| - }));
|
| + }).toThrow("Can't interpolate: {{id}}\nError: [sce:insecurl] Viewed " +
|
| + "loading resource from url not allowed by sceDelegate policy. URL: http://somewhere");
|
| + });
|
|
|
| });
|
|
|
|
|
| describe('ngSrcset', () {
|
| TestBed _;
|
| - beforeEach(inject((TestBed tb) => _ = tb));
|
| + beforeEach((TestBed tb) => _ = tb);
|
|
|
| - it('should interpolate the expression and bind to srcset', inject(() {
|
| + it('should interpolate the expression and bind to srcset', () {
|
| _.compile('<div ng-srcset="some/{{id}} 2x"></div>');
|
|
|
| _.rootScope.apply();
|
| @@ -168,15 +167,15 @@ main() {
|
| _.rootScope.context['id'] = 1;
|
| });
|
| expect(_.rootElement.attributes['srcset']).toEqual('some/1 2x');
|
| - }));
|
| + });
|
| });
|
|
|
|
|
| describe('ngHref', () {
|
| TestBed _;
|
| - beforeEach(inject((TestBed tb) => _ = tb));
|
| + beforeEach((TestBed tb) => _ = tb);
|
|
|
| - it('should interpolate the expression and bind to href', inject(() {
|
| + it('should interpolate the expression and bind to href', () {
|
| _.compile('<div ng-href="some/{{id}}"></div>');
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['href']).toEqual('some/');
|
| @@ -185,31 +184,31 @@ main() {
|
| _.rootScope.context['id'] = 1;
|
| });
|
| expect(_.rootElement.attributes['href']).toEqual('some/1');
|
| - }));
|
| + });
|
|
|
|
|
| - it('should bind href and merge with other attrs', inject(() {
|
| + it('should bind href and merge with other attrs', () {
|
| _.compile('<a ng-href="{{url}}" rel="{{rel}}"></a>');
|
| _.rootScope.context['url'] = 'http://server';
|
| _.rootScope.context['rel'] = 'REL';
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['href']).toEqual('http://server');
|
| expect(_.rootElement.attributes['rel']).toEqual('REL');
|
| - }));
|
| + });
|
|
|
|
|
| - it('should bind href even if no interpolation', inject(() {
|
| + it('should bind href even if no interpolation', () {
|
| _.compile('<a ng-href="http://server"></a>');
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['href']).toEqual('http://server');
|
| - }));
|
| + });
|
| });
|
|
|
| describe('ngAttr', () {
|
| TestBed _;
|
| - beforeEach(inject((TestBed tb) => _ = tb));
|
| + beforeEach((TestBed tb) => _ = tb);
|
|
|
| - it('should interpolate the expression and bind to *', inject(() {
|
| + it('should interpolate the expression and bind to *', () {
|
| _.compile('<div ng-attr-foo="some/{{id}}"></div>');
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['foo']).toEqual('some/');
|
| @@ -218,10 +217,10 @@ main() {
|
| _.rootScope.context['id'] = 1;
|
| });
|
| expect(_.rootElement.attributes['foo']).toEqual('some/1');
|
| - }));
|
| + });
|
|
|
|
|
| - it('should bind * and merge with other attrs', inject(() {
|
| + it('should bind * and merge with other attrs', () {
|
| _.compile('<div ng-attr-bar="{{bar}}" ng-attr-bar2="{{bar2}}" bam="{{bam}}"></a>');
|
| _.rootScope.context['bar'] = 'foo';
|
| _.rootScope.context['bar2'] = 'foo2';
|
| @@ -237,13 +236,13 @@ main() {
|
| expect(_.rootElement.attributes['bar']).toEqual('FOO');
|
| expect(_.rootElement.attributes['bar2']).toEqual('FOO2');
|
| expect(_.rootElement.attributes['bam']).toEqual('BOOM');
|
| - }));
|
| + });
|
|
|
|
|
| - it('should bind * even if no interpolation', inject(() {
|
| + it('should bind * even if no interpolation', () {
|
| _.compile('<a ng-attr-quack="vanilla"></a>');
|
| _.rootScope.apply();
|
| expect(_.rootElement.attributes['quack']).toEqual('vanilla');
|
| - }));
|
| + });
|
| });
|
| }
|
|
|