Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

style: Rename variables of the form into $name into name #854

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/core/interpolate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 9 additions & 9 deletions lib/core_dom/view_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ class WalkingViewFactory implements ViewFactory {
class ViewCache {
// _viewFactoryCache is unbounded
final _viewFactoryCache = new LruCache<String, ViewFactory>(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);
Expand All @@ -138,7 +138,7 @@ class ViewCache {
}

async.Future<ViewFactory> fromUrl(String url, DirectiveMap directives) {
return $http.getString(url, cache: $templateCache).then(
return http.getString(url, cache: templateCache).then(
(html) => fromHtml(html, directives));
}
}
Expand All @@ -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
Expand All @@ -180,19 +180,19 @@ class _ComponentFactory implements Function {
List<async.Future<String>> 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 {
cssFutures.add(new async.Future.value(null));
}
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<String> cssList) {
Expand Down
2 changes: 1 addition & 1 deletion lib/directive/ng_a.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.:
* `<a href="" ng-click="model.$save()">Save</a>`
* `<a href="" ng-click="model.save()">Save</a>`
*/
@NgDirective(selector: 'a[href]')
class NgA {
Expand Down
108 changes: 54 additions & 54 deletions lib/mock/http_backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,48 @@ 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;
});
return header;
}

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');
Expand Down Expand Up @@ -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()]);
};
Expand Down Expand Up @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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.
*
Expand Down Expand Up @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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()`.
*
Expand All @@ -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.
*
Expand All @@ -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.
Expand All @@ -512,7 +512,7 @@ class MockHttpBackend implements HttpBackend {
* "afterEach" clause.
*
* <pre>
* afterEach($httpBackend.verifyNoOutstandingExpectation);
* afterEach(httpBackend.verifyNoOutstandingExpectation);
* </pre>
*/
void verifyNoOutstandingExpectation() {
Expand All @@ -524,16 +524,16 @@ 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.
*
* Typically, you would call this method following each test case that asserts requests using an
* "afterEach" clause.
*
* <pre>
* afterEach($httpBackend.verifyNoOutstandingRequest);
* afterEach(httpBackend.verifyNoOutstandingRequest);
* </pre>
*/
void verifyNoOutstandingRequest() {
Expand All @@ -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;
Expand Down
Loading