| Index: third_party/pkg/angular/test/core/templateurl_spec.dart
|
| ===================================================================
|
| --- third_party/pkg/angular/test/core/templateurl_spec.dart (revision 33054)
|
| +++ third_party/pkg/angular/test/core/templateurl_spec.dart (working copy)
|
| @@ -18,7 +18,7 @@
|
| @NgComponent(
|
| selector: 'html-and-css',
|
| templateUrl: 'simple.html',
|
| - cssUrl: const ['simple.css', 'another.css'])
|
| + cssUrls: const ['simple.css', 'another.css'])
|
| class HtmlAndMultipleCssComponent {
|
| }
|
|
|
| @@ -47,21 +47,20 @@
|
| describe('loading with http rewriting', () {
|
| beforeEach(module((Module module) {
|
| module
|
| - ..type(HtmlAndCssComponent)
|
| - ..type(UrlRewriter, implementedBy: PrefixedUrlRewriter);
|
| + ..type(HtmlAndCssComponent)
|
| + ..type(UrlRewriter, implementedBy: PrefixedUrlRewriter);
|
| }));
|
|
|
| it('should use the UrlRewriter for both HTML and CSS URLs', async(inject((Http $http,
|
| Compiler $compile, Scope $rootScope, Logger log, Injector injector, NgZone zone,
|
| - MockHttpBackend backend, DirectiveMap directives) {
|
| + MockHttpBackend backend) {
|
|
|
| - backend
|
| - ..whenGET('PREFIX:simple.html').respond('<div log="SIMPLE">Simple!</div>')
|
| - ..whenGET('PREFIX:simple.css').respond('.hello{}');
|
| + backend.whenGET('PREFIX:simple.html').respond('<div log="SIMPLE">Simple!</div>');
|
| + backend.whenGET('PREFIX:simple.css').respond('.hello{}');
|
|
|
| var element = $('<div><html-and-css log>ignore</html-and-css><div>');
|
| zone.run(() {
|
| - $compile(element, directives)(injector, element);
|
| + $compile(element)(injector, element);
|
| });
|
|
|
| backend.flush();
|
| @@ -77,34 +76,33 @@
|
|
|
| describe('async template loading', () {
|
| beforeEach(module((Module module) {
|
| - module
|
| - ..type(LogAttrDirective)
|
| - ..type(SimpleUrlComponent)
|
| - ..type(HtmlAndCssComponent)
|
| - ..type(OnlyCssComponent)
|
| - ..type(InlineWithCssComponent);
|
| + module.type(LogAttrDirective);
|
| + module.type(SimpleUrlComponent);
|
| + module.type(HtmlAndCssComponent);
|
| + module.type(OnlyCssComponent);
|
| + module.type(InlineWithCssComponent);
|
| }));
|
|
|
| it('should replace element with template from url', async(inject((Http $http,
|
| Compiler $compile, Scope $rootScope, Logger log, Injector injector,
|
| - MockHttpBackend backend, DirectiveMap directives) {
|
| + MockHttpBackend backend) {
|
| backend.expectGET('simple.html').respond('<div log="SIMPLE">Simple!</div>');
|
|
|
| var element = $('<div><simple-url log>ignore</simple-url><div>');
|
| - $compile(element, directives)(injector, element);
|
| + $compile(element)(injector, element);
|
|
|
| backend.flush();
|
| microLeap();
|
|
|
| expect(renderedText(element)).toEqual('Simple!');
|
| - $rootScope.apply();
|
| + $rootScope.$digest();
|
| // Note: There is no ordering. It is who ever comes off the wire first!
|
| expect(log.result()).toEqual('LOG; SIMPLE');
|
| })));
|
|
|
| it('should load template from URL once', async(inject((Http $http,
|
| Compiler $compile, Scope $rootScope, Logger log, Injector injector,
|
| - MockHttpBackend backend, DirectiveMap directives) {
|
| + MockHttpBackend backend) {
|
| backend.whenGET('simple.html').respond('<div log="SIMPLE">Simple!</div>');
|
|
|
| var element = $(
|
| @@ -112,26 +110,25 @@
|
| '<simple-url log>ignore</simple-url>' +
|
| '<simple-url log>ignore</simple-url>' +
|
| '<div>');
|
| - $compile(element, directives)(injector, element);
|
| + $compile(element)(injector, element);
|
|
|
| backend.flush();
|
| microLeap();
|
|
|
| expect(renderedText(element)).toEqual('Simple!Simple!');
|
| - $rootScope.apply();
|
| + $rootScope.$digest();
|
| // Note: There is no ordering. It is who ever comes off the wire first!
|
| expect(log.result()).toEqual('LOG; LOG; SIMPLE; SIMPLE');
|
| })));
|
|
|
| it('should load a CSS file into a style', async(inject((Http $http,
|
| Compiler $compile, Scope $rootScope, Logger log, Injector injector,
|
| - MockHttpBackend backend, DirectiveMap directives) {
|
| - backend
|
| - ..expectGET('simple.css').respond('.hello{}')
|
| - ..expectGET('simple.html').respond('<div log="SIMPLE">Simple!</div>');
|
| + MockHttpBackend backend) {
|
| + backend.expectGET('simple.css').respond('.hello{}');
|
| + backend.expectGET('simple.html').respond('<div log="SIMPLE">Simple!</div>');
|
|
|
| var element = $('<div><html-and-css log>ignore</html-and-css><div>');
|
| - $compile(element, directives)(injector, element);
|
| + $compile(element)(injector, element);
|
|
|
| backend.flush();
|
| microLeap();
|
| @@ -140,45 +137,27 @@
|
| expect(element[0].nodes[0].shadowRoot.innerHtml).toEqual(
|
| '<style>.hello{}</style><div log="SIMPLE">Simple!</div>'
|
| );
|
| - $rootScope.apply();
|
| + $rootScope.$digest();
|
| // Note: There is no ordering. It is who ever comes off the wire first!
|
| expect(log.result()).toEqual('LOG; SIMPLE');
|
| })));
|
|
|
| it('should load a CSS file with a \$template', async(inject((Http $http,
|
| - Compiler $compile, Scope $rootScope, Injector injector,
|
| - MockHttpBackend backend, DirectiveMap directives) {
|
| + Compiler $compile, Scope $rootScope, Injector injector, MockHttpBackend backend) {
|
| var element = $('<div><inline-with-css log>ignore</inline-with-css><div>');
|
| backend.expectGET('simple.css').respond('.hello{}');
|
| - $compile(element, directives)(injector, element);
|
| + $compile(element)(injector, element);
|
|
|
| backend.flush();
|
| microLeap();
|
| expect(renderedText(element)).toEqual('.hello{}inline!');
|
| })));
|
|
|
| - it('should ignore CSS load errors ', async(inject((Http $http,
|
| - Compiler $compile, Scope $rootScope, Injector injector,
|
| - MockHttpBackend backend, DirectiveMap directives) {
|
| - var element = $('<div><inline-with-css log>ignore</inline-with-css><div>');
|
| - backend.expectGET('simple.css').respond(500, 'some error');
|
| - $compile(element, directives)(injector, element);
|
| -
|
| - backend.flush();
|
| - microLeap();
|
| - expect(renderedText(element)).toEqual(
|
| - '/*\n'
|
| - 'HTTP 500: some error\n'
|
| - '*/\n'
|
| - 'inline!');
|
| - })));
|
| -
|
| it('should load a CSS with no template', async(inject((Http $http,
|
| - Compiler $compile, Scope $rootScope, Injector injector,
|
| - MockHttpBackend backend, DirectiveMap directives) {
|
| + Compiler $compile, Scope $rootScope, Injector injector, MockHttpBackend backend) {
|
| var element = $('<div><only-css log>ignore</only-css><div>');
|
| backend.expectGET('simple.css').respond('.hello{}');
|
| - $compile(element, directives)(injector, element);
|
| + $compile(element)(injector, element);
|
|
|
| backend.flush();
|
| microLeap();
|
| @@ -186,14 +165,12 @@
|
| })));
|
|
|
| it('should load the CSS before the template is loaded', async(inject((Http $http,
|
| - Compiler $compile, Scope $rootScope, Injector injector,
|
| - MockHttpBackend backend, DirectiveMap directives) {
|
| - backend
|
| - ..expectGET('simple.css').respond('.hello{}')
|
| - ..expectGET('simple.html').respond('<div>Simple!</div>');
|
| + Compiler $compile, Scope $rootScope, Injector injector, MockHttpBackend backend) {
|
| + backend.expectGET('simple.css').respond('.hello{}');
|
| + backend.expectGET('simple.html').respond('<div>Simple!</div>');
|
|
|
| var element = $('<html-and-css>ignore</html-and-css>');
|
| - $compile(element, directives)(injector, element);
|
| + $compile(element)(injector, element);
|
|
|
| backend.flush();
|
| microLeap();
|
| @@ -203,21 +180,19 @@
|
|
|
| describe('multiple css loading', () {
|
| beforeEach(module((Module module) {
|
| - module
|
| - ..type(LogAttrDirective)
|
| - ..type(HtmlAndMultipleCssComponent);
|
| + module.type(LogAttrDirective);
|
| + module.type(HtmlAndMultipleCssComponent);
|
| }));
|
|
|
| it('should load multiple CSS files into a style', async(inject((Http $http,
|
| Compiler $compile, Scope $rootScope, Logger log, Injector injector,
|
| - MockHttpBackend backend, DirectiveMap directives) {
|
| - backend
|
| - ..expectGET('simple.css').respond('.hello{}')
|
| - ..expectGET('another.css').respond('.world{}')
|
| - ..expectGET('simple.html').respond('<div log="SIMPLE">Simple!</div>');
|
| + MockHttpBackend backend) {
|
| + backend.expectGET('simple.css').respond('.hello{}');
|
| + backend.expectGET('another.css').respond('.world{}');
|
| + backend.expectGET('simple.html').respond('<div log="SIMPLE">Simple!</div>');
|
|
|
| var element = $('<div><html-and-css log>ignore</html-and-css><div>');
|
| - $compile(element, directives)(injector, element);
|
| + $compile(element)(injector, element);
|
|
|
| backend.flush();
|
| microLeap();
|
| @@ -226,7 +201,7 @@
|
| expect(element[0].nodes[0].shadowRoot.innerHtml).toEqual(
|
| '<style>.hello{}.world{}</style><div log="SIMPLE">Simple!</div>'
|
| );
|
| - $rootScope.apply();
|
| + $rootScope.$digest();
|
| // Note: There is no ordering. It is who ever comes off the wire first!
|
| expect(log.result()).toEqual('LOG; SIMPLE');
|
| })));
|
|
|