@angular-wave/angular.ts 0.7.8 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/{loader.d.ts → angular.d.ts} +3 -3
- package/@types/core/di/ng-module.d.ts +61 -25
- package/@types/core/parse/parse.d.ts +6 -7
- package/@types/directive/bind/bind.d.ts +2 -1
- package/@types/index.d.ts +1 -1
- package/@types/interface.d.ts +4 -2
- package/@types/{public.d.ts → ng.d.ts} +2 -2
- package/@types/router/directives/state-directives.d.ts +2 -2
- package/@types/router/directives/view-directive.d.ts +1 -1
- package/@types/router/params/param-type.d.ts +0 -1
- package/@types/router/path/path-utils.d.ts +8 -11
- package/@types/router/{globals.d.ts → router.d.ts} +2 -2
- package/@types/router/state/interface.d.ts +1 -1
- package/@types/router/state/state-object.d.ts +1 -1
- package/@types/router/state/state-registry.d.ts +2 -2
- package/@types/router/state/state-service.d.ts +14 -16
- package/@types/router/state-filters.d.ts +24 -2
- package/@types/router/transition/transition-service.d.ts +3 -3
- package/@types/router/transition/transition.d.ts +16 -19
- package/@types/router/url/url-matcher.d.ts +3 -4
- package/@types/router/url/url-rule.d.ts +14 -4
- package/@types/router/url/url-rules.d.ts +26 -6
- package/@types/router/url/url-service.d.ts +28 -38
- package/@types/services/http/http.d.ts +48 -1
- package/@types/services/http-backend/http-backend.d.ts +48 -35
- package/@types/services/location/interface.d.ts +55 -0
- package/@types/services/location/location.d.ts +225 -252
- package/@types/shared/common.d.ts +0 -2
- package/@types/shared/hof.d.ts +0 -6
- package/@types/shared/interface.d.ts +0 -4
- package/@types/{router/common → shared}/queue.d.ts +2 -2
- package/@types/shared/url-utils/interface.d.ts +0 -1
- package/@types/shared/url-utils/url-utils.d.ts +0 -5
- package/@types/shared/utils.d.ts +29 -6
- package/CHANGELOG.md +0 -72
- package/CONTRIBUTING.md +0 -1
- package/DEVELOPERS.md +0 -1
- package/Makefile +6 -3
- package/TRIAGING.md +0 -1
- package/dist/angular-ts.esm.js +1048 -1150
- package/dist/angular-ts.umd.js +1048 -1150
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/assets/scss/index.scss +23 -0
- package/docs/content/_index.md +9 -8
- package/docs/content/docs/_index.md +1 -1
- package/docs/content/docs/directive/app.md +1 -1
- package/docs/content/docs/directive/bind.md +1 -1
- package/docs/content/docs/directive/blur.md +1 -1
- package/docs/content/docs/directive/channel.md +2 -2
- package/docs/content/docs/directive/class-even.md +1 -1
- package/docs/content/docs/directive/class-odd.md +1 -1
- package/docs/content/docs/directive/class.md +1 -1
- package/docs/content/docs/directive/click.md +1 -1
- package/docs/content/docs/directive/copy.md +1 -1
- package/docs/content/docs/directive/cut.md +1 -1
- package/docs/content/docs/directive/dblclick.md +1 -1
- package/docs/content/docs/directive/focus.md +1 -1
- package/docs/content/docs/directive/get.md +3 -3
- package/docs/content/docs/directive/keydown.md +1 -1
- package/docs/content/docs/directive/keyup.md +1 -1
- package/docs/content/docs/directive/load.md +1 -1
- package/docs/content/docs/directive/mousedown.md +1 -1
- package/docs/content/docs/directive/mouseenter.md +1 -1
- package/docs/content/docs/directive/mouseleave.md +1 -1
- package/docs/content/docs/directive/mousemove.md +1 -1
- package/docs/content/docs/directive/mouseout.md +1 -1
- package/docs/content/docs/directive/mouseover.md +1 -1
- package/docs/content/docs/directive/mouseup.md +1 -1
- package/docs/content/docs/directive/non-bindable.md +28 -0
- package/docs/content/docs/provider/locationProvider.md +26 -0
- package/docs/content/docs/provider/templateCacheProvider.md +2 -2
- package/docs/content/docs/service/location.md +57 -0
- package/docs/content/docs/service/url.md +5 -0
- package/docs/layouts/partials/hooks/head-end.html +1 -1
- package/docs/layouts/shortcodes/version.html +1 -0
- package/docs/static/examples/counter/counter-test.html +0 -4
- package/docs/static/examples/eventbus/eventbus-test.html +0 -4
- package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
- package/docs/static/typedoc/assets/hierarchy.js +1 -1
- package/docs/static/typedoc/assets/highlight.css +6 -6
- package/docs/static/typedoc/assets/navigation.js +1 -1
- package/docs/static/typedoc/assets/search.js +1 -1
- package/docs/static/typedoc/classes/Location.html +55 -0
- package/docs/static/typedoc/classes/LocationProvider.html +20 -0
- package/docs/static/typedoc/classes/NgModule.html +3 -3
- package/docs/static/typedoc/index.html +1 -1
- package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
- package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
- package/docs/static/typedoc/interfaces/Provider.html +2 -1
- package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
- package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
- package/docs/static/typedoc/types/Expression.html +1 -1
- package/docs/static/typedoc/types/Injectable.html +4 -1
- package/docs/static/typedoc/types/InjectableFactory.html +1 -4
- package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
- package/docs/static/version.js +13 -0
- package/docs/test-results/.last-run.json +4 -0
- package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
- package/package.json +2 -2
- package/src/{loader.js → angular.js} +11 -11
- package/src/angular.spec.js +189 -21
- package/src/animations/animate-css.js +17 -18
- package/src/animations/animate.spec.js +1 -1
- package/src/animations/shared.js +2 -3
- package/src/binding.spec.js +1 -1
- package/src/core/compile/compile.js +4 -7
- package/src/core/compile/compile.spec.js +1 -1
- package/src/core/controller/controller.spec.js +1 -1
- package/src/core/controller/controller.test.js +1 -0
- package/src/core/di/injector.js +7 -8
- package/src/core/di/injector.spec.js +2 -2
- package/src/core/di/injector.test.js +2 -2
- package/src/core/di/internal-injector.js +3 -6
- package/src/core/di/ng-module.js +26 -21
- package/src/core/filter/filter.js +1 -1
- package/src/core/filter/filter.spec.js +1 -1
- package/src/core/filter/filter.test.js +1 -0
- package/src/core/interpolate/interpolate.js +4 -6
- package/src/core/interpolate/interpolate.spec.js +1 -1
- package/src/core/interpolate/interpolate.test.js +1 -0
- package/src/core/parse/ast/ast.spec.js +1 -1
- package/src/core/parse/ast/ast.test.js +1 -1
- package/src/core/parse/lexer/lexer.spec.js +1 -1
- package/src/core/parse/parse.js +150 -146
- package/src/core/parse/parse.spec.js +46 -46
- package/src/core/prop.spec.js +1 -1
- package/src/core/root-element.spec.js +1 -1
- package/src/core/scope/scope.js +10 -11
- package/src/core/scope/scope.spec.js +3 -4
- package/src/directive/aria/aria.spec.js +1 -1
- package/src/directive/aria/aria.test.js +1 -0
- package/src/directive/attrs/attrs.spec.js +1 -1
- package/src/directive/attrs/attrs.test.js +1 -0
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/attrs/boolean.test.js +1 -0
- package/src/directive/attrs/element-style.spec.js +1 -1
- package/src/directive/attrs/element-style.test.js +1 -0
- package/src/directive/attrs/src.spec.js +1 -1
- package/src/directive/attrs/src.test.js +1 -0
- package/src/directive/bind/bind-html.spec.js +1 -1
- package/src/directive/bind/bind.js +1 -0
- package/src/directive/bind/bind.spec.js +1 -1
- package/src/directive/bind/bind.test.js +1 -0
- package/src/directive/channel/channel.spec.js +1 -1
- package/src/directive/channel/channel.test.js +1 -0
- package/src/directive/class/class.spec.js +1 -1
- package/src/directive/class/class.test.js +1 -0
- package/src/directive/cloak/cloak.spec.js +1 -1
- package/src/directive/cloak/cloak.test.js +1 -0
- package/src/directive/controller/controller.spec.js +1 -1
- package/src/directive/controller/controller.test.js +1 -0
- package/src/directive/events/click.spec.js +1 -1
- package/src/directive/events/event.spec.js +6 -6
- package/src/directive/events/events.test.js +1 -0
- package/src/directive/form/form.js +8 -5
- package/src/directive/form/form.spec.js +1 -1
- package/src/directive/form/form.test.js +1 -0
- package/src/directive/http/delete.spec.js +1 -1
- package/src/directive/http/form-test.html +18 -0
- package/src/directive/http/get.spec.js +1 -1
- package/src/directive/http/http.js +12 -3
- package/src/directive/http/post.spec.js +504 -9
- package/src/directive/http/put.spec.js +1 -1
- package/src/directive/if/if.spec.js +1 -1
- package/src/directive/include/include.spec.js +1 -1
- package/src/directive/init/init.spec.js +1 -1
- package/src/directive/init/init.test.js +1 -0
- package/src/directive/input/input.js +13 -15
- package/src/directive/input/input.spec.js +1 -2
- package/src/directive/input/input.test.js +1 -0
- package/src/directive/messages/messages.md +0 -4
- package/src/directive/messages/messages.spec.js +1 -1
- package/src/directive/messages/messages.test.js +1 -0
- package/src/directive/model/model.js +13 -13
- package/src/directive/model/model.spec.js +1 -1
- package/src/directive/model/model.test.js +1 -0
- package/src/directive/model-options/model-option.test.js +1 -0
- package/src/directive/model-options/model-options.js +1 -1
- package/src/directive/model-options/model-options.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.test.js +1 -0
- package/src/directive/observe/observe.spec.js +1 -1
- package/src/directive/observe/observe.test.js +1 -0
- package/src/directive/on/on.spec.js +1 -1
- package/src/directive/on/on.test.js +1 -0
- package/src/directive/options/options.spec.js +1 -1
- package/src/directive/options/options.test.js +1 -0
- package/src/directive/ref/href.spec.js +1 -1
- package/src/directive/ref/href.test.js +2 -0
- package/src/directive/ref/ref.spec.js +1 -1
- package/src/directive/repeat/repeat.js +1 -1
- package/src/directive/repeat/repeat.spec.js +2 -3
- package/src/directive/repeat/repeat.test.js +1 -0
- package/src/directive/script/script.spec.js +1 -1
- package/src/directive/script/script.test.js +1 -0
- package/src/directive/select/select.js +1 -1
- package/src/directive/select/select.spec.js +1 -1
- package/src/directive/select/select.test.js +1 -0
- package/src/directive/setter/setter.spec.js +1 -1
- package/src/directive/setter/setter.test.js +1 -0
- package/src/directive/show-hide/show-hide.spec.js +1 -1
- package/src/directive/show-hide/show-hide.test.js +1 -0
- package/src/directive/style/style.spec.js +1 -1
- package/src/directive/style/style.test.js +1 -0
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/directive/switch/switch.test.js +1 -0
- package/src/directive/validators/validators.js +82 -84
- package/src/directive/validators/validators.spec.js +5 -4
- package/src/directive/validators/validators.test.js +1 -0
- package/src/filters/filter.spec.js +1 -1
- package/src/filters/filters.spec.js +1 -1
- package/src/filters/limit-to.js +2 -3
- package/src/filters/limit-to.spec.js +1 -1
- package/src/filters/order-by.spec.js +1 -1
- package/src/index.js +1 -1
- package/src/injection-tokens.js +7 -3
- package/src/interface.ts +4 -3
- package/src/loader.md +0 -155
- package/src/{public.js → ng.js} +11 -12
- package/src/{public.spec.js → ng.spec.js} +2 -2
- package/src/router/directives/state-directives.js +5 -5
- package/src/router/directives/state-directives.spec.js +8 -7
- package/src/router/directives/view-directive.js +7 -13
- package/src/router/directives/view-directive.spec.js +22 -23
- package/src/router/{common/common.html → glob/glob.html} +2 -3
- package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
- package/src/router/params/param-type.js +0 -1
- package/src/router/params/param.js +1 -1
- package/src/router/path/path-utils.js +5 -0
- package/src/router/router-test-hashbang.html +45 -0
- package/src/router/{globals.js → router.js} +2 -2
- package/src/router/services.spec.js +8 -9
- package/src/router/state/interface.ts +1 -1
- package/src/router/state/state-builder.js +3 -3
- package/src/router/state/state-builder.spec.js +1 -1
- package/src/router/state/state-object.js +1 -1
- package/src/router/state/state-registry.js +4 -4
- package/src/router/state/state-service.js +14 -14
- package/src/router/state/state.spec.js +23 -22
- package/src/router/state/state.test.js +1 -0
- package/src/router/state/views.js +1 -1
- package/src/router/state-filter.spec.js +1 -1
- package/src/router/state-filters.js +13 -9
- package/src/router/template-factory.js +5 -4
- package/src/router/template-factory.spec.js +7 -7
- package/src/router/transition/hook-registry.js +1 -1
- package/src/router/transition/transition-service.js +7 -6
- package/src/router/transition/transition.js +6 -6
- package/src/router/url/url-matcher.js +12 -14
- package/src/router/url/url-rule.js +8 -2
- package/src/router/url/url-rules.js +8 -5
- package/src/router/url/url-service.js +80 -76
- package/src/router/url/url-service.spec.js +61 -78
- package/src/router/url/url.test.js +1 -0
- package/src/router/view/view.js +4 -5
- package/src/router/view/view.spec.js +10 -12
- package/src/router/view/view.test.js +1 -0
- package/src/router/view-hook.spec.js +1 -1
- package/src/router/view-scroll.js +3 -1
- package/src/router/view-scroll.spec.js +12 -12
- package/src/services/anchor-scroll.html +2 -2
- package/src/services/anchor-scroll.js +5 -4
- package/src/services/http/http.js +9 -4
- package/src/services/http/http.spec.js +2 -7
- package/src/services/http/template-request.spec.js +1 -1
- package/src/services/http-backend/http-backend.js +51 -77
- package/src/services/http-backend/http-backend.spec.js +1 -2
- package/src/services/http-backend/http-backend.test.js +1 -0
- package/src/services/location/interface.ts +62 -0
- package/src/services/location/location.js +439 -519
- package/src/services/location/location.spec.js +915 -530
- package/src/services/location/location.test.js +2 -2
- package/src/services/log/log.spec.js +1 -1
- package/src/services/log/log.test.js +1 -0
- package/src/services/pubsub/pubsub.spec.js +1 -1
- package/src/services/sce/sce.js +5 -7
- package/src/services/sce/sce.md +2 -2
- package/src/services/sce/sce.spec.js +1 -1
- package/src/services/template-cache/template-cache.spec.js +1 -1
- package/src/services/template-cache/template-cache.test.js +1 -0
- package/src/shared/common.js +5 -10
- package/src/shared/common.spec.js +1 -1
- package/src/shared/hof.js +0 -14
- package/src/shared/interface.ts +0 -4
- package/src/{router/common → shared}/queue.js +7 -7
- package/src/shared/shared.html +1 -0
- package/src/shared/shared.test.js +1 -0
- package/src/shared/url-utils/interface.ts +0 -2
- package/src/shared/url-utils/url-utils.js +6 -30
- package/src/shared/url-utils/url-utils.spec.js +10 -9
- package/src/shared/utils.js +32 -9
- package/src/shared/utils.spec.js +35 -1
- package/src/src.html +1 -2
- package/typedoc.json +0 -1
- package/utils/express.js +27 -1
- package/utils/version.cjs +23 -0
- package/@types/router/state-provider.d.ts +0 -123
- package/src/directive/non-bindable/non-bindable.md +0 -17
- package/src/loader.spec.js +0 -169
- package/src/router/state-provider.js +0 -146
- package/src/services/location/location.md +0 -114
- package/src/shared/url-utils/url-utils.md +0 -46
- /package/@types/router/{common → glob}/glob.d.ts +0 -0
- /package/src/router/{common → glob}/glob.js +0 -0
- /package/src/router/{common → glob}/glob.spec.js +0 -0
- /package/src/{router/common → shared}/queue.spec.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createElementFromHTML, dealoc } from "../../shared/dom.js";
|
|
2
|
-
import { Angular } from "../../
|
|
2
|
+
import { Angular } from "../../angular.js";
|
|
3
3
|
import { wait } from "../../shared/test-utils.js";
|
|
4
4
|
|
|
5
5
|
describe("ngView", () => {
|
|
@@ -12,7 +12,7 @@ describe("ngView", () => {
|
|
|
12
12
|
app,
|
|
13
13
|
$injector,
|
|
14
14
|
$state,
|
|
15
|
-
$
|
|
15
|
+
$viewScroll;
|
|
16
16
|
|
|
17
17
|
const aState = {
|
|
18
18
|
name: "a",
|
|
@@ -129,8 +129,8 @@ describe("ngView", () => {
|
|
|
129
129
|
app = window.angular
|
|
130
130
|
.module("defaultModule", [])
|
|
131
131
|
.config(($provide, _$stateProvider_) => {
|
|
132
|
-
$provide.decorator("$
|
|
133
|
-
return jasmine.createSpy("$
|
|
132
|
+
$provide.decorator("$viewScroll", () => {
|
|
133
|
+
return jasmine.createSpy("$viewScroll");
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
_$stateProvider_
|
|
@@ -156,11 +156,11 @@ describe("ngView", () => {
|
|
|
156
156
|
"defaultModule",
|
|
157
157
|
]);
|
|
158
158
|
|
|
159
|
-
$injector.invoke((_$state_, $rootScope, _$compile_, _$
|
|
159
|
+
$injector.invoke((_$state_, $rootScope, _$compile_, _$viewScroll_) => {
|
|
160
160
|
scope = $rootScope.$new();
|
|
161
161
|
$compile = _$compile_;
|
|
162
162
|
$state = _$state_;
|
|
163
|
-
$
|
|
163
|
+
$viewScroll = _$viewScroll_;
|
|
164
164
|
});
|
|
165
165
|
});
|
|
166
166
|
|
|
@@ -312,7 +312,7 @@ describe("ngView", () => {
|
|
|
312
312
|
|
|
313
313
|
$state.transitionTo(aState);
|
|
314
314
|
await wait(100);
|
|
315
|
-
expect($
|
|
315
|
+
expect($viewScroll).not.toHaveBeenCalled();
|
|
316
316
|
});
|
|
317
317
|
|
|
318
318
|
it("should autoscroll when expression is missing", async () => {
|
|
@@ -324,7 +324,7 @@ describe("ngView", () => {
|
|
|
324
324
|
|
|
325
325
|
// animateFlush($animate);
|
|
326
326
|
|
|
327
|
-
expect($
|
|
327
|
+
expect($viewScroll).toHaveBeenCalledWith(elem.querySelector("ng-view"));
|
|
328
328
|
});
|
|
329
329
|
|
|
330
330
|
it("should autoscroll based on expression", async () => {
|
|
@@ -336,12 +336,12 @@ describe("ngView", () => {
|
|
|
336
336
|
$state.transitionTo(aState);
|
|
337
337
|
await wait(100);
|
|
338
338
|
|
|
339
|
-
expect($
|
|
339
|
+
expect($viewScroll).not.toHaveBeenCalled();
|
|
340
340
|
|
|
341
341
|
scope.doScroll = true;
|
|
342
342
|
$state.transitionTo(bState);
|
|
343
343
|
await wait(100);
|
|
344
|
-
expect($
|
|
344
|
+
expect($viewScroll).toHaveBeenCalledWith(elem.querySelector("ng-view"));
|
|
345
345
|
});
|
|
346
346
|
});
|
|
347
347
|
|
|
@@ -809,7 +809,7 @@ describe("ngView named", () => {
|
|
|
809
809
|
$injector,
|
|
810
810
|
$state,
|
|
811
811
|
$rootScope,
|
|
812
|
-
$
|
|
812
|
+
$viewScroll;
|
|
813
813
|
|
|
814
814
|
beforeEach(() => {
|
|
815
815
|
window.angular = new Angular();
|
|
@@ -831,12 +831,12 @@ describe("ngView named", () => {
|
|
|
831
831
|
"defaultModule",
|
|
832
832
|
]);
|
|
833
833
|
|
|
834
|
-
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$
|
|
834
|
+
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$viewScroll_) => {
|
|
835
835
|
$rootScope = _$rootScope_;
|
|
836
836
|
scope = $rootScope.$new();
|
|
837
837
|
$compile = _$compile_;
|
|
838
838
|
$state = _$state_;
|
|
839
|
-
$
|
|
839
|
+
$viewScroll = _$viewScroll_;
|
|
840
840
|
});
|
|
841
841
|
});
|
|
842
842
|
|
|
@@ -852,7 +852,7 @@ describe("ngView named", () => {
|
|
|
852
852
|
|
|
853
853
|
// Test for https://github.com/angular-ui/ui-router/issues/3355
|
|
854
854
|
xit("should target weird nested view setups using the view's simple name", async () => {
|
|
855
|
-
|
|
855
|
+
elem.innerHTML = `
|
|
856
856
|
<div>
|
|
857
857
|
<div ng-view="main">
|
|
858
858
|
MAIN-DEFAULT-
|
|
@@ -862,7 +862,6 @@ describe("ngView named", () => {
|
|
|
862
862
|
</div>
|
|
863
863
|
</div>
|
|
864
864
|
`;
|
|
865
|
-
elem.innerHTML = tpl;
|
|
866
865
|
$compile(elem)($rootScope);
|
|
867
866
|
|
|
868
867
|
$state.go("test");
|
|
@@ -904,7 +903,7 @@ describe("ngView transclusion", () => {
|
|
|
904
903
|
"defaultModule",
|
|
905
904
|
]);
|
|
906
905
|
|
|
907
|
-
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$
|
|
906
|
+
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$viewScroll_) => {
|
|
908
907
|
$rootScope = _$rootScope_;
|
|
909
908
|
scope = $rootScope.$new();
|
|
910
909
|
$compile = _$compile_;
|
|
@@ -974,7 +973,7 @@ describe("ngView controllers or onEnter handlers", () => {
|
|
|
974
973
|
"defaultModule",
|
|
975
974
|
]);
|
|
976
975
|
|
|
977
|
-
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$
|
|
976
|
+
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$viewScroll_) => {
|
|
978
977
|
$rootScope = _$rootScope_;
|
|
979
978
|
scope = $rootScope.$new();
|
|
980
979
|
$compile = _$compile_;
|
|
@@ -1833,9 +1832,9 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1833
1832
|
name: "ng12-dynamic-directive",
|
|
1834
1833
|
url: "/ng12dynamicDirective/:type",
|
|
1835
1834
|
componentProvider: [
|
|
1836
|
-
"$
|
|
1837
|
-
function ($
|
|
1838
|
-
return $
|
|
1835
|
+
"$router",
|
|
1836
|
+
function ($router) {
|
|
1837
|
+
return $router.params.type;
|
|
1839
1838
|
},
|
|
1840
1839
|
],
|
|
1841
1840
|
});
|
|
@@ -1861,9 +1860,9 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1861
1860
|
name: "dynamicComponent",
|
|
1862
1861
|
url: "/dynamicComponent/:type",
|
|
1863
1862
|
componentProvider: [
|
|
1864
|
-
"$
|
|
1865
|
-
function ($
|
|
1866
|
-
return $
|
|
1863
|
+
"$router",
|
|
1864
|
+
function ($router) {
|
|
1865
|
+
return $router.params.type;
|
|
1867
1866
|
},
|
|
1868
1867
|
],
|
|
1869
1868
|
});
|
|
@@ -6,13 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
<link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
|
|
8
8
|
<link rel="stylesheet" href="/jasmine/jasmine.css" />
|
|
9
|
-
<link rel="stylesheet" href="/
|
|
9
|
+
<link rel="stylesheet" href="/jasmine-helper.css" />
|
|
10
10
|
<script src="/jasmine/jasmine.js"></script>
|
|
11
11
|
<script src="/jasmine/jasmine-html.js"></script>
|
|
12
12
|
<script src="/jasmine/boot0.js"></script>
|
|
13
13
|
<script src="/jasmine/boot1.js"></script>
|
|
14
|
-
<script type="module" src="/src/router/
|
|
15
|
-
<script type="module" src="/src/router/common/queue.spec.js"></script>
|
|
14
|
+
<script type="module" src="/src/router/glob/glob.spec.js"></script>
|
|
16
15
|
</head>
|
|
17
16
|
<body>
|
|
18
17
|
<div id="app"></div>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { test, expect } from "@playwright/test";
|
|
2
2
|
|
|
3
|
-
const TEST_URL = "src/router/
|
|
3
|
+
const TEST_URL = "src/router/glob/glob.html";
|
|
4
4
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
+
await page.waitForTimeout(1000);
|
|
8
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
10
|
/0 failures/,
|
|
10
11
|
);
|
|
@@ -27,7 +27,6 @@ export class ParamType {
|
|
|
27
27
|
/**
|
|
28
28
|
* @param def A configuration object which contains the custom type definition. The object's
|
|
29
29
|
* properties will override the default methods and/or pattern in `ParamType`'s public interface.
|
|
30
|
-
* @returns a new ParamType object
|
|
31
30
|
*/
|
|
32
31
|
constructor(def) {
|
|
33
32
|
this.pattern = /.*/;
|
|
@@ -192,7 +192,7 @@ export class Param {
|
|
|
192
192
|
const normalized = this.type.$normalize(value);
|
|
193
193
|
if (!this.type.is(normalized)) return false;
|
|
194
194
|
// The value was of the correct type, but when encoded, did not match the ParamType's regexp
|
|
195
|
-
const encoded = this.type.encode(normalized);
|
|
195
|
+
const encoded = normalized; // this.type.encode(normalized);
|
|
196
196
|
return !(isString(encoded) && !this.type.pattern.exec(encoded));
|
|
197
197
|
}
|
|
198
198
|
toString() {
|
|
@@ -89,8 +89,13 @@ export class PathUtils {
|
|
|
89
89
|
// The param keys specified by the incoming toParams
|
|
90
90
|
return toPath.map(makeInheritedParamsNode);
|
|
91
91
|
}
|
|
92
|
+
|
|
92
93
|
/**
|
|
93
94
|
* Computes the tree changes (entering, exiting) between a fromPath and toPath.
|
|
95
|
+
* @param {PathNode[]} fromPath
|
|
96
|
+
* @param {PathNode[]} toPath
|
|
97
|
+
* @param {boolean} [reloadState]
|
|
98
|
+
* @returns {import("../transition/interface.js").TreeChanges}
|
|
94
99
|
*/
|
|
95
100
|
static treeChanges(fromPath, toPath, reloadState) {
|
|
96
101
|
const max = Math.min(fromPath.length, toPath.length);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>AngularTS</title>
|
|
6
|
+
<link rel="shortcut icon" type="image/png" href="images/favicon.ico" />
|
|
7
|
+
<script type="module" src="../index.js"></script>
|
|
8
|
+
<script>
|
|
9
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
10
|
+
window.angular.module("router", []).config([
|
|
11
|
+
"$stateProvider",
|
|
12
|
+
"$locationProvider",
|
|
13
|
+
($stateProvider, $locationProvider) => {
|
|
14
|
+
$locationProvider.html5ModeConf = {
|
|
15
|
+
enabled: false,
|
|
16
|
+
};
|
|
17
|
+
$stateProvider
|
|
18
|
+
.state({
|
|
19
|
+
name: "home",
|
|
20
|
+
url: "",
|
|
21
|
+
template: `
|
|
22
|
+
<h1>Home</h1>
|
|
23
|
+
<a ng-sref="page1">Page 1</a>
|
|
24
|
+
<a ng-sref="page2">Page 2</a>
|
|
25
|
+
`,
|
|
26
|
+
})
|
|
27
|
+
.state({
|
|
28
|
+
name: "page1",
|
|
29
|
+
url: "/page1",
|
|
30
|
+
template: "<h3>Its the NG-Router hello world app!</h3>",
|
|
31
|
+
})
|
|
32
|
+
.state({
|
|
33
|
+
name: "page2",
|
|
34
|
+
url: "/page2",
|
|
35
|
+
template: "This is another template",
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
]);
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
</head>
|
|
42
|
+
<body ng-app="router">
|
|
43
|
+
<ng-view></ng-view>
|
|
44
|
+
</body>
|
|
45
|
+
</html>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StateParams } from "./params/state-params.js";
|
|
2
|
-
import { Queue } from "
|
|
2
|
+
import { Queue } from "../shared/queue.js";
|
|
3
3
|
|
|
4
4
|
/** @typedef {import('../interface.ts').ServiceProvider} ServiceProvider } */
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ import { Queue } from "./common/queue.js";
|
|
|
9
9
|
* This is where we hold the global mutable state such as current state, current
|
|
10
10
|
* params, current transition, etc.
|
|
11
11
|
*/
|
|
12
|
-
export class
|
|
12
|
+
export class Router {
|
|
13
13
|
constructor() {
|
|
14
14
|
/**
|
|
15
15
|
* Current parameter values
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Angular } from "../
|
|
1
|
+
import { Angular } from "../angular.js";
|
|
2
2
|
import { dealoc } from "../shared/dom.js";
|
|
3
3
|
|
|
4
4
|
describe("router services", () => {
|
|
@@ -11,16 +11,16 @@ describe("router services", () => {
|
|
|
11
11
|
let module = window["angular"].module("defaultModule", []);
|
|
12
12
|
module.config(
|
|
13
13
|
(
|
|
14
|
-
$
|
|
14
|
+
$urlProvider,
|
|
15
15
|
$stateRegistryProvider,
|
|
16
|
-
$
|
|
16
|
+
$routerProvider,
|
|
17
17
|
$transitionsProvider,
|
|
18
18
|
$stateProvider,
|
|
19
19
|
) => {
|
|
20
20
|
providers = {
|
|
21
|
-
$
|
|
21
|
+
$urlProvider,
|
|
22
22
|
$stateRegistryProvider,
|
|
23
|
-
$
|
|
23
|
+
$routerProvider,
|
|
24
24
|
$transitionsProvider,
|
|
25
25
|
$stateProvider,
|
|
26
26
|
};
|
|
@@ -33,7 +33,7 @@ describe("router services", () => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
it("Should expose ng-router providers from the UIRouter instance", () => {
|
|
36
|
-
expect(providers.$
|
|
36
|
+
expect(providers.$urlProvider).toBeDefined();
|
|
37
37
|
expect(providers.$stateRegistryProvider).toBeDefined();
|
|
38
38
|
expect(providers.$stateRegistryProvider).toBeDefined();
|
|
39
39
|
expect(providers.$transitionsProvider).toBeDefined();
|
|
@@ -41,12 +41,11 @@ describe("router services", () => {
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
it("Should expose ng-router services from the UIRouter instance", () => {
|
|
44
|
-
expect($injector.get("$
|
|
44
|
+
expect($injector.get("$url")).toBeDefined();
|
|
45
45
|
expect($injector.get("$stateRegistry")).toBeDefined();
|
|
46
|
-
expect($injector.get("$
|
|
46
|
+
expect($injector.get("$router")).toBeDefined();
|
|
47
47
|
expect($injector.get("$transitions")).toBeDefined();
|
|
48
48
|
expect($injector.get("$state")).toBeDefined();
|
|
49
|
-
expect($injector.get("$stateParams")).toBeDefined();
|
|
50
49
|
expect($injector.get("$view")).toBeDefined();
|
|
51
50
|
expect($injector.get("$trace")).toBeDefined();
|
|
52
51
|
});
|
|
@@ -607,7 +607,7 @@ export interface StateDeclaration {
|
|
|
607
607
|
*
|
|
608
608
|
* An optional object which defines multiple views, or explicitly targets specific named ui-views.
|
|
609
609
|
*
|
|
610
|
-
* - What is a view
|
|
610
|
+
* - What is a view urlConfig
|
|
611
611
|
* - What is a ui-view
|
|
612
612
|
* - Shorthand controller/template
|
|
613
613
|
* - Incompatible with ^
|
|
@@ -30,7 +30,7 @@ function dataBuilder(state) {
|
|
|
30
30
|
return state.data;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function getUrlBuilder($
|
|
33
|
+
function getUrlBuilder($url, root) {
|
|
34
34
|
return function (stateObject) {
|
|
35
35
|
let stateDec = stateObject.self;
|
|
36
36
|
// For future states, i.e., states whose name ends with `.**`,
|
|
@@ -50,9 +50,9 @@ function getUrlBuilder($urlService, root) {
|
|
|
50
50
|
const parsed = parseUrl(stateDec.url);
|
|
51
51
|
const url = !parsed
|
|
52
52
|
? stateDec.url
|
|
53
|
-
: $
|
|
53
|
+
: $url.compile(parsed.val, { state: stateDec });
|
|
54
54
|
if (!url) return null;
|
|
55
|
-
if (!$
|
|
55
|
+
if (!$url.isMatcher(url))
|
|
56
56
|
throw new Error(`Invalid url '${url}' in state '${stateObject}'`);
|
|
57
57
|
return parsed && parsed.root
|
|
58
58
|
? url
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaults, find } from "../../shared/common.js";
|
|
2
2
|
import { propEq } from "../../shared/hof.js";
|
|
3
|
-
import { Glob } from "../
|
|
3
|
+
import { Glob } from "../glob/glob.js";
|
|
4
4
|
import { hasOwn, isFunction, isObject } from "../../shared/utils.js";
|
|
5
5
|
|
|
6
6
|
/** @typedef {import('./interface.js').StateDeclaration} StateDeclaration */
|
|
@@ -16,17 +16,17 @@ import { $injectTokens, provider } from "../../injection-tokens.js";
|
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
export class StateRegistryProvider {
|
|
19
|
-
static $inject = provider([
|
|
20
|
-
$injectTokens.$
|
|
19
|
+
/* @ignore */ static $inject = provider([
|
|
20
|
+
$injectTokens.$url,
|
|
21
21
|
$injectTokens.$state,
|
|
22
|
-
$injectTokens.$
|
|
22
|
+
$injectTokens.$router,
|
|
23
23
|
$injectTokens.$view,
|
|
24
24
|
]);
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @param urlService
|
|
28
28
|
* @param stateService
|
|
29
|
-
* @param {import('../
|
|
29
|
+
* @param {import('../router.js').Router} globals
|
|
30
30
|
* @param viewService
|
|
31
31
|
*/
|
|
32
32
|
constructor(urlService, stateService, globals, viewService) {
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
silentRejection,
|
|
7
7
|
} from "../../shared/common.js";
|
|
8
8
|
import { isDefined, isObject, isString, minErr } from "../../shared/utils.js";
|
|
9
|
-
import { Queue } from "
|
|
9
|
+
import { Queue } from "../../shared/queue.js";
|
|
10
10
|
import { makeTargetState } from "../path/path-utils.js";
|
|
11
11
|
import { PathNode } from "../path/path-node.js";
|
|
12
12
|
import { defaultTransOpts } from "../transition/transition-service.js";
|
|
13
13
|
import { Rejection, RejectType } from "../transition/reject-factory.js";
|
|
14
14
|
import { TargetState } from "./target-state.js";
|
|
15
15
|
import { Param } from "../params/param.js";
|
|
16
|
-
import { Glob } from "../
|
|
16
|
+
import { Glob } from "../glob/glob.js";
|
|
17
17
|
import { ResolveContext } from "../resolve/resolve-context.js";
|
|
18
18
|
import { lazyLoadState } from "../hooks/lazy-load.js";
|
|
19
19
|
import { val } from "../../shared/hof.js";
|
|
@@ -30,7 +30,7 @@ export class StateProvider {
|
|
|
30
30
|
/**
|
|
31
31
|
* The latest successful state parameters
|
|
32
32
|
*
|
|
33
|
-
* @deprecated This is a passthrough through to [[
|
|
33
|
+
* @deprecated This is a passthrough through to [[Router.params]]
|
|
34
34
|
*/
|
|
35
35
|
get params() {
|
|
36
36
|
return this.globals.params;
|
|
@@ -38,7 +38,7 @@ export class StateProvider {
|
|
|
38
38
|
/**
|
|
39
39
|
* The current [[StateDeclaration]]
|
|
40
40
|
*
|
|
41
|
-
* @deprecated This is a passthrough through to [[
|
|
41
|
+
* @deprecated This is a passthrough through to [[Router.current]]
|
|
42
42
|
*/
|
|
43
43
|
get current() {
|
|
44
44
|
return this.globals.current;
|
|
@@ -46,18 +46,18 @@ export class StateProvider {
|
|
|
46
46
|
/**
|
|
47
47
|
* The current [[StateObject]] (an internal API)
|
|
48
48
|
*
|
|
49
|
-
* @deprecated This is a passthrough through to [[
|
|
49
|
+
* @deprecated This is a passthrough through to [[Router.$current]]
|
|
50
50
|
*/
|
|
51
51
|
get $current() {
|
|
52
52
|
return this.globals.$current;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
static $inject = ["$
|
|
55
|
+
/* @ignore */ static $inject = ["$routerProvider", "$transitionsProvider"];
|
|
56
56
|
|
|
57
57
|
// Needs access to urlService, stateRegistry
|
|
58
58
|
/**
|
|
59
59
|
*
|
|
60
|
-
* @param {import('../
|
|
60
|
+
* @param {import('../router.js').Router} globals
|
|
61
61
|
* @param {*} transitionService
|
|
62
62
|
*/
|
|
63
63
|
constructor(globals, transitionService) {
|
|
@@ -131,9 +131,9 @@ export class StateProvider {
|
|
|
131
131
|
* - **params** `{object}` - returns an array of state params that are ensured to
|
|
132
132
|
* be a super-set of parent's params.
|
|
133
133
|
* - **views** `{object}` - returns a views object where each key is an absolute view
|
|
134
|
-
* name (i.e. "viewName@stateName") and each value is the
|
|
134
|
+
* name (i.e. "viewName@stateName") and each value is the urlConfig object
|
|
135
135
|
* (template, controller) for the view. Even when you don't use the views object
|
|
136
|
-
* explicitly on a state
|
|
136
|
+
* explicitly on a state urlConfig, one is still created for you internally.
|
|
137
137
|
* So by decorating this builder function you have access to decorating template
|
|
138
138
|
* and controller properties.
|
|
139
139
|
* - **ownParams** `{object}` - returns an array of params that belong to the state,
|
|
@@ -151,10 +151,10 @@ export class StateProvider {
|
|
|
151
151
|
* let result = {},
|
|
152
152
|
* views = parent(state);
|
|
153
153
|
*
|
|
154
|
-
* angular.forEach(views, function (
|
|
154
|
+
* angular.forEach(views, function (urlConfig, name) {
|
|
155
155
|
* let autoName = (state.name + '.' + name).replace('.', '/');
|
|
156
|
-
*
|
|
157
|
-
* result[name] =
|
|
156
|
+
* urlConfig.templateUrl = urlConfig.templateUrl || '/partials/' + autoName + '.html';
|
|
157
|
+
* result[name] = urlConfig;
|
|
158
158
|
* });
|
|
159
159
|
* return result;
|
|
160
160
|
* });
|
|
@@ -178,7 +178,7 @@ export class StateProvider {
|
|
|
178
178
|
* @param {object} func A function that is responsible for decorating the original
|
|
179
179
|
* builder function. The function receives two parameters:
|
|
180
180
|
*
|
|
181
|
-
* - `{object}` - state - The state
|
|
181
|
+
* - `{object}` - state - The state urlConfig object.
|
|
182
182
|
* - `{object}` - super - The original builder function.
|
|
183
183
|
*
|
|
184
184
|
* @return {object} $stateProvider - $stateProvider instance
|
|
@@ -411,7 +411,7 @@ export class StateProvider {
|
|
|
411
411
|
const globals = this.globals;
|
|
412
412
|
const latestSuccess = globals.successfulTransitions.peekTail();
|
|
413
413
|
const rootPath = () => [new PathNode(this.stateRegistry.root())];
|
|
414
|
-
return latestSuccess ? latestSuccess.
|
|
414
|
+
return latestSuccess ? latestSuccess._treeChanges.to : rootPath();
|
|
415
415
|
}
|
|
416
416
|
/**
|
|
417
417
|
* Low-level method for transitioning to a new state.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dealoc } from "../../shared/dom.js";
|
|
2
|
-
import { Angular } from "../../
|
|
2
|
+
import { Angular } from "../../angular.js";
|
|
3
3
|
import { isFunction } from "../../shared/utils.js";
|
|
4
4
|
import { wait } from "../../shared/test-utils.js";
|
|
5
5
|
|
|
@@ -101,8 +101,9 @@ describe("$state", () => {
|
|
|
101
101
|
// some tests are polluting the cache
|
|
102
102
|
window.angular = new Angular();
|
|
103
103
|
module = window.angular.module("defaultModule", []);
|
|
104
|
-
module.config((_$stateProvider_, _$provide_) => {
|
|
104
|
+
module.config((_$stateProvider_, _$provide_, _$locationProvider_) => {
|
|
105
105
|
$stateProvider = _$stateProvider_;
|
|
106
|
+
_$locationProvider_.html5ModeConf.enabled = false;
|
|
106
107
|
});
|
|
107
108
|
window.angular.bootstrap(document.getElementById("app"), [
|
|
108
109
|
"defaultModule",
|
|
@@ -143,10 +144,10 @@ describe("$state", () => {
|
|
|
143
144
|
dealoc(document.getElementById("app"));
|
|
144
145
|
window.angular = new Angular();
|
|
145
146
|
module = window.angular.module("defaultModule", []);
|
|
146
|
-
module.config((_$stateProvider_, _$provide_) => {
|
|
147
|
+
module.config((_$stateProvider_, _$provide_, _$locationProvider_) => {
|
|
147
148
|
$stateProvider = _$stateProvider_;
|
|
148
149
|
$provide = _$provide_;
|
|
149
|
-
|
|
150
|
+
_$locationProvider_.html5ModeConf.enabled = false;
|
|
150
151
|
[A, B, C, D, DD, E, H, HH, HHH].forEach(function (state) {
|
|
151
152
|
state.onEnter = callbackLogger(state, "onEnter");
|
|
152
153
|
state.onExit = callbackLogger(state, "onExit");
|
|
@@ -457,7 +458,7 @@ describe("$state", () => {
|
|
|
457
458
|
}).forEach(([k, v]) => {
|
|
458
459
|
expect($stateParams[k]).toEqual(v);
|
|
459
460
|
});
|
|
460
|
-
expect($location.
|
|
461
|
+
expect($location.getUrl()).toEqual(
|
|
461
462
|
"/dynstate/p1/pd1?search=s1&searchDyn=sd1",
|
|
462
463
|
);
|
|
463
464
|
});
|
|
@@ -617,14 +618,14 @@ describe("$state", () => {
|
|
|
617
618
|
});
|
|
618
619
|
|
|
619
620
|
it("does not exit nor enter a state when only dynamic params change (triggered via url)", async () => {
|
|
620
|
-
$location.
|
|
621
|
+
$location.setSearch({ search: "s1", searchDyn: "sd2" });
|
|
621
622
|
$rootScope.$broadcast("$locationChangeSuccess");
|
|
622
623
|
await wait(100);
|
|
623
624
|
expect(dynlog).toBe("success;[searchDyn=sd2];");
|
|
624
625
|
});
|
|
625
626
|
|
|
626
627
|
it("exits and enters a state when any non-dynamic params change (triggered via url)", async () => {
|
|
627
|
-
$location.
|
|
628
|
+
$location.setSearch({ search: "s2", searchDyn: "sd2" });
|
|
628
629
|
$rootScope.$broadcast("$locationChangeSuccess");
|
|
629
630
|
await wait(100);
|
|
630
631
|
expect(dynlog).toBe("exit:dyn;enter:dyn;success;");
|
|
@@ -650,23 +651,23 @@ describe("$state", () => {
|
|
|
650
651
|
});
|
|
651
652
|
});
|
|
652
653
|
|
|
653
|
-
it("updates $stateParams and $location.
|
|
654
|
-
$location.
|
|
654
|
+
it("updates $stateParams and $location.setSearch when only dynamic params change (triggered via url)", async () => {
|
|
655
|
+
$location.setSearch({ search: "s1", searchDyn: "sd2" });
|
|
655
656
|
$rootScope.$broadcast("$locationChangeSuccess");
|
|
656
657
|
await wait(100);
|
|
657
658
|
expect($stateParams.search).toBe("s1");
|
|
658
659
|
expect($stateParams.searchDyn).toBe("sd2");
|
|
659
|
-
expect($location.
|
|
660
|
+
expect($location.getSearch()).toEqual({
|
|
660
661
|
search: "s1",
|
|
661
662
|
searchDyn: "sd2",
|
|
662
663
|
});
|
|
663
664
|
});
|
|
664
665
|
|
|
665
|
-
it("updates $stateParams and $location.
|
|
666
|
+
it("updates $stateParams and $location.setSearch when only dynamic params change (triggered via $state transition)", async () => {
|
|
666
667
|
await $state.go(".", { searchDyn: "sd2" });
|
|
667
668
|
expect($stateParams.search).toBe("s1");
|
|
668
669
|
expect($stateParams.searchDyn).toBe("sd2");
|
|
669
|
-
expect($location.
|
|
670
|
+
expect($location.getSearch()).toEqual({
|
|
670
671
|
search: "s1",
|
|
671
672
|
searchDyn: "sd2",
|
|
672
673
|
});
|
|
@@ -683,7 +684,7 @@ describe("$state", () => {
|
|
|
683
684
|
// observedParamValue = newval;
|
|
684
685
|
// });
|
|
685
686
|
// await wait(100);
|
|
686
|
-
// $location.
|
|
687
|
+
// $location.setSearch({ search: "s1", searchDyn: "sd2" });
|
|
687
688
|
// $rootScope.$broadcast("$locationChangeSuccess");
|
|
688
689
|
|
|
689
690
|
// await wait(100);
|
|
@@ -806,7 +807,7 @@ describe("$state", () => {
|
|
|
806
807
|
// this passes in isolation
|
|
807
808
|
it("updates $stateParams", async () => {
|
|
808
809
|
await initStateTo(RS);
|
|
809
|
-
$location.
|
|
810
|
+
$location.setSearch({ term: "hello" });
|
|
810
811
|
$rootScope.$broadcast("$locationChangeSuccess");
|
|
811
812
|
await wait(100);
|
|
812
813
|
expect($stateParams.term).toEqual("hello");
|
|
@@ -814,10 +815,10 @@ describe("$state", () => {
|
|
|
814
815
|
});
|
|
815
816
|
|
|
816
817
|
it("doesn't re-enter state (triggered by url change)", async () => {
|
|
817
|
-
$location.
|
|
818
|
+
$location.setSearch({ term: "hello" });
|
|
818
819
|
$rootScope.$broadcast("$locationChangeSuccess");
|
|
819
820
|
|
|
820
|
-
expect($location.
|
|
821
|
+
expect($location.getSearch()).toEqual({ term: "hello" });
|
|
821
822
|
expect(entered).toBeFalsy();
|
|
822
823
|
});
|
|
823
824
|
|
|
@@ -833,7 +834,7 @@ describe("$state", () => {
|
|
|
833
834
|
expect($state.current).toBe(RS);
|
|
834
835
|
expect(entered).toBeFalsy();
|
|
835
836
|
expect(success).toBeTruthy();
|
|
836
|
-
expect($location.
|
|
837
|
+
expect($location.getSearch()).toEqual({ term: "hello" });
|
|
837
838
|
});
|
|
838
839
|
|
|
839
840
|
it("updates URL when (triggered by $state transition)", async () => {
|
|
@@ -841,7 +842,7 @@ describe("$state", () => {
|
|
|
841
842
|
await $state.go(".", { term: "goodbye" });
|
|
842
843
|
|
|
843
844
|
expect($stateParams.term).toEqual("goodbye");
|
|
844
|
-
expect($location.
|
|
845
|
+
expect($location.getUrl()).toEqual("/search?term=goodbye");
|
|
845
846
|
expect(entered).toBeFalsy();
|
|
846
847
|
});
|
|
847
848
|
});
|
|
@@ -976,19 +977,19 @@ describe("$state", () => {
|
|
|
976
977
|
|
|
977
978
|
it("updates the location #fragment", async () => {
|
|
978
979
|
await $state.transitionTo("home.item", { id: "world", "#": "frag" });
|
|
979
|
-
expect($location.
|
|
980
|
-
expect($location.
|
|
980
|
+
expect($location.getUrl()).toBe("/front/world#frag");
|
|
981
|
+
expect($location.getHash()).toBe("frag");
|
|
981
982
|
});
|
|
982
983
|
|
|
983
984
|
// passes in isolation. on success callback being polluted
|
|
984
985
|
it("runs a transition when the location #fragment is updated", async () => {
|
|
985
986
|
$state.transitionTo("home.item", { id: "world", "#": "frag" });
|
|
986
987
|
await wait(100);
|
|
987
|
-
expect($location.
|
|
988
|
+
expect($location.getHash()).toBe("frag");
|
|
988
989
|
|
|
989
990
|
$state.transitionTo("home.item", { id: "world", "#": "blarg" });
|
|
990
991
|
await wait(100);
|
|
991
|
-
expect($location.
|
|
992
|
+
expect($location.getHash()).toBe("blarg");
|
|
992
993
|
});
|
|
993
994
|
|
|
994
995
|
it("injects $transition$ into resolves", async () => {
|