@angular-wave/angular.ts 0.0.21 → 0.0.23
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/Makefile +1 -1
- package/TODO.md +14 -0
- package/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/index.html +8 -2
- package/package.json +1 -1
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +15 -6
- package/src/animations/animate-js.js +1 -1
- package/src/animations/animate-queue.js +1 -1
- package/src/animations/shared.js +0 -14
- package/src/core/compile.js +6 -3
- package/src/directive/if.js +0 -79
- package/src/directive/if.md +80 -0
- package/src/directive/include.js +0 -82
- package/src/directive/include.md +86 -0
- package/src/directive/repeat.js +0 -1
- package/src/filters/order-by.js +8 -8
- package/src/loader.js +0 -1
- package/src/router/common/trace.js +1 -1
- package/src/router/directives/stateDirectives.js +16 -14
- package/src/router/directives/viewDirective.js +5 -13
- package/src/router/hooks/resolve.js +3 -4
- package/src/router/hooks/views.js +3 -2
- package/src/router/state/stateService.js +1 -2
- package/src/router/stateProvider.js +8 -0
- package/src/router/templateFactory.js +13 -7
- package/src/router/transition/interface.js +14 -14
- package/src/router/transition/rejectFactory.js +29 -20
- package/src/router/transition/transition.js +5 -1
- package/src/router/transition/transitionHook.js +5 -5
- package/src/router/url/urlMatcher.js +1 -2
- package/src/router/url/urlRule.js +10 -2
- package/src/router/url/urlRules.js +1 -1
- package/src/services/browser.js +3 -18
- package/src/shared/common.js +0 -1
- package/test/module-test.html +44 -12
- package/test/router/ng-state-builder.spec.js +81 -0
- package/test/router/services.spec.js +70 -0
- package/test/router/state-directives.spec.js +1182 -0
- package/test/router/template-factory.spec.js +146 -0
- package/test/router/url-matcher-factory.spec.js +1313 -0
- package/test/router/view-directive.spec.js +2013 -0
- package/test/router/view-hook.spec.js +217 -0
- package/test/router/view-scroll.spec.js +77 -0
- package/test/router/view.spec.js +117 -0
- package/types/angular.d.ts +132 -124
- package/types/index.d.ts +2350 -2187
- package/types/jqlite.d.ts +463 -418
- package/types/router/core/common/common.d.ts +70 -24
- package/types/router/core/common/coreservices.d.ts +30 -32
- package/types/router/core/common/glob.d.ts +9 -9
- package/types/router/core/common/hof.d.ts +12 -4
- package/types/router/core/common/index.d.ts +8 -8
- package/types/router/core/common/predicates.d.ts +1 -1
- package/types/router/core/common/queue.d.ts +13 -13
- package/types/router/core/common/safeConsole.d.ts +3 -3
- package/types/router/core/common/strings.d.ts +4 -2
- package/types/router/core/common/trace.d.ts +94 -82
- package/types/router/core/globals.d.ts +37 -37
- package/types/router/core/hooks/coreResolvables.d.ts +5 -3
- package/types/router/core/hooks/ignoredTransition.d.ts +4 -2
- package/types/router/core/hooks/invalidTransition.d.ts +4 -2
- package/types/router/core/hooks/lazyLoad.d.ts +10 -5
- package/types/router/core/hooks/onEnterExitRetain.d.ts +10 -4
- package/types/router/core/hooks/redirectTo.d.ts +4 -2
- package/types/router/core/hooks/resolve.d.ts +10 -4
- package/types/router/core/hooks/updateGlobals.d.ts +4 -2
- package/types/router/core/hooks/url.d.ts +4 -2
- package/types/router/core/hooks/views.d.ts +7 -3
- package/types/router/core/index.d.ts +11 -12
- package/types/router/core/interface.d.ts +83 -81
- package/types/router/core/params/index.d.ts +5 -5
- package/types/router/core/params/interface.d.ts +439 -439
- package/types/router/core/params/param.d.ts +72 -60
- package/types/router/core/params/paramType.d.ts +40 -40
- package/types/router/core/params/paramTypes.d.ts +169 -165
- package/types/router/core/params/stateParams.d.ts +13 -13
- package/types/router/core/path/index.d.ts +2 -2
- package/types/router/core/path/pathNode.d.ts +49 -49
- package/types/router/core/path/pathUtils.d.ts +100 -74
- package/types/router/core/resolve/index.d.ts +3 -3
- package/types/router/core/resolve/interface.d.ts +137 -137
- package/types/router/core/resolve/resolvable.d.ts +60 -54
- package/types/router/core/resolve/resolveContext.d.ts +84 -79
- package/types/router/core/router.d.ts +95 -86
- package/types/router/core/state/index.d.ts +8 -8
- package/types/router/core/state/interface.d.ts +667 -643
- package/types/router/core/state/stateBuilder.d.ts +41 -38
- package/types/router/core/state/stateMatcher.d.ts +11 -9
- package/types/router/core/state/stateObject.d.ts +154 -139
- package/types/router/core/state/stateQueueManager.d.ts +26 -21
- package/types/router/core/state/stateRegistry.d.ts +124 -121
- package/types/router/core/state/stateService.d.ts +380 -343
- package/types/router/core/state/targetState.d.ts +74 -69
- package/types/router/core/transition/hookBuilder.d.ts +34 -30
- package/types/router/core/transition/hookRegistry.d.ts +96 -74
- package/types/router/core/transition/index.d.ts +8 -8
- package/types/router/core/transition/interface.d.ts +652 -609
- package/types/router/core/transition/rejectFactory.d.ts +97 -97
- package/types/router/core/transition/transition.d.ts +565 -517
- package/types/router/core/transition/transitionEventType.d.ts +20 -11
- package/types/router/core/transition/transitionHook.d.ts +90 -82
- package/types/router/core/transition/transitionService.d.ts +228 -161
- package/types/router/core/url/index.d.ts +8 -8
- package/types/router/core/url/interface.d.ts +100 -87
- package/types/router/core/url/urlConfig.d.ts +130 -126
- package/types/router/core/url/urlMatcher.d.ts +132 -127
- package/types/router/core/url/urlMatcherFactory.d.ts +46 -42
- package/types/router/core/url/urlRouter.d.ts +91 -75
- package/types/router/core/url/urlRule.d.ts +123 -100
- package/types/router/core/url/urlRules.d.ts +240 -232
- package/types/router/core/url/urlService.d.ts +201 -201
- package/types/router/core/view/index.d.ts +2 -2
- package/types/router/core/view/interface.d.ts +26 -26
- package/types/router/core/view/view.d.ts +152 -143
- package/types/router/directives/viewDirective.d.ts +12 -11
- package/types/router/index.d.ts +11 -12
- package/types/router/interface.d.ts +361 -351
- package/types/router/legacy/resolveService.d.ts +44 -40
- package/types/router/legacy/stateEvents.d.ts +1 -1
- package/types/router/locationServices.d.ts +45 -37
- package/types/router/services.d.ts +9 -9
- package/types/router/stateFilters.d.ts +3 -3
- package/types/router/stateProvider.d.ts +240 -235
- package/types/router/statebuilders/onEnterExitRetain.d.ts +4 -2
- package/types/router/statebuilders/views.d.ts +35 -22
- package/types/router/templateFactory.d.ts +99 -79
- package/types/router/viewScroll.d.ts +7 -7
- package/src/directive/a.js +0 -37
- package/types/router/angular.d.ts +0 -1
- package/types/router/core/vanilla.d.ts +0 -1
- package/types/router/directives/stateDirectives.d.ts +0 -3
- package/types/router/injectables.d.ts +0 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { dealoc, jqLite } from "../../src/jqLite";
|
|
2
|
+
import { Angular } from "../../src/loader";
|
|
3
|
+
import { publishExternalAPI } from "../../src/public";
|
|
4
|
+
import { wait } from "../test-utils";
|
|
5
|
+
|
|
6
|
+
describe("templateFactory", () => {
|
|
7
|
+
let $injector, $templateFactory, $httpBackend, $sce, $scope, $compile;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
dealoc(document.getElementById("dummy"));
|
|
11
|
+
window.angular = new Angular();
|
|
12
|
+
publishExternalAPI();
|
|
13
|
+
window.angular.module("defaultModule", ["ui.router"]);
|
|
14
|
+
$injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
15
|
+
"defaultModule",
|
|
16
|
+
]);
|
|
17
|
+
$injector.invoke(
|
|
18
|
+
(_$templateFactory_, _$httpBackend_, _$sce_, $rootScope) => {
|
|
19
|
+
($templateFactory = _$templateFactory_),
|
|
20
|
+
($httpBackend = _$httpBackend_),
|
|
21
|
+
($sce = _$sce_);
|
|
22
|
+
$scope = $rootScope;
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("exists", () => {
|
|
28
|
+
expect($injector.get("$templateFactory")).toBeDefined();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe("should follow $sce policy and", () => {
|
|
32
|
+
it("accepts relative URLs", async () => {
|
|
33
|
+
let res = $templateFactory.fromUrl("mock/hello");
|
|
34
|
+
$scope.$digest();
|
|
35
|
+
await wait(10);
|
|
36
|
+
expect(res.$$state.status).toBe(1);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("rejects untrusted URLs", () => {
|
|
40
|
+
let error = "No error thrown";
|
|
41
|
+
try {
|
|
42
|
+
$templateFactory.fromUrl("http://evil.com/views/view.html");
|
|
43
|
+
} catch (e) {
|
|
44
|
+
error = e.message;
|
|
45
|
+
}
|
|
46
|
+
expect(error).toMatch(/sce:insecurl/);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("accepts explicitly trusted URLs", () => {
|
|
50
|
+
expect(() => {
|
|
51
|
+
$templateFactory.fromUrl(
|
|
52
|
+
$sce.trustAsResourceUrl("http://evil.com/views/view.html"),
|
|
53
|
+
);
|
|
54
|
+
}).not.toThrowError();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe("templateFactory with forced use of $http service", () => {
|
|
59
|
+
beforeEach(() => {
|
|
60
|
+
dealoc(document.getElementById("dummy"));
|
|
61
|
+
let module = window.angular.module("defaultModule", ["ui.router"]);
|
|
62
|
+
module.config(function ($templateFactoryProvider) {
|
|
63
|
+
$templateFactoryProvider.useHttpService(true);
|
|
64
|
+
});
|
|
65
|
+
$injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
66
|
+
"defaultModule",
|
|
67
|
+
]);
|
|
68
|
+
$injector.invoke(
|
|
69
|
+
(_$templateFactory_, _$httpBackend_, _$sce_, $rootScope) => {
|
|
70
|
+
($templateFactory = _$templateFactory_),
|
|
71
|
+
($httpBackend = _$httpBackend_),
|
|
72
|
+
($sce = _$sce_);
|
|
73
|
+
$scope = $rootScope;
|
|
74
|
+
},
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("does not restrict URL loading", function () {
|
|
79
|
+
expect(() => {
|
|
80
|
+
$templateFactory.fromUrl("http://evil.com/views/view.html");
|
|
81
|
+
}).not.toThrowError();
|
|
82
|
+
|
|
83
|
+
expect(() => {
|
|
84
|
+
$templateFactory.fromUrl("data:text/html,foo");
|
|
85
|
+
}).not.toThrowError();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe("component template builder", () => {
|
|
90
|
+
let $router, el;
|
|
91
|
+
|
|
92
|
+
beforeEach(() => {
|
|
93
|
+
dealoc(document.getElementById("dummy"));
|
|
94
|
+
const mod = angular.module("defaultModule", ["ui.router"]);
|
|
95
|
+
mod.component("myComponent", { template: "hi" });
|
|
96
|
+
mod.component("dataComponent", { template: "hi" });
|
|
97
|
+
mod.component("xComponent", { template: "hi" });
|
|
98
|
+
$injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
99
|
+
"defaultModule",
|
|
100
|
+
]);
|
|
101
|
+
$injector.invoke(
|
|
102
|
+
(
|
|
103
|
+
_$templateFactory_,
|
|
104
|
+
_$httpBackend_,
|
|
105
|
+
_$sce_,
|
|
106
|
+
$rootScope,
|
|
107
|
+
_$router_,
|
|
108
|
+
_$compile_,
|
|
109
|
+
) => {
|
|
110
|
+
($templateFactory = _$templateFactory_),
|
|
111
|
+
($httpBackend = _$httpBackend_),
|
|
112
|
+
($sce = _$sce_);
|
|
113
|
+
$scope = $rootScope;
|
|
114
|
+
$router = _$router_;
|
|
115
|
+
$compile = _$compile_;
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
el = $compile(jqLite("<div><ui-view></ui-view></div>"))($scope.$new());
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("should not prefix the components dom element with anything", async () => {
|
|
122
|
+
$router.stateRegistry.register({ name: "cmp", component: "myComponent" });
|
|
123
|
+
$router.stateService.go("cmp");
|
|
124
|
+
$scope.$digest();
|
|
125
|
+
await wait(10);
|
|
126
|
+
expect(el.html()).toMatch(/\<my-component/);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("should prefix the components dom element with x- for components named dataFoo", () => {
|
|
130
|
+
$router.stateRegistry.register({
|
|
131
|
+
name: "cmp",
|
|
132
|
+
component: "dataComponent",
|
|
133
|
+
});
|
|
134
|
+
$router.stateService.go("cmp");
|
|
135
|
+
$scope.$digest();
|
|
136
|
+
expect(el.html()).toMatch(/\<x-data-component/);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it("should prefix the components dom element with x- for components named xFoo", () => {
|
|
140
|
+
$router.stateRegistry.register({ name: "cmp", component: "xComponent" });
|
|
141
|
+
$router.stateService.go("cmp");
|
|
142
|
+
$scope.$digest();
|
|
143
|
+
expect(el.html()).toMatch(/\<x-x-component/);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
});
|