From 14e95050b595f63ce6263be4fb549c4df813bac5 Mon Sep 17 00:00:00 2001 From: Panu Horsmalahti Date: Thu, 5 Jun 2014 18:43:48 +0300 Subject: [PATCH] Add .reload() definition. Add test for it and other tests for the ng.ui.IStateService --- angular-ui/angular-ui-router-tests.ts | 23 ++++++++++++++++++++--- angular-ui/angular-ui-router.d.ts | 1 + 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/angular-ui/angular-ui-router-tests.ts b/angular-ui/angular-ui-router-tests.ts index 4804ad297..5b0dec0ff 100644 --- a/angular-ui/angular-ui-router-tests.ts +++ b/angular-ui/angular-ui-router-tests.ts @@ -78,12 +78,13 @@ interface IUrlLocatorTestService { // Service for determining who the currently logged on user is. class UrlLocatorTestService implements IUrlLocatorTestService { - static $inject = ["$http", "$rootScope", "$urlRouter"]; + static $inject = ["$http", "$rootScope", "$urlRouter", "$state"]; constructor( private $http: ng.IHttpService, private $rootScope: ng.IRootScopeService, - private $urlRouter: ng.ui.IUrlRouterService + private $urlRouter: ng.ui.IUrlRouterService, + private $state: ng.ui.IStateService ) { $rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event)); } @@ -107,6 +108,23 @@ class UrlLocatorTestService implements IUrlLocatorTestService { }); } } + + private stateServiceTest() { + this.$state.go("myState"); + this.$state.transitionTo("myState"); + if (this.$state.includes("myState") === true) { + // + } + if (this.$state.is("myState") === true) { + // + } + if (this.$state.href("myState") === "/myState") { + // + } + this.$state.get("myState"); + this.$state.get(); + this.$state.reload(); + } } myApp.service("urlLocatorTest", UrlLocatorTestService); @@ -124,4 +142,3 @@ module UiViewScrollProviderTests { $uiViewScrollProvider.useAnchorScroll(); }]); } - diff --git a/angular-ui/angular-ui-router.d.ts b/angular-ui/angular-ui-router.d.ts index 499f1c474..3b233c86a 100644 --- a/angular-ui/angular-ui-router.d.ts +++ b/angular-ui/angular-ui-router.d.ts @@ -86,6 +86,7 @@ declare module ng.ui { get(): IState[]; current: IState; params: IStateParamsService; + reload(): void; } interface IStateParamsService {