From 0281c0631375b76eb0594f07bf28222cfe76abcd Mon Sep 17 00:00:00 2001 From: Marko Vuksanovic Date: Fri, 4 Apr 2014 21:59:44 +1100 Subject: [PATCH] style: Rename variables of the form $name into name . Closes #854 --- lib/core/interpolate.dart | 4 +- lib/core_dom/view_factory.dart | 18 ++-- lib/directive/ng_a.dart | 2 +- lib/mock/http_backend.dart | 108 ++++++++++++------------ test/core/interpolate_spec.dart | 26 +++--- test/core/templateurl_spec.dart | 45 +++++----- test/core_dom/compiler_spec.dart | 14 +-- test/core_dom/http_spec.dart | 6 +- test/core_dom/ng_mustache_spec.dart | 16 ++-- test/directive/ng_repeat_spec.dart | 48 +++++------ test/directive/ng_src_boolean_spec.dart | 14 +-- test/mock/test_bed_spec.dart | 4 +- 12 files changed, 153 insertions(+), 152 deletions(-) diff --git a/lib/core/interpolate.dart b/lib/core/interpolate.dart index 84968cbae..1060596e8 100644 --- a/lib/core/interpolate.dart +++ b/lib/core/interpolate.dart @@ -4,8 +4,8 @@ part of angular.core_internal; * Compiles a string with markup into an expression. This service is used by the * HTML [Compiler] service for data binding. * - * var $interpolate = ...; // injected - * var exp = $interpolate('Hello {{name}}!'); + * var interpolate = ...; // injected + * var exp = interpolate('Hello {{name}}!'); * expect(exp).toEqual('"Hello "+(name)+"!"'); */ @NgInjectableService() diff --git a/lib/core_dom/view_factory.dart b/lib/core_dom/view_factory.dart index 00f6b9cdf..89898814e 100644 --- a/lib/core_dom/view_factory.dart +++ b/lib/core_dom/view_factory.dart @@ -119,12 +119,12 @@ class WalkingViewFactory implements ViewFactory { class ViewCache { // _viewFactoryCache is unbounded final _viewFactoryCache = new LruCache(capacity: 0); - final Http $http; - final TemplateCache $templateCache; + final Http http; + final TemplateCache templateCache; final Compiler compiler; final dom.NodeTreeSanitizer treeSanitizer; - ViewCache(this.$http, this.$templateCache, this.compiler, this.treeSanitizer); + ViewCache(this.http, this.templateCache, this.compiler, this.treeSanitizer); ViewFactory fromHtml(String html, DirectiveMap directives) { ViewFactory viewFactory = _viewFactoryCache.get(html); @@ -138,7 +138,7 @@ class ViewCache { } async.Future fromUrl(String url, DirectiveMap directives) { - return $http.getString(url, cache: $templateCache).then( + return http.getString(url, cache: templateCache).then( (html) => fromHtml(html, directives)); } } @@ -165,7 +165,7 @@ class _ComponentFactory implements Function { this._expando); dynamic call(Injector injector, Scope scope, - ViewCache $viewCache, Http $http, TemplateCache $templateCache, + ViewCache viewCache, Http http, TemplateCache templateCache, DirectiveMap directives) { shadowDom = element.createShadowRoot() ..applyAuthorStyles = component.applyAuthorStyles @@ -180,8 +180,8 @@ class _ComponentFactory implements Function { List> cssFutures = new List(); var cssUrls = component.cssUrls; if (cssUrls.isNotEmpty) { - cssUrls.forEach((css) => cssFutures.add($http - .getString(css, cache: $templateCache) + cssUrls.forEach((css) => cssFutures.add(http + .getString(css, cache: templateCache) .catchError((e) => '/*\n$e\n*/\n') )); } else { @@ -189,10 +189,10 @@ class _ComponentFactory implements Function { } var viewFuture; if (component.template != null) { - viewFuture = new async.Future.value($viewCache.fromHtml( + viewFuture = new async.Future.value(viewCache.fromHtml( component.template, directives)); } else if (component.templateUrl != null) { - viewFuture = $viewCache.fromUrl(component.templateUrl, directives); + viewFuture = viewCache.fromUrl(component.templateUrl, directives); } TemplateLoader templateLoader = new TemplateLoader( async.Future.wait(cssFutures).then((Iterable cssList) { diff --git a/lib/directive/ng_a.dart b/lib/directive/ng_a.dart index deb9f1c1a..74f2b6521 100644 --- a/lib/directive/ng_a.dart +++ b/lib/directive/ng_a.dart @@ -11,7 +11,7 @@ part of angular.directive; * * This change permits the easy creation of action links with the `ngClick` * directive without changing the location or causing page reloads, e.g.: - * `Save` + * `Save` */ @NgDirective(selector: 'a[href]') class NgA { diff --git a/lib/mock/http_backend.dart b/lib/mock/http_backend.dart index 5108b8fb4..59f60719c 100644 --- a/lib/mock/http_backend.dart +++ b/lib/mock/http_backend.dart @@ -9,36 +9,36 @@ import 'package:angular/utils.dart' as utils; class _MockXhr { - var $$method, $$url, $$async, $$reqHeaders, $$respHeaders; + var method, url, async, reqHeaders, respHeaders; void open(method, url, async) { - $$method = method; - $$url = url; - $$async = async; - $$reqHeaders = {}; - $$respHeaders = {}; + this.method = method; + this.url = url; + this.async = async; + reqHeaders = {}; + respHeaders = {}; } - var $$data; + var data; void send(data) { - $$data = data; + data = data; } void setRequestHeader(key, value) { - $$reqHeaders[key] = value; + reqHeaders[key] = value; } String getResponseHeader(name) { // the lookup must be case insensitive, that's why we try two quick // lookups and full scan at last - if ($$respHeaders.containsKey(name)) return $$respHeaders[name]; + if (respHeaders.containsKey(name)) return respHeaders[name]; name = name.toLowerCase(); - if ($$respHeaders.containsKey(name)) return $$respHeaders[name]; + if (respHeaders.containsKey(name)) return respHeaders[name]; String header = null; - $$respHeaders.forEach((headerName, headerVal) { + respHeaders.forEach((headerName, headerVal) { if (header != null) return; if (headerName.toLowerCase()) header = headerVal; }); @@ -46,11 +46,11 @@ class _MockXhr { } getAllResponseHeaders() { - if ($$respHeaders == null) return ''; + if (respHeaders == null) return ''; var lines = []; - $$respHeaders.forEach((key, value) { + respHeaders.forEach((key, value) { lines.add("$key: $value"); }); return lines.join('\n'); @@ -177,7 +177,7 @@ class MockHttpBackend implements HttpBackend { var wrapResponse = (wrapped) { var handleResponse = () { var response = wrapped.response(method, url, data, headers); - xhr.$$respHeaders = response[2]; + xhr.respHeaders = response[2]; utils.relaxFnApply(callback, [response[0], response[1], xhr.getAllResponseHeaders()]); }; @@ -260,8 +260,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#whenGET - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#whenGET + * @methodOf ngMock.httpBackend * @description * Creates a new backend definition for GET requests. For more info see `when()`. * @@ -274,8 +274,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#whenDELETE - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#whenDELETE + * @methodOf ngMock.httpBackend * @description * Creates a new backend definition for DELETE requests. For more info see `when()`. * @@ -288,8 +288,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#whenJSONP - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#whenJSONP + * @methodOf ngMock.httpBackend * @description * Creates a new backend definition for JSONP requests. For more info see `when()`. * @@ -301,8 +301,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#whenPUT - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#whenPUT + * @methodOf ngMock.httpBackend * @description * Creates a new backend definition for PUT requests. For more info see `when()`. * @@ -316,8 +316,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#whenPOST - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#whenPOST + * @methodOf ngMock.httpBackend * @description * Creates a new backend definition for POST requests. For more info see `when()`. * @@ -333,8 +333,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#whenHEAD - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#whenHEAD + * @methodOf ngMock.httpBackend * @description * Creates a new backend definition for HEAD requests. For more info see `when()`. * @@ -346,8 +346,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#expect - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#expect + * @methodOf ngMock.httpBackend * @description * Creates a new request expectation. * @@ -375,8 +375,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#expectGET - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#expectGET + * @methodOf ngMock.httpBackend * @description * Creates a new request expectation for GET requests. For more info see `expect()`. * @@ -389,8 +389,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#expectDELETE - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#expectDELETE + * @methodOf ngMock.httpBackend * @description * Creates a new request expectation for DELETE requests. For more info see `expect()`. * @@ -403,8 +403,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#expectJSONP - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#expectJSONP + * @methodOf ngMock.httpBackend * @description * Creates a new request expectation for JSONP requests. For more info see `expect()`. * @@ -416,8 +416,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#expectPUT - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#expectPUT + * @methodOf ngMock.httpBackend * @description * Creates a new request expectation for PUT requests. For more info see `expect()`. * @@ -431,8 +431,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#expectPOST - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#expectPOST + * @methodOf ngMock.httpBackend * @description * Creates a new request expectation for POST requests. For more info see `expect()`. * @@ -446,8 +446,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#expectPATCH - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#expectPATCH + * @methodOf ngMock.httpBackend * @description * Creates a new request expectation for PATCH requests. For more info see `expect()`. * @@ -461,8 +461,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#expectHEAD - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#expectHEAD + * @methodOf ngMock.httpBackend * @description * Creates a new request expectation for HEAD requests. For more info see `expect()`. * @@ -474,8 +474,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#flush - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#flush + * @methodOf ngMock.httpBackend * @description * Flushes all pending requests using the trained responses. * @@ -502,8 +502,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#verifyNoOutstandingExpectation - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#verifyNoOutstandingExpectation + * @methodOf ngMock.httpBackend * @description * Verifies that all of the requests defined via the `expect` api were made. If any of the * requests were not made, verifyNoOutstandingExpectation throws an exception. @@ -512,7 +512,7 @@ class MockHttpBackend implements HttpBackend { * "afterEach" clause. * *
-   *   afterEach($httpBackend.verifyNoOutstandingExpectation);
+   *   afterEach(httpBackend.verifyNoOutstandingExpectation);
    * 
*/ void verifyNoOutstandingExpectation() { @@ -524,8 +524,8 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#verifyNoOutstandingRequest - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#verifyNoOutstandingRequest + * @methodOf ngMock.httpBackend * @description * Verifies that there are no outstanding requests that need to be flushed. * @@ -533,7 +533,7 @@ class MockHttpBackend implements HttpBackend { * "afterEach" clause. * *
-   *   afterEach($httpBackend.verifyNoOutstandingRequest);
+   *   afterEach(httpBackend.verifyNoOutstandingRequest);
    * 
*/ void verifyNoOutstandingRequest() { @@ -543,12 +543,12 @@ class MockHttpBackend implements HttpBackend { /** * @ngdoc method - * @name ngMock.$httpBackend#resetExpectations - * @methodOf ngMock.$httpBackend + * @name ngMock.httpBackend#resetExpectations + * @methodOf ngMock.httpBackend * @description * Resets all request expectations, but preserves all backend definitions. Typically, you would * call resetExpectations during a multiple-phase test when you want to reuse the same instance of - * $httpBackend mock. + * httpBackend mock. */ void resetExpectations() { expectations.length = 0; diff --git a/test/core/interpolate_spec.dart b/test/core/interpolate_spec.dart index f62e84b62..7d0bd1758 100644 --- a/test/core/interpolate_spec.dart +++ b/test/core/interpolate_spec.dart @@ -7,29 +7,29 @@ class ToStringableObject { } main() { - describe('\$interpolate', () { + describe('interpolate', () { it('should return undefined when there are no bindings and textOnly is set to true', - (Interpolate $interpolate) { - expect($interpolate('some text', true)).toBe(null); + (Interpolate interpolate) { + expect(interpolate('some text', true)).toBe(null); }); - it('should return an expression', (Interpolate $interpolate) { - expect($interpolate('Hello {{name}}!')) + it('should return an expression', (Interpolate interpolate) { + expect(interpolate('Hello {{name}}!')) .toEqual('"Hello "+(name|stringify)+"!"'); - expect($interpolate('a{{b}}C')) + expect(interpolate('a{{b}}C')) .toEqual('"a"+(b|stringify)+"C"'); - expect($interpolate('a{{b}}')).toEqual('"a"+(b|stringify)'); - expect($interpolate('{{a}}b')).toEqual('(a|stringify)+"b"'); - expect($interpolate('{{b}}')).toEqual('(b|stringify)'); - expect($interpolate('{{b}}+{{c}}')) + expect(interpolate('a{{b}}')).toEqual('"a"+(b|stringify)'); + expect(interpolate('{{a}}b')).toEqual('(a|stringify)+"b"'); + expect(interpolate('{{b}}')).toEqual('(b|stringify)'); + expect(interpolate('{{b}}+{{c}}')) .toEqual('(b|stringify)+"+"+(c|stringify)'); - expect($interpolate('{{b}}x{{c}}')) + expect(interpolate('{{b}}x{{c}}')) .toEqual('(b|stringify)+"x"+(c|stringify)'); }); - it('should Parse Multiline', (Interpolate $interpolate) { - expect($interpolate("X\nY{{A\n+B}}C\nD")) + it('should Parse Multiline', (Interpolate interpolate) { + expect(interpolate("X\nY{{A\n+B}}C\nD")) .toEqual('"X\nY"+(A\n+B|stringify)+"C\nD"'); }); diff --git a/test/core/templateurl_spec.dart b/test/core/templateurl_spec.dart index d3fce7c42..0e2f21591 100644 --- a/test/core/templateurl_spec.dart +++ b/test/core/templateurl_spec.dart @@ -53,7 +53,7 @@ void main() { }); it('should use the UrlRewriter for both HTML and CSS URLs', async(inject( - (Http $http, Compiler $compile, Scope $rootScope, Logger log, + (Http http, Compiler compile, Scope rootScope, Logger log, Injector injector, NgZone zone, MockHttpBackend backend, DirectiveMap directives) { @@ -63,7 +63,7 @@ void main() { var element = e('
ignore
'); zone.run(() { - $compile([element], directives)(injector, [element]); + compile([element], directives)(injector, [element]); }); backend.flush(); @@ -88,24 +88,24 @@ void main() { }); it('should replace element with template from url', async(inject( - (Http $http, Compiler $compile, Scope $rootScope, Logger log, + (Http http, Compiler compile, Scope rootScope, Logger log, Injector injector, MockHttpBackend backend, DirectiveMap directives) { backend.expectGET('simple.html').respond('
Simple!
'); var element = es('
ignore
'); - $compile(element, directives)(injector, element); + compile(element, directives)(injector, element); backend.flush(); microLeap(); expect(element[0]).toHaveText('Simple!'); - $rootScope.apply(); + rootScope.apply(); // 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, + (Http http, Compiler compile, Scope rootScope, Logger log, Injector injector, MockHttpBackend backend, DirectiveMap directives) { backend.whenGET('simple.html').respond('
Simple!
'); @@ -114,26 +114,27 @@ void main() { 'ignore' 'ignore' '
'); - $compile(element, directives)(injector, element); + compile(element, directives)(injector, element); backend.flush(); microLeap(); expect(element.first).toHaveText('Simple!Simple!'); - $rootScope.apply(); + rootScope.apply(); + // 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, + (Http http, Compiler compile, Scope rootScope, Logger log, Injector injector, MockHttpBackend backend, DirectiveMap directives) { backend ..expectGET('simple.css').respond('.hello{}') ..expectGET('simple.html').respond('
Simple!
'); var element = e('
ignore
'); - $compile([element], directives)(injector, [element]); + compile([element], directives)(injector, [element]); backend.flush(); microLeap(); @@ -142,17 +143,17 @@ void main() { expect(element.children[0].shadowRoot).toHaveHtml( '
Simple!
' ); - $rootScope.apply(); + rootScope.apply(); // 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, + (Http http, Compiler compile, Scope rootScope, Injector injector, MockHttpBackend backend, DirectiveMap directives) { var element = es('
ignore
'); backend.expectGET('simple.css').respond('.hello{}'); - $compile(element, directives)(injector, element); + compile(element, directives)(injector, element); backend.flush(); microLeap(); @@ -160,11 +161,11 @@ void main() { }))); it('should ignore CSS load errors ', async(inject( - (Http $http, Compiler $compile, Scope $rootScope, Injector injector, + (Http http, Compiler compile, Scope rootScope, Injector injector, MockHttpBackend backend, DirectiveMap directives) { var element = es('
ignore
'); backend.expectGET('simple.css').respond(500, 'some error'); - $compile(element, directives)(injector, element); + compile(element, directives)(injector, element); backend.flush(); microLeap(); @@ -176,11 +177,11 @@ void main() { }))); it('should load a CSS with no template', async(inject( - (Http $http, Compiler $compile, Scope $rootScope, Injector injector, + (Http http, Compiler compile, Scope rootScope, Injector injector, MockHttpBackend backend, DirectiveMap directives) { var element = es('
ignore
'); backend.expectGET('simple.css').respond('.hello{}'); - $compile(element, directives)(injector, element); + compile(element, directives)(injector, element); backend.flush(); microLeap(); @@ -188,14 +189,14 @@ void main() { }))); it('should load the CSS before the template is loaded', async(inject( - (Http $http, Compiler $compile, Scope $rootScope, Injector injector, + (Http http, Compiler compile, Scope rootScope, Injector injector, MockHttpBackend backend, DirectiveMap directives) { backend ..expectGET('simple.css').respond('.hello{}') ..expectGET('simple.html').respond('
Simple!
'); var element = es('ignore'); - $compile(element, directives)(injector, element); + compile(element, directives)(injector, element); backend.flush(); microLeap(); @@ -211,7 +212,7 @@ void main() { }); it('should load multiple CSS files into a style', async(inject( - (Http $http, Compiler $compile, Scope $rootScope, Logger log, + (Http http, Compiler compile, Scope rootScope, Logger log, Injector injector, MockHttpBackend backend, DirectiveMap directives) { backend ..expectGET('simple.css').respond('.hello{}') @@ -219,7 +220,7 @@ void main() { ..expectGET('simple.html').respond('
Simple!
'); var element = e('
ignore
'); - $compile([element], directives)(injector, [element]); + compile([element], directives)(injector, [element]); backend.flush(); microLeap(); @@ -228,7 +229,7 @@ void main() { expect(element.children[0].shadowRoot).toHaveHtml( '
Simple!
' ); - $rootScope.apply(); + rootScope.apply(); // Note: There is no ordering. It is who ever comes off the wire first! expect(log.result()).toEqual('LOG; SIMPLE'); }))); diff --git a/test/core_dom/compiler_spec.dart b/test/core_dom/compiler_spec.dart index dcb35ef27..383273001 100644 --- a/test/core_dom/compiler_spec.dart +++ b/test/core_dom/compiler_spec.dart @@ -124,7 +124,7 @@ void main() { expect(element.text).toEqual('blank12'); }); - it('should compile repeater with children', (Compiler $compile) { + it('should compile repeater with children', (Compiler compile) { var element = _.compile('
'); _.rootScope.context['items'] = ['A', 'b']; @@ -138,7 +138,7 @@ void main() { expect(element).toHaveHtml(''); }); - it('should compile text', (Compiler $compile) { + it('should compile text', (Compiler compile) { var element = _.compile('
{{name}}!
'); _.rootScope.context['name'] = 'OK'; @@ -147,7 +147,7 @@ void main() { expect(element.text).toEqual('OK!'); }); - it('should compile nested repeater', (Compiler $compile) { + it('should compile nested repeater', (Compiler compile) { var element = _.compile( '
' + '
    ' + @@ -479,14 +479,14 @@ void main() { ..value(MockHttpBackend, httpBackend); }); - it('should fire onTemplate method', async((Compiler $compile, Logger logger, MockHttpBackend backend) { + it('should fire onTemplate method', async((Compiler compile, Logger logger, MockHttpBackend backend) { backend.whenGET('some/template.url').respond('
    WORKED
    '); var scope = _.rootScope.createChild({}); scope.context['isReady'] = 'ready'; scope.context['logger'] = logger; scope.context['once'] = null; var elts = es('{{logger("inner")}}'); - $compile(elts, _.injector.get(DirectiveMap))(_.injector.createChild([new Module()..value(Scope, scope)]), elts); + compile(elts, _.injector.get(DirectiveMap))(_.injector.createChild([new Module()..value(Scope, scope)]), elts); expect(logger).toEqual(['new']); expect(logger).toEqual(['new']); @@ -513,11 +513,11 @@ void main() { expect(elts).toHaveText('WORKED'); })); - it('should should not call attach after scope is destroyed', async((Compiler $compile, Logger logger, MockHttpBackend backend) { + it('should should not call attach after scope is destroyed', async((Compiler compile, Logger logger, MockHttpBackend backend) { backend.whenGET('foo.html').respond('
    WORKED
    '); var elts = es(''); var scope = _.rootScope.createChild({}); - $compile(elts, _.injector.get(DirectiveMap))(_.injector.createChild([new Module()..value(Scope, scope)]), elts); + compile(elts, _.injector.get(DirectiveMap))(_.injector.createChild([new Module()..value(Scope, scope)]), elts); expect(logger).toEqual(['SimpleAttachComponent']); scope.destroy(); diff --git a/test/core_dom/http_spec.dart b/test/core_dom/http_spec.dart index dd898e3b2..3e64df57d 100644 --- a/test/core_dom/http_spec.dart +++ b/test/core_dom/http_spec.dart @@ -837,8 +837,8 @@ void main() { // Dart futures fully. xdescribe('timeout', () { - it('should abort requests when timeout promise resolves', ($q) { - var canceler = $q.defer(); + it('should abort requests when timeout promise resolves', (q) { + var canceler = q.defer(); backend.expect('GET', '/some').respond(200); @@ -851,7 +851,7 @@ void main() { callback(); }); - //$rootScope.apply(() { + //rootScope.apply(() { canceler.resolve(); //}); diff --git a/test/core_dom/ng_mustache_spec.dart b/test/core_dom/ng_mustache_spec.dart index f6234ea75..9be1691e6 100644 --- a/test/core_dom/ng_mustache_spec.dart +++ b/test/core_dom/ng_mustache_spec.dart @@ -11,11 +11,11 @@ main() { }); beforeEach(inject((TestBed tb) => _ = tb)); - it('should replace {{}} in text', inject((Compiler $compile, + it('should replace {{}} in text', inject((Compiler compile, Scope rootScope, Injector injector, DirectiveMap directives) { var element = es('
    {{name}}!
    '); - var template = $compile(element, directives); + var template = compile(element, directives); rootScope.context['name'] = 'OK'; var view = template(injector); @@ -44,12 +44,12 @@ main() { })); }); - it('should replace {{}} in attribute', inject((Compiler $compile, + it('should replace {{}} in attribute', inject((Compiler compile, Scope rootScope, Injector injector, DirectiveMap directives) { Element element = e('
    '); - var template = $compile([element], directives); + var template = compile([element], directives); rootScope.context['name'] = 'OK'; rootScope.context['age'] = 23; @@ -63,12 +63,12 @@ main() { })); - it('should allow newlines in attribute', inject((Compiler $compile, + it('should allow newlines in attribute', inject((Compiler compile, RootScope rootScope, Injector injector, DirectiveMap directives) { Element element = e('
    '); - var template = $compile([element], directives); + var template = compile([element], directives); rootScope.context['line1'] = 'L1'; rootScope.context['line2'] = 'L2'; @@ -82,11 +82,11 @@ main() { })); - it('should handle filters', inject((Compiler $compile, RootScope rootScope, + it('should handle filters', inject((Compiler compile, RootScope rootScope, Injector injector, DirectiveMap directives) { var element = es('
    {{"World" | hello}}
    '); - var template = $compile(element, directives); + var template = compile(element, directives); var view = template(injector); rootScope.apply(); diff --git a/test/directive/ng_repeat_spec.dart b/test/directive/ng_repeat_spec.dart index de9df0ce2..b154cd6a7 100644 --- a/test/directive/ng_repeat_spec.dart +++ b/test/directive/ng_repeat_spec.dart @@ -13,12 +13,12 @@ class MockAnimate extends NgAnimate { main() { describe('NgRepeater', () { Element element; - var $compile, scope, $exceptionHandler, directives; + var compile, scope, exceptionHandler, directives; - beforeEach((Injector injector, Scope $rootScope, Compiler compiler, DirectiveMap _directives) { - $exceptionHandler = injector.get(ExceptionHandler); - scope = $rootScope; - $compile = (html, [scope]) { + beforeEach((Injector injector, Scope rootScope, Compiler compiler, DirectiveMap _directives) { + exceptionHandler = injector.get(ExceptionHandler); + scope = rootScope; + compile = (html, [scope]) { element = e(html); var viewFactory = compiler([element], _directives); var blockInjector = injector; @@ -68,7 +68,7 @@ main() { it(r'should iterate over an array of objects', () { - element = $compile( + element = compile( '
      ' '
    • {{item.name}};
    • ' '
    '); @@ -95,7 +95,7 @@ main() { it(r'should gracefully handle nulls', () { - element = $compile( + element = compile( '
    ' '
      ' '
    • {{item.name}};
    • ' @@ -108,7 +108,7 @@ main() { it('should support filters', () { - element = $compile( + element = compile( '
      {{item}}
      '); scope.context['items'] = ['foo', 'bar', 'baz']; scope.context['myFilter'] = (String item) => item.startsWith('b'); @@ -119,7 +119,7 @@ main() { describe('track by', () { it(r'should track using expression function', () { - element = $compile( + element = compile( '
        ' '
      • {{item.name}};
      • ' '
      '); @@ -136,7 +136,7 @@ main() { it(r'should track using build in $id function', () { - element = $compile( + element = compile( '
        ' r'
      • {{item.name}};
      • ' '
      '); @@ -153,7 +153,7 @@ main() { it(r'should iterate over an array of primitives', () { - element = $compile( + element = compile( r'
        ' r'
      • {{item}};
      • ' r'
      '); @@ -237,7 +237,7 @@ main() { it(r'should error on wrong parsing of ngRepeat', () { expect(() { - $compile('
      ')(); + compile('
      ')(); }).toThrow("[NgErr7] ngRepeat error! Expected expression in form of " "'_item_ in _collection_[ track by _id_]' but got " "'i dont parse'."); @@ -246,7 +246,7 @@ main() { it("should throw error when left-hand-side of ngRepeat can't be parsed", () { expect(() { - $compile('
      ')(); + compile('
      ')(); }).toThrow("[NgErr8] ngRepeat error! '_item_' in '_item_ in " "_collection_' should be an identifier or '(_key_, _value_)' " "expression, but got 'i dont parse'."); @@ -255,7 +255,7 @@ main() { it(r'should expose iterator offset as $index when iterating over arrays', () { - element = $compile( + element = compile( '
        ' + '
      • {{item}}:{{\$index}}|
      • ' + '
      '); @@ -267,7 +267,7 @@ main() { it(r'should expose iterator position as $first, $middle and $last when iterating over arrays', () { - element = $compile( + element = compile( '
        ' '
      • {{item}}:{{\$first}}-{{\$middle}}-{{\$last}}|
      • ' '
      '); @@ -298,7 +298,7 @@ main() { }); it(r'should report odd', () { - element = $compile( + element = compile( '
        ' '
      • {{item}}:{{\$odd}}-{{\$even}}|
      • ' '
      '); @@ -326,7 +326,7 @@ main() { }); it(r'should repeat over nested arrays', () { - element = $compile( + element = compile( '
        ' + '
      • ' + '
        {{group}}|
        X' + @@ -343,7 +343,7 @@ main() { var a, b, c, d, lis; beforeEach(() { - element = $compile( + element = compile( '
          ' '
        • {{key}}:{{val}}|>
        • ' '
        '); @@ -413,7 +413,7 @@ main() { scope.context['items'] = [1]; var parentScope = scope.createChild(new PrototypeMap(scope.context)); - element = $compile( + element = compile( '
          ' '
        • {{item}}
        • ' '
        ', parentScope); @@ -428,11 +428,11 @@ main() { var child = injector.createChild( [new Module()..value(NgAnimate, throwOnMove)]); - child.invoke((Injector injector, Scope $rootScope, Compiler compiler, + child.invoke((Injector injector, Scope rootScope, Compiler compiler, DirectiveMap _directives) { - $exceptionHandler = injector.get(ExceptionHandler); - scope = $rootScope; - $compile = (html) { + exceptionHandler = injector.get(ExceptionHandler); + scope = rootScope; + compile = (html) { element = e(html); var viewFactory = compiler([element], _directives); viewFactory(injector, [element]); @@ -441,7 +441,7 @@ main() { directives = _directives; }); - element = $compile( + element = compile( '
          ' '
        • {{item}}
        • ' '
        '); diff --git a/test/directive/ng_src_boolean_spec.dart b/test/directive/ng_src_boolean_spec.dart index ea41820a5..8062ded57 100644 --- a/test/directive/ng_src_boolean_spec.dart +++ b/test/directive/ng_src_boolean_spec.dart @@ -106,14 +106,14 @@ main() { }); - xit('should interpolate the expression and bind to src with a trusted value', ($sce) { + xit('should interpolate the expression and bind to src with a trusted value', (sce) { _.compile('
        '); _.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'); }); @@ -124,7 +124,7 @@ main() { _.compile('
        '); }).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"); }); @@ -139,15 +139,15 @@ main() { }); - xit('should NOT interpolate a wrongly typed expression', ($sce) { + xit('should NOT interpolate a wrongly typed expression', (sce) { expect(() { _.compile('
        '); _.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] Viewed " + - "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"); }); }); diff --git a/test/mock/test_bed_spec.dart b/test/mock/test_bed_spec.dart index d703d3590..08845bf9d 100644 --- a/test/mock/test_bed_spec.dart +++ b/test/mock/test_bed_spec.dart @@ -5,9 +5,9 @@ import '../_specs.dart'; void main() { describe('test bed', () { TestBed _; - Compiler $compile; + Compiler compile; Injector injector; - Scope $rootScope; + Scope rootScope; beforeEachModule((Module module) { module..type(MyTestBedDirective);