| Index: third_party/pkg/angular/lib/mock/http_backend.dart
|
| diff --git a/third_party/pkg/angular/lib/mock/http_backend.dart b/third_party/pkg/angular/lib/mock/http_backend.dart
|
| index 59f60719c938dba35c7ea09fe4be34a24d9023ac..20a8e97a7b3d167dc81fc2d2f86b03ee761d6e64 100644
|
| --- a/third_party/pkg/angular/lib/mock/http_backend.dart
|
| +++ b/third_party/pkg/angular/lib/mock/http_backend.dart
|
| @@ -1,44 +1,36 @@
|
| -library angular.mock.http_backend;
|
| -
|
| -import 'dart:async' as dart_async;
|
| -import 'dart:convert' show JSON;
|
| -import 'dart:html';
|
| -
|
| -import 'package:angular/angular.dart';
|
| -import 'package:angular/utils.dart' as utils;
|
| -
|
| +part of angular.mock;
|
|
|
| class _MockXhr {
|
| - var method, url, async, reqHeaders, respHeaders;
|
| + var $$method, $$url, $$async, $$reqHeaders, $$respHeaders;
|
|
|
| void open(method, url, async) {
|
| - this.method = method;
|
| - this.url = url;
|
| - this.async = async;
|
| - reqHeaders = {};
|
| - respHeaders = {};
|
| + $$method = method;
|
| + $$url = url;
|
| + $$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 +38,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 +169,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 +252,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 +266,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 +280,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 +293,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 +308,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 +325,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 +338,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 +367,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 +381,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 +395,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 +408,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 +423,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 +438,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 +453,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 +466,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 +494,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 +504,7 @@ class MockHttpBackend implements HttpBackend {
|
| * "afterEach" clause.
|
| *
|
| * <pre>
|
| - * afterEach(httpBackend.verifyNoOutstandingExpectation);
|
| + * afterEach($httpBackend.verifyNoOutstandingExpectation);
|
| * </pre>
|
| */
|
| void verifyNoOutstandingExpectation() {
|
| @@ -524,8 +516,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 +525,7 @@ class MockHttpBackend implements HttpBackend {
|
| * "afterEach" clause.
|
| *
|
| * <pre>
|
| - * afterEach(httpBackend.verifyNoOutstandingRequest);
|
| + * afterEach($httpBackend.verifyNoOutstandingRequest);
|
| * </pre>
|
| */
|
| void verifyNoOutstandingRequest() {
|
| @@ -543,12 +535,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;
|
|
|