angular: fixed some tests and removed some which are no longer relevant due to the removal of the success and error methods from IHttpPromise

This commit is contained in:
Shihab Uddin
2017-02-08 16:19:11 +01:00
parent a766c1df30
commit e338791f88
3 changed files with 16 additions and 36 deletions

View File

@@ -108,11 +108,6 @@ namespace HttpAndRegularPromiseTests {
}
function someController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) {
$http.get<ExpectedResponse>('http://somewhere/some/resource')
.success((data: ExpectedResponse) => {
$scope.person = data;
});
$http.get<ExpectedResponse>('http://somewhere/some/resource')
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
@@ -156,21 +151,6 @@ namespace HttpAndRegularPromiseTests {
$scope.nothing = 'really nothing';
});
}
// Test that we can pass around a type-checked success/error Promise Callback
function anotherController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) {
function buildFooData(): ng.IRequestShortcutConfig {
return {};
}
function doFoo(callback: ng.IHttpPromiseCallback<ExpectedResponse>) {
$http
.get<ExpectedResponse>('/foo', buildFooData())
.success(callback);
};
doFoo((data: any) => console.log(data));
};
}
// Test for AngularJS Syntax
@@ -441,10 +421,10 @@ httpFoo.then((x) => {
x.toFixed();
});
httpFoo.success((data, status, headers, config) => {
const h = headers('test');
httpFoo.then((response: ng.IHttpPromiseCallbackArg<any>) => {
const h = response.headers('test');
h.charAt(0);
const hs = headers();
const hs = response.headers();
hs['content-type'].charAt(1);
});