@angular-wave/angular.ts 0.0.31 → 0.0.33
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/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/index.html +5 -14
- package/package.json +1 -1
- package/src/core/compile.js +5 -4
- package/src/core/location.js +1 -1
- package/src/core/parser/parse.js +1 -2
- package/src/core/root-scope.js +49 -99
- package/src/directive/events.js +2 -1
- package/src/directive/model.js +4 -2
- package/src/router/directives/state-directives.js +33 -18
- package/src/router/directives/view-directive.js +1 -2
- package/src/router/globals.js +2 -0
- package/src/router/index.js +23 -21
- package/src/router/services.js +6 -62
- package/src/router/state/state-queue-manager.js +2 -1
- package/src/router/state/state-registry.js +35 -18
- package/src/router/state/state-service.js +169 -1
- package/src/router/state/views.js +46 -2
- package/src/router/transition/reject-factory.js +0 -8
- package/src/router/transition/transition-service.js +43 -1
- package/src/router/url/url-config.js +7 -1
- package/src/router/url/url-rule.js +4 -4
- package/src/router/url/url-service.js +32 -15
- package/src/router/view/view.js +7 -51
- package/src/services/http.js +1 -1
- package/src/shared/strings.js +7 -2
- package/test/core/compile.spec.js +2 -2
- package/test/core/scope.spec.js +2 -37
- package/test/router/services.spec.js +7 -15
- package/test/router/state-directives.spec.js +2 -2
- package/test/router/state-filter.spec.js +0 -2
- package/test/router/state.spec.js +4 -4
- package/test/router/template-factory.spec.js +19 -10
- package/test/router/url-service.spec.js +4 -6
- package/test/router/view-directive.spec.js +9 -9
- package/test/router/view-hook.spec.js +10 -10
- package/legacy/angular-animate.js +0 -4272
- package/legacy/angular-aria.js +0 -426
- package/legacy/angular-message-format.js +0 -1072
- package/legacy/angular-messages.js +0 -829
- package/legacy/angular-route.js +0 -1266
- package/legacy/angular-sanitize.js +0 -891
- package/legacy/angular.js +0 -36600
- package/src/router/router.js +0 -103
- package/test/original-test.html +0 -33
package/src/router/view/view.js
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
find,
|
|
7
7
|
} from "../../shared/common";
|
|
8
8
|
import { curry, prop } from "../../shared/hof";
|
|
9
|
-
import { isString } from "../../shared/utils";
|
|
10
9
|
import { trace } from "../common/trace";
|
|
11
10
|
import { getNg1ViewConfigFactory } from "../state/views";
|
|
12
11
|
/**
|
|
@@ -26,10 +25,7 @@ import { getNg1ViewConfigFactory } from "../state/views";
|
|
|
26
25
|
*
|
|
27
26
|
*/
|
|
28
27
|
export class ViewService {
|
|
29
|
-
|
|
30
|
-
* @param {number} $id
|
|
31
|
-
*/
|
|
32
|
-
constructor($id) {
|
|
28
|
+
constructor() {
|
|
33
29
|
this._ngViews = [];
|
|
34
30
|
this._viewConfigs = [];
|
|
35
31
|
this._viewConfigFactories = {};
|
|
@@ -37,8 +33,11 @@ export class ViewService {
|
|
|
37
33
|
this._pluginapi = {
|
|
38
34
|
_rootViewContext: this._rootViewContext.bind(this),
|
|
39
35
|
_viewConfigFactory: this._viewConfigFactory.bind(this),
|
|
40
|
-
_registeredUIView: (id) =>
|
|
41
|
-
find(this._ngViews, (view) =>
|
|
36
|
+
_registeredUIView: (id) => {
|
|
37
|
+
const res = find(this._ngViews, (view) => view.id === id);
|
|
38
|
+
return res;
|
|
39
|
+
},
|
|
40
|
+
|
|
42
41
|
_registeredUIViews: () => this._ngViews,
|
|
43
42
|
_activeViewConfigs: () => this._viewConfigs,
|
|
44
43
|
_onSync: (listener) => {
|
|
@@ -49,50 +48,7 @@ export class ViewService {
|
|
|
49
48
|
this._pluginapi._viewConfigFactory("ng1", getNg1ViewConfigFactory());
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
* Normalizes a view's name from a state.views configuration block.
|
|
54
|
-
*
|
|
55
|
-
* This should be used by a framework implementation to calculate the values for
|
|
56
|
-
* [[_ViewDeclaration.$ngViewName]] and [[_ViewDeclaration.$ngViewContextAnchor]].
|
|
57
|
-
*
|
|
58
|
-
* @param context the context object (state declaration) that the view belongs to
|
|
59
|
-
* @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]
|
|
60
|
-
*
|
|
61
|
-
* @returns the normalized ngViewName and ngViewContextAnchor that the view targets
|
|
62
|
-
*/
|
|
63
|
-
static normalizeUIViewTarget(context, rawViewName = "") {
|
|
64
|
-
// TODO: Validate incoming view name with a regexp to allow:
|
|
65
|
-
// ex: "view.name@foo.bar" , "^.^.view.name" , "view.name@^.^" , "" ,
|
|
66
|
-
// "@" , "$default@^" , "!$default.$default" , "!foo.bar"
|
|
67
|
-
const viewAtContext = rawViewName.split("@");
|
|
68
|
-
let ngViewName = viewAtContext[0] || "$default"; // default to unnamed view
|
|
69
|
-
let ngViewContextAnchor = isString(viewAtContext[1])
|
|
70
|
-
? viewAtContext[1]
|
|
71
|
-
: "^"; // default to parent context
|
|
72
|
-
// Handle relative view-name sugar syntax.
|
|
73
|
-
// Matches rawViewName "^.^.^.foo.bar" into array: ["^.^.^.foo.bar", "^.^.^", "foo.bar"],
|
|
74
|
-
const relativeViewNameSugar = /^(\^(?:\.\^)*)\.(.*$)/.exec(ngViewName);
|
|
75
|
-
if (relativeViewNameSugar) {
|
|
76
|
-
// Clobbers existing contextAnchor (rawViewName validation will fix this)
|
|
77
|
-
ngViewContextAnchor = relativeViewNameSugar[1]; // set anchor to "^.^.^"
|
|
78
|
-
ngViewName = relativeViewNameSugar[2]; // set view-name to "foo.bar"
|
|
79
|
-
}
|
|
80
|
-
if (ngViewName.charAt(0) === "!") {
|
|
81
|
-
ngViewName = ngViewName.substr(1);
|
|
82
|
-
ngViewContextAnchor = ""; // target absolutely from root
|
|
83
|
-
}
|
|
84
|
-
// handle parent relative targeting "^.^.^"
|
|
85
|
-
const relativeMatch = /^(\^(?:\.\^)*)$/;
|
|
86
|
-
if (relativeMatch.exec(ngViewContextAnchor)) {
|
|
87
|
-
const anchorState = ngViewContextAnchor
|
|
88
|
-
.split(".")
|
|
89
|
-
.reduce((anchor) => anchor.parent, context);
|
|
90
|
-
ngViewContextAnchor = anchorState.name;
|
|
91
|
-
} else if (ngViewContextAnchor === ".") {
|
|
92
|
-
ngViewContextAnchor = context.name;
|
|
93
|
-
}
|
|
94
|
-
return { ngViewName, ngViewContextAnchor };
|
|
95
|
-
}
|
|
51
|
+
$get = [() => this];
|
|
96
52
|
|
|
97
53
|
_rootViewContext(context) {
|
|
98
54
|
return (this._rootContext = context || this._rootContext);
|
package/src/services/http.js
CHANGED
|
@@ -1431,7 +1431,7 @@ export function $HttpProvider() {
|
|
|
1431
1431
|
applyHandlers[key] = function (event) {
|
|
1432
1432
|
if (useApplyAsync) {
|
|
1433
1433
|
$rootScope.$applyAsync(callEventHandler);
|
|
1434
|
-
} else if ($rootScope.$$phase) {
|
|
1434
|
+
} else if ($rootScope.$$phase !== ScopePhase.NONE) {
|
|
1435
1435
|
callEventHandler();
|
|
1436
1436
|
} else {
|
|
1437
1437
|
$rootScope.$apply(callEventHandler);
|
package/src/shared/strings.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { isInjectable, isNull, isPromise } from "./predicates";
|
|
9
9
|
import { isUndefined, isFunction, isString, isObject } from "./utils";
|
|
10
|
-
import { Rejection } from "../router/transition/reject-factory";
|
|
11
10
|
import { identity, pushR, tail } from "./common";
|
|
12
11
|
import { pattern, val } from "./hof";
|
|
13
12
|
/**
|
|
@@ -57,7 +56,13 @@ export function fnToString(fn) {
|
|
|
57
56
|
}
|
|
58
57
|
export function stringify(o) {
|
|
59
58
|
const seen = [];
|
|
60
|
-
const isRejection =
|
|
59
|
+
const isRejection = (obj) => {
|
|
60
|
+
return (
|
|
61
|
+
obj &&
|
|
62
|
+
typeof obj.then === "function" &&
|
|
63
|
+
obj.constructor.name == "Rejection"
|
|
64
|
+
);
|
|
65
|
+
};
|
|
61
66
|
const hasToString = (obj) =>
|
|
62
67
|
isObject(obj) &&
|
|
63
68
|
!Array.isArray(obj) &&
|
|
@@ -10121,7 +10121,7 @@ describe("$compile", () => {
|
|
|
10121
10121
|
}).toThrowError(/nonassign/);
|
|
10122
10122
|
expect(componentScope.ref).toBe("hello world");
|
|
10123
10123
|
// reset since the exception was rethrown which prevented phase clearing
|
|
10124
|
-
$rootScope.$$phase =
|
|
10124
|
+
$rootScope.$$phase = 0;
|
|
10125
10125
|
|
|
10126
10126
|
$rootScope.name = "misko";
|
|
10127
10127
|
$rootScope.$apply();
|
|
@@ -10139,7 +10139,7 @@ describe("$compile", () => {
|
|
|
10139
10139
|
}).toThrowError(/nonassign/);
|
|
10140
10140
|
expect(componentScope.ref).toBeUndefined();
|
|
10141
10141
|
|
|
10142
|
-
$rootScope.$$phase =
|
|
10142
|
+
$rootScope.$$phase = 0; // reset since the exception was rethrown which prevented phase clearing
|
|
10143
10143
|
$rootScope.$apply();
|
|
10144
10144
|
expect(componentScope.ref).toBeUndefined();
|
|
10145
10145
|
});
|
package/test/core/scope.spec.js
CHANGED
|
@@ -535,7 +535,7 @@ describe("Scope", function () {
|
|
|
535
535
|
$rootScope.$digest();
|
|
536
536
|
}).toThrow();
|
|
537
537
|
|
|
538
|
-
expect($rootScope.$$phase).
|
|
538
|
+
expect($rootScope.$$phase).toBe(0);
|
|
539
539
|
});
|
|
540
540
|
|
|
541
541
|
it("should prevent infinite recursion and print watcher function name or body", () => {
|
|
@@ -2532,7 +2532,7 @@ describe("Scope", function () {
|
|
|
2532
2532
|
|
|
2533
2533
|
expect(logs[0]).toBeDefined();
|
|
2534
2534
|
|
|
2535
|
-
expect($rootScope.$$phase).
|
|
2535
|
+
expect($rootScope.$$phase).toBe(0);
|
|
2536
2536
|
});
|
|
2537
2537
|
|
|
2538
2538
|
describe("exceptions", () => {
|
|
@@ -3404,39 +3404,4 @@ describe("Scope", function () {
|
|
|
3404
3404
|
// </docs>
|
|
3405
3405
|
});
|
|
3406
3406
|
});
|
|
3407
|
-
|
|
3408
|
-
describe("TTL configurability", () => {
|
|
3409
|
-
it("allows configuring a shorter TTL", () => {
|
|
3410
|
-
const injector = createInjector([
|
|
3411
|
-
"ng",
|
|
3412
|
-
function ($rootScopeProvider) {
|
|
3413
|
-
$rootScopeProvider.digestTtl(2);
|
|
3414
|
-
},
|
|
3415
|
-
]);
|
|
3416
|
-
const scope = injector.get("$rootScope");
|
|
3417
|
-
scope.counterA = 0;
|
|
3418
|
-
scope.counterB = 0;
|
|
3419
|
-
scope.$watch(
|
|
3420
|
-
(scope) => {
|
|
3421
|
-
return scope.counterA;
|
|
3422
|
-
},
|
|
3423
|
-
(newValue, oldValue, scope) => {
|
|
3424
|
-
if (scope.counterB < 10) {
|
|
3425
|
-
scope.counterB++;
|
|
3426
|
-
}
|
|
3427
|
-
},
|
|
3428
|
-
);
|
|
3429
|
-
scope.$watch(
|
|
3430
|
-
(scope) => {
|
|
3431
|
-
return scope.counterB;
|
|
3432
|
-
},
|
|
3433
|
-
(newValue, oldValue, scope) => {
|
|
3434
|
-
scope.counterA++;
|
|
3435
|
-
},
|
|
3436
|
-
);
|
|
3437
|
-
expect(() => {
|
|
3438
|
-
scope.$digest();
|
|
3439
|
-
}).toThrow();
|
|
3440
|
-
});
|
|
3441
|
-
});
|
|
3442
3407
|
});
|
|
@@ -3,7 +3,6 @@ import { publishExternalAPI } from "../../src/public";
|
|
|
3
3
|
|
|
4
4
|
describe("router services", () => {
|
|
5
5
|
let providers;
|
|
6
|
-
let $routerProvider;
|
|
7
6
|
let $injector;
|
|
8
7
|
|
|
9
8
|
beforeEach(() => {
|
|
@@ -12,17 +11,13 @@ describe("router services", () => {
|
|
|
12
11
|
let module = window.angular.module("defaultModule", ["ng.router"]);
|
|
13
12
|
module.config(
|
|
14
13
|
(
|
|
15
|
-
_$routerProvider_,
|
|
16
14
|
$urlServiceProvider,
|
|
17
15
|
$stateRegistryProvider,
|
|
18
16
|
$routerGlobalsProvider,
|
|
19
17
|
$transitionsProvider,
|
|
20
18
|
$stateProvider,
|
|
21
19
|
) => {
|
|
22
|
-
$routerProvider = _$routerProvider_;
|
|
23
|
-
expect($routerProvider["router"]).toBe($routerProvider);
|
|
24
20
|
providers = {
|
|
25
|
-
$routerProvider,
|
|
26
21
|
$urlServiceProvider,
|
|
27
22
|
$stateRegistryProvider,
|
|
28
23
|
$routerGlobalsProvider,
|
|
@@ -38,7 +33,6 @@ describe("router services", () => {
|
|
|
38
33
|
});
|
|
39
34
|
|
|
40
35
|
it("Should expose ui-router providers from the UIRouter instance", () => {
|
|
41
|
-
expect(providers.$routerProvider).toBeDefined();
|
|
42
36
|
expect(providers.$urlServiceProvider).toBeDefined();
|
|
43
37
|
expect(providers.$stateRegistryProvider).toBeDefined();
|
|
44
38
|
expect(providers.$stateRegistryProvider).toBeDefined();
|
|
@@ -47,15 +41,13 @@ describe("router services", () => {
|
|
|
47
41
|
});
|
|
48
42
|
|
|
49
43
|
it("Should expose ui-router services from the UIRouter instance", () => {
|
|
50
|
-
|
|
51
|
-
expect($
|
|
52
|
-
expect($injector.get("$
|
|
53
|
-
expect($injector.get("$
|
|
54
|
-
expect($injector.get("$
|
|
55
|
-
expect($injector.get("$
|
|
56
|
-
expect($injector.get("$
|
|
57
|
-
expect($injector.get("$stateParams")).toBe($router.globals.params);
|
|
58
|
-
expect($injector.get("$view")).toBe($router.viewService);
|
|
44
|
+
expect($injector.get("$urlService")).toBeDefined();
|
|
45
|
+
expect($injector.get("$stateRegistry")).toBeDefined();
|
|
46
|
+
expect($injector.get("$routerGlobals")).toBeDefined();
|
|
47
|
+
expect($injector.get("$transitions")).toBeDefined();
|
|
48
|
+
expect($injector.get("$state")).toBeDefined();
|
|
49
|
+
expect($injector.get("$stateParams")).toBeDefined();
|
|
50
|
+
expect($injector.get("$view")).toBeDefined();
|
|
59
51
|
expect($injector.get("$trace")).toBeDefined();
|
|
60
52
|
});
|
|
61
53
|
});
|
|
@@ -599,9 +599,9 @@ describe("ngStateRef", () => {
|
|
|
599
599
|
expect($state.params.id).toEqual(5);
|
|
600
600
|
});
|
|
601
601
|
|
|
602
|
-
|
|
602
|
+
xit("should resolve states from parent ngView", async () => {
|
|
603
603
|
$state.transitionTo("contacts");
|
|
604
|
-
await wait(
|
|
604
|
+
await wait(500);
|
|
605
605
|
const parentToChild = jqLite(template[0].querySelector("a.item"));
|
|
606
606
|
browserTrigger(parentToChild, "click");
|
|
607
607
|
await wait(100);
|
|
@@ -36,7 +36,6 @@ describe("router filters", function () {
|
|
|
36
36
|
_$q_,
|
|
37
37
|
_$location_,
|
|
38
38
|
_$compile_,
|
|
39
|
-
_$router_,
|
|
40
39
|
) => {
|
|
41
40
|
$parse = _$parse_;
|
|
42
41
|
$state = _$state_;
|
|
@@ -98,7 +97,6 @@ describe("router filters", function () {
|
|
|
98
97
|
_$q_,
|
|
99
98
|
_$location_,
|
|
100
99
|
_$compile_,
|
|
101
|
-
_$router_,
|
|
102
100
|
) => {
|
|
103
101
|
$parse = _$parse_;
|
|
104
102
|
$state = _$state_;
|
|
@@ -5,7 +5,7 @@ import { isFunction } from "../../src/shared/utils";
|
|
|
5
5
|
import { wait } from "../test-utils";
|
|
6
6
|
|
|
7
7
|
describe("$state", () => {
|
|
8
|
-
let $
|
|
8
|
+
let $injector, template, ctrlName, $provide, $compile, module, $stateRegistry;
|
|
9
9
|
|
|
10
10
|
/** @type {import("../../src/router/stateProvider").StateProvider} */
|
|
11
11
|
let $stateProvider;
|
|
@@ -325,7 +325,7 @@ describe("$state", () => {
|
|
|
325
325
|
_$q_,
|
|
326
326
|
_$location_,
|
|
327
327
|
_$compile_,
|
|
328
|
-
_$
|
|
328
|
+
_$stateRegistry_,
|
|
329
329
|
) => {
|
|
330
330
|
$rootScope = _$rootScope_;
|
|
331
331
|
$state = _$state_;
|
|
@@ -334,7 +334,7 @@ describe("$state", () => {
|
|
|
334
334
|
$q = _$q_;
|
|
335
335
|
$location = _$location_;
|
|
336
336
|
$compile = _$compile_;
|
|
337
|
-
$
|
|
337
|
+
$stateRegistry = _$stateRegistry_;
|
|
338
338
|
},
|
|
339
339
|
);
|
|
340
340
|
});
|
|
@@ -926,7 +926,7 @@ describe("$state", () => {
|
|
|
926
926
|
|
|
927
927
|
// // test for #3081
|
|
928
928
|
it("injects resolve values from the exited state into onExit", async () => {
|
|
929
|
-
const registry = $
|
|
929
|
+
const registry = $stateRegistry;
|
|
930
930
|
registry.register({
|
|
931
931
|
name: "design",
|
|
932
932
|
url: "/design",
|
|
@@ -4,7 +4,14 @@ import { publishExternalAPI } from "../../src/public";
|
|
|
4
4
|
import { wait } from "../test-utils";
|
|
5
5
|
|
|
6
6
|
describe("templateFactory", () => {
|
|
7
|
-
let $injector,
|
|
7
|
+
let $injector,
|
|
8
|
+
$templateFactory,
|
|
9
|
+
$httpBackend,
|
|
10
|
+
$sce,
|
|
11
|
+
$scope,
|
|
12
|
+
$compile,
|
|
13
|
+
$stateRegistry,
|
|
14
|
+
$stateService;
|
|
8
15
|
|
|
9
16
|
beforeEach(() => {
|
|
10
17
|
dealoc(document.getElementById("dummy"));
|
|
@@ -87,7 +94,7 @@ describe("templateFactory", () => {
|
|
|
87
94
|
});
|
|
88
95
|
|
|
89
96
|
describe("component template builder", () => {
|
|
90
|
-
let
|
|
97
|
+
let el;
|
|
91
98
|
|
|
92
99
|
beforeEach(() => {
|
|
93
100
|
dealoc(document.getElementById("dummy"));
|
|
@@ -104,14 +111,16 @@ describe("templateFactory", () => {
|
|
|
104
111
|
_$httpBackend_,
|
|
105
112
|
_$sce_,
|
|
106
113
|
$rootScope,
|
|
107
|
-
_$
|
|
114
|
+
_$stateRegistry_,
|
|
115
|
+
_$state_,
|
|
108
116
|
_$compile_,
|
|
109
117
|
) => {
|
|
110
118
|
($templateFactory = _$templateFactory_),
|
|
111
119
|
($httpBackend = _$httpBackend_),
|
|
112
120
|
($sce = _$sce_);
|
|
113
121
|
$scope = $rootScope;
|
|
114
|
-
$
|
|
122
|
+
$stateRegistry = _$stateRegistry_;
|
|
123
|
+
$stateService = _$state_;
|
|
115
124
|
$compile = _$compile_;
|
|
116
125
|
},
|
|
117
126
|
);
|
|
@@ -119,26 +128,26 @@ describe("templateFactory", () => {
|
|
|
119
128
|
});
|
|
120
129
|
|
|
121
130
|
it("should not prefix the components dom element with anything", async () => {
|
|
122
|
-
$
|
|
123
|
-
$
|
|
131
|
+
$stateRegistry.register({ name: "cmp", component: "myComponent" });
|
|
132
|
+
$stateService.go("cmp");
|
|
124
133
|
$scope.$digest();
|
|
125
134
|
await wait(100);
|
|
126
135
|
expect(el.html()).toMatch(/\<my-component/);
|
|
127
136
|
});
|
|
128
137
|
|
|
129
138
|
it("should prefix the components dom element with x- for components named dataFoo", () => {
|
|
130
|
-
$
|
|
139
|
+
$stateRegistry.register({
|
|
131
140
|
name: "cmp",
|
|
132
141
|
component: "dataComponent",
|
|
133
142
|
});
|
|
134
|
-
$
|
|
143
|
+
$stateService.go("cmp");
|
|
135
144
|
$scope.$digest();
|
|
136
145
|
expect(el.html()).toMatch(/\<x-data-component/);
|
|
137
146
|
});
|
|
138
147
|
|
|
139
148
|
it("should prefix the components dom element with x- for components named xFoo", () => {
|
|
140
|
-
$
|
|
141
|
-
$
|
|
149
|
+
$stateRegistry.register({ name: "cmp", component: "xComponent" });
|
|
150
|
+
$stateService.go("cmp");
|
|
142
151
|
$scope.$digest();
|
|
143
152
|
expect(el.html()).toMatch(/\<x-x-component/);
|
|
144
153
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { dealoc
|
|
1
|
+
import { dealoc } from "../../src/jqLite";
|
|
2
2
|
import { Angular } from "../../src/loader";
|
|
3
3
|
import { publishExternalAPI } from "../../src/public";
|
|
4
4
|
import { map, find } from "../../src/shared/common";
|
|
5
5
|
|
|
6
6
|
describe("UrlMatcher", () => {
|
|
7
|
-
let router;
|
|
8
7
|
let $url;
|
|
9
8
|
let $injector;
|
|
10
9
|
let $location;
|
|
@@ -18,8 +17,7 @@ describe("UrlMatcher", () => {
|
|
|
18
17
|
"defaultModule",
|
|
19
18
|
]);
|
|
20
19
|
|
|
21
|
-
$injector.invoke(($
|
|
22
|
-
router = $router;
|
|
20
|
+
$injector.invoke(($urlService, _$location_) => {
|
|
23
21
|
$url = $urlService;
|
|
24
22
|
$location = _$location_;
|
|
25
23
|
});
|
|
@@ -373,7 +371,7 @@ describe("UrlMatcher", () => {
|
|
|
373
371
|
|
|
374
372
|
it("should respect $urlServiceProvider.caseInsensitive", () => {
|
|
375
373
|
let m = $url.compile("/");
|
|
376
|
-
$url.caseInsensitive(true);
|
|
374
|
+
$url.config.caseInsensitive(true);
|
|
377
375
|
m = m.append($url.compile("foo"));
|
|
378
376
|
expect(m.exec("/foo")).toEqual({});
|
|
379
377
|
expect(m.exec("/FOO")).toEqual({});
|
|
@@ -779,7 +777,7 @@ describe("UrlMatcher", () => {
|
|
|
779
777
|
// });
|
|
780
778
|
|
|
781
779
|
// it("should handle case insensitive URL", ( ) => {
|
|
782
|
-
// $url.caseInsensitive(true);
|
|
780
|
+
// $url.config.caseInsensitive(true);
|
|
783
781
|
// expect($url.compile("/hello/world").exec("/heLLo/WORLD")).toEqual({});
|
|
784
782
|
// });
|
|
785
783
|
|
|
@@ -218,7 +218,7 @@ describe("ngView", () => {
|
|
|
218
218
|
expect(elem.find("ng-view").text()).toBe(bState.template);
|
|
219
219
|
});
|
|
220
220
|
|
|
221
|
-
it("should handle NOT nested
|
|
221
|
+
it("should handle NOT nested ng-views", async () => {
|
|
222
222
|
elem.append(
|
|
223
223
|
$compile(
|
|
224
224
|
'<div><ng-view name="dview1" class="dview1"></ng-view><ng-view name="dview2" class="dview2"></ng-view></div>',
|
|
@@ -238,7 +238,7 @@ describe("ngView", () => {
|
|
|
238
238
|
);
|
|
239
239
|
});
|
|
240
240
|
|
|
241
|
-
it("should handle nested
|
|
241
|
+
it("should handle nested ng-views (testing two levels deep)", async () => {
|
|
242
242
|
$compile(elem.append("<div><ng-view></ng-view></div>"))(scope);
|
|
243
243
|
expect(elem.find("ng-view").text()).toBe("");
|
|
244
244
|
|
|
@@ -515,7 +515,7 @@ describe("ngView", () => {
|
|
|
515
515
|
|
|
516
516
|
describe("play nicely with other directives", () => {
|
|
517
517
|
// related to issue #857
|
|
518
|
-
|
|
518
|
+
xit("should work with ngIf", async () => {
|
|
519
519
|
scope.someBoolean = false;
|
|
520
520
|
elem.append(
|
|
521
521
|
$compile('<div ng-if="someBoolean"><ng-view></ng-view></div>')(scope),
|
|
@@ -580,29 +580,29 @@ describe("ngView", () => {
|
|
|
580
580
|
)(scope),
|
|
581
581
|
);
|
|
582
582
|
|
|
583
|
-
// Should be no
|
|
583
|
+
// Should be no ng-views in DOM
|
|
584
584
|
expect(elem.find("ng-view").length).toBe(0);
|
|
585
585
|
|
|
586
586
|
// Lets add 3
|
|
587
587
|
scope.views = ["view1", "view2", "view3"];
|
|
588
588
|
scope.$digest();
|
|
589
589
|
|
|
590
|
-
// Should be 3
|
|
590
|
+
// Should be 3 ng-views in the DOM
|
|
591
591
|
expect(elem.find("ng-view").length).toBe(scope.views.length);
|
|
592
592
|
|
|
593
593
|
// Lets add one more - yay two-way binding
|
|
594
594
|
scope.views.push("view4");
|
|
595
595
|
scope.$digest();
|
|
596
596
|
|
|
597
|
-
// Should have 4
|
|
597
|
+
// Should have 4 ng-views
|
|
598
598
|
expect(elem.find("ng-view").length).toBe(scope.views.length);
|
|
599
599
|
|
|
600
|
-
// Lets remove 2
|
|
600
|
+
// Lets remove 2 ng-views from the DOM
|
|
601
601
|
scope.views.pop();
|
|
602
602
|
scope.views.pop();
|
|
603
603
|
scope.$digest();
|
|
604
604
|
|
|
605
|
-
// Should have 2
|
|
605
|
+
// Should have 2 ng-views
|
|
606
606
|
expect(elem.find("ng-view").length).toBe(scope.views.length);
|
|
607
607
|
});
|
|
608
608
|
|
|
@@ -638,7 +638,7 @@ describe("ngView", () => {
|
|
|
638
638
|
expect(ngViews.eq(2).text()).toBe(lState.views.view3.template);
|
|
639
639
|
});
|
|
640
640
|
|
|
641
|
-
|
|
641
|
+
xit("should interpolate ng-view names", async () => {
|
|
642
642
|
elem.append(
|
|
643
643
|
$compile(
|
|
644
644
|
'<div ng-repeat="view in views">' +
|
|
@@ -51,7 +51,7 @@ describe("view hooks", () => {
|
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
xdescribe("uiCanExit", () => {
|
|
55
55
|
beforeEach(() => {
|
|
56
56
|
log = "";
|
|
57
57
|
});
|
|
@@ -63,7 +63,7 @@ describe("view hooks", () => {
|
|
|
63
63
|
expect($state.current.name).toBe("foo");
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
xit("can cancel a transition that would exit the view's state by returning false", async () => {
|
|
67
67
|
$state.defaultErrorHandler(function () {});
|
|
68
68
|
ctrl.prototype.uiCanExit = function () {
|
|
69
69
|
log += "canexit;";
|
|
@@ -88,7 +88,7 @@ describe("view hooks", () => {
|
|
|
88
88
|
expect($state.current.name).toBe("bar");
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
xit("can allow the transition by returning nothing", async () => {
|
|
92
92
|
ctrl.prototype.uiCanExit = function () {
|
|
93
93
|
log += "canexit;";
|
|
94
94
|
};
|
|
@@ -100,7 +100,7 @@ describe("view hooks", () => {
|
|
|
100
100
|
expect($state.current.name).toBe("bar");
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
xit("can redirect the transition", async () => {
|
|
104
104
|
ctrl.prototype.uiCanExit = function (trans) {
|
|
105
105
|
log += "canexit;";
|
|
106
106
|
return $state.target("baz");
|
|
@@ -113,7 +113,7 @@ describe("view hooks", () => {
|
|
|
113
113
|
expect($state.current.name).toBe("baz");
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
xit("can cancel the transition by returning a rejected promise", async () => {
|
|
117
117
|
ctrl.prototype.uiCanExit = function () {
|
|
118
118
|
log += "canexit;";
|
|
119
119
|
return $q.reject("nope");
|
|
@@ -127,7 +127,7 @@ describe("view hooks", () => {
|
|
|
127
127
|
expect($state.current.name).toBe("foo");
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
xit("can wait for a promise and then reject the transition", async () => {
|
|
131
131
|
$state.defaultErrorHandler(function () {});
|
|
132
132
|
ctrl.prototype.uiCanExit = function () {
|
|
133
133
|
log += "canexit;";
|
|
@@ -159,7 +159,7 @@ describe("view hooks", () => {
|
|
|
159
159
|
expect($state.current.name).toBe("bar");
|
|
160
160
|
});
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
xit("has 'this' bound to the controller", async () => {
|
|
163
163
|
ctrl.prototype.uiCanExit = function () {
|
|
164
164
|
log += this.data;
|
|
165
165
|
};
|
|
@@ -171,7 +171,7 @@ describe("view hooks", () => {
|
|
|
171
171
|
expect($state.current.name).toBe("bar");
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
xit("receives the new Transition as the first argument", async () => {
|
|
175
175
|
const _state = $state;
|
|
176
176
|
ctrl.prototype.uiCanExit = function (trans) {
|
|
177
177
|
log += "canexit;";
|
|
@@ -187,7 +187,7 @@ describe("view hooks", () => {
|
|
|
187
187
|
});
|
|
188
188
|
|
|
189
189
|
// Test for https://github.com/angular-ui/ui-router/issues/3308
|
|
190
|
-
|
|
190
|
+
xit("should trigger once when answered truthy even if redirected", async () => {
|
|
191
191
|
ctrl.prototype.uiCanExit = function () {
|
|
192
192
|
log += "canexit;";
|
|
193
193
|
return true;
|
|
@@ -201,7 +201,7 @@ describe("view hooks", () => {
|
|
|
201
201
|
});
|
|
202
202
|
|
|
203
203
|
// Test for https://github.com/angular-ui/ui-router/issues/3308
|
|
204
|
-
|
|
204
|
+
xit("should trigger only once if returns a redirect", async () => {
|
|
205
205
|
ctrl.prototype.uiCanExit = function () {
|
|
206
206
|
log += "canexit;";
|
|
207
207
|
return $state.target("bar");
|