@angular-wave/angular.ts 0.4.2 → 0.4.4
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 +2 -2
- package/dist/angular-ts.umd.js +12 -2
- package/index.html +74 -3
- package/package.json +7 -7
- package/src/angular.spec.js +1 -269
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +12 -21
- package/src/animations/animate-js-driver.js +1 -3
- package/src/animations/animate-js.js +4 -4
- package/src/animations/animate-queue.js +23 -23
- package/src/animations/animate-runner.js +4 -8
- package/src/animations/animate.md +1 -1
- package/src/animations/animate.spec.js +0 -21
- package/src/animations/animation.js +4 -4
- package/src/animations/shared.js +14 -12
- package/src/binding.spec.js +0 -1
- package/src/core/cache/cache.js +2 -29
- package/src/core/compile/attributes.js +2 -3
- package/src/core/compile/compile.js +260 -245
- package/src/core/compile/compile.spec.js +63 -317
- package/src/core/compile/compile.test.js +1 -1
- package/src/core/controller/controller.js +2 -0
- package/src/core/di/injector.md +1 -1
- package/src/core/di/injector.spec.js +0 -2
- package/src/core/di/internal-injector.js +2 -1
- package/src/core/interpolate/interpolate.js +16 -3
- package/src/core/interpolate/interpolate.spec.js +70 -16
- package/src/core/location/location.js +0 -2
- package/src/core/location/location.spec.js +27 -27
- package/src/core/{scope/scope.html → model/model.html} +1 -1
- package/src/core/model/model.js +944 -0
- package/src/core/model/model.spec.js +3012 -0
- package/src/core/on.spec.js +0 -7
- package/src/core/parse/interpreter.js +10 -7
- package/src/core/parse/parse.js +28 -7
- package/src/core/parse/parse.spec.js +95 -91
- package/src/core/prop.spec.js +4 -60
- package/src/core/sce/sce.js +1 -2
- package/src/core/sce/sce.spec.js +0 -8
- package/src/core/scope/scope.js +62 -32
- package/src/core/scope/scope.spec.js +25 -1960
- package/src/directive/aria/aria.js +3 -6
- package/src/directive/aria/aria.spec.js +0 -87
- package/src/directive/attrs/attrs.spec.js +0 -5
- package/src/directive/{list/list.test.js → attrs/attrs.test.js} +1 -1
- package/src/{core/q/q.html → directive/attrs/boolean.html} +1 -1
- package/src/directive/attrs/boolean.spec.js +0 -15
- package/src/{core/q/q.test.js → directive/attrs/boolean.test.js} +1 -2
- package/src/{core/timeout/timeout.html → directive/attrs/element-style.html} +4 -1
- package/src/directive/attrs/element-style.spec.js +0 -8
- package/src/{core/scope/scope.test.js → directive/attrs/element-style.test.js} +1 -2
- package/src/directive/attrs/src.spec.js +0 -7
- package/src/directive/bind/bind.spec.js +0 -33
- package/src/directive/bind/bing-html.spec.js +1 -4
- package/src/{core/interval/interval.html → directive/channel/channel.html} +1 -1
- package/src/directive/channel/channel.js +29 -0
- package/src/directive/channel/channel.spec.js +52 -0
- package/src/directive/channel/channel.test.js +9 -0
- package/src/directive/class/class.js +3 -3
- package/src/directive/class/class.spec.js +9 -75
- package/src/directive/controller/controller.spec.js +0 -13
- package/src/directive/events/click.spec.js +0 -3
- package/src/directive/events/event.spec.js +0 -6
- package/src/directive/form/form.js +14 -22
- package/src/directive/form/form.spec.js +0 -65
- package/src/directive/if/if.spec.js +2 -7
- package/src/directive/if/if.test.js +1 -2
- package/src/directive/include/include.js +2 -2
- package/src/directive/include/include.spec.js +8 -59
- package/src/directive/init/init.js +6 -2
- package/src/directive/init/init.spec.js +0 -2
- package/src/directive/input/input.js +1 -2
- package/src/directive/input/input.spec.js +191 -331
- package/src/directive/messages/messages.spec.js +4 -35
- package/src/directive/model/model.js +30 -42
- package/src/directive/model/model.spec.js +2 -49
- package/src/directive/model-options/model-options.js +22 -26
- package/src/directive/model-options/model-options.spec.js +0 -6
- package/src/directive/non-bindable/non-bindable.spec.js +0 -1
- package/src/directive/observe/observe.js +0 -1
- package/src/directive/observe/observe.spec.js +0 -1
- package/src/directive/options/options.js +1 -3
- package/src/directive/options/options.spec.js +3 -38
- package/src/directive/ref/href.spec.js +0 -15
- package/src/directive/repeat/repeat.js +2 -2
- package/src/directive/repeat/repeat.spec.js +56 -192
- package/src/directive/script/script.spec.js +0 -2
- package/src/directive/select/select.js +3 -3
- package/src/directive/select/select.spec.js +9 -106
- package/src/directive/show-hide/show-hide.js +2 -2
- package/src/directive/show-hide/show-hide.spec.js +8 -19
- package/src/directive/style/style.spec.js +0 -7
- package/src/directive/switch/switch.js +1 -2
- package/src/directive/switch/switch.spec.js +5 -5
- package/src/directive/validators/validators.spec.js +0 -1
- package/src/loader.js +0 -1
- package/src/public.js +75 -80
- package/src/router/common/coreservices.js +0 -2
- package/src/router/directives/state-directives.js +24 -30
- package/src/router/directives/state-directives.spec.js +0 -83
- package/src/router/directives/view-directive.js +6 -15
- package/src/router/directives/view-directive.spec.js +25 -71
- package/src/router/hooks/lazy-load.js +2 -2
- package/src/router/hooks/views.js +3 -5
- package/src/router/resolve/resolvable.js +3 -6
- package/src/router/resolve/resolve-context.js +2 -2
- package/src/router/state/state-service.js +4 -4
- package/src/router/state/state.spec.js +2 -5
- package/src/router/state/views.js +9 -12
- package/src/router/template-factory.js +3 -6
- package/src/router/template-factory.spec.js +0 -4
- package/src/router/transition/transition-hook.js +1 -1
- package/src/router/transition/transition.js +1 -1
- package/src/router/url/url-service.js +2 -8
- package/src/router/url/url-service.spec.js +3 -4
- package/src/router/view-hook.spec.js +2 -2
- package/src/router/view-scroll.js +4 -6
- package/src/services/http/http.js +11 -15
- package/src/services/http/http.spec.js +30 -31
- package/src/services/http/template-request.spec.js +0 -10
- package/src/services/http-backend/http-backend.js +19 -17
- package/src/services/http-backend/http-backend.spec.js +3 -3
- package/src/services/template-request.js +2 -4
- package/src/shared/common.js +6 -10
- package/src/shared/jqlite/jqlite.js +14 -15
- package/src/shared/jqlite/jqlite.spec.js +2 -2
- package/src/shared/utils.js +15 -92
- package/types/core/cache/cache.d.ts +1 -1
- package/types/core/model/model.d.ts +204 -0
- package/types/core/parse/parse.d.ts +26 -0
- package/types/core/scope/scope.d.ts +22 -21
- package/types/directive/channel/channel.d.ts +11 -0
- package/types/directive/form/form.d.ts +1 -0
- package/types/shared/common.d.ts +0 -1
- package/types/shared/utils.d.ts +0 -35
- package/src/core/interval/interval-factory.js +0 -50
- package/src/core/interval/interval.js +0 -77
- package/src/core/interval/interval.md +0 -123
- package/src/core/interval/interval.spec.js +0 -280
- package/src/core/q/q.js +0 -472
- package/src/core/q/q.md +0 -211
- package/src/core/q/q.spec.js +0 -2748
- package/src/core/timeout/timeout.js +0 -109
- package/src/core/timeout/timeout.spec.js +0 -354
- package/src/core/timeout/timout.test.js +0 -12
- package/src/directive/list/list.html +0 -18
- package/src/directive/list/list.js +0 -46
- package/src/directive/list/list.md +0 -22
- package/src/directive/list/list.spec.js +0 -172
- package/types/directive/list/list.d.ts +0 -4
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { dealoc } from "../../shared/jqlite/jqlite";
|
|
2
|
-
import { Angular } from "../../loader";
|
|
3
|
-
|
|
4
|
-
describe("ngList", () => {
|
|
5
|
-
let $rootScope;
|
|
6
|
-
let element;
|
|
7
|
-
let $compile;
|
|
8
|
-
let injector;
|
|
9
|
-
let inputElm;
|
|
10
|
-
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
window.angular = new Angular();
|
|
13
|
-
window.angular.module("test", []);
|
|
14
|
-
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
15
|
-
"test",
|
|
16
|
-
]);
|
|
17
|
-
$compile = injector.get("$compile");
|
|
18
|
-
$rootScope = injector.get("$rootScope");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
afterEach(() => {
|
|
22
|
-
dealoc(element);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
function changeInputValue(val) {
|
|
26
|
-
inputElm[0].value = val;
|
|
27
|
-
inputElm[0].dispatchEvent(new Event("change"));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
it("should parse text into an array", () => {
|
|
31
|
-
inputElm = $compile('<input type="text" ng-model="list" ng-list />')(
|
|
32
|
-
$rootScope,
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
// model -> view
|
|
36
|
-
$rootScope.$apply("list = ['x', 'y', 'z']");
|
|
37
|
-
expect(inputElm.val()).toBe("x, y, z");
|
|
38
|
-
|
|
39
|
-
// view -> model
|
|
40
|
-
changeInputValue("1, 2, 3");
|
|
41
|
-
expect($rootScope.list).toEqual(["1", "2", "3"]);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("should not clobber text if model changes due to itself", () => {
|
|
45
|
-
// When the user types 'a,b' the 'a,' stage parses to ['a'] but if the
|
|
46
|
-
// $parseModel function runs it will change to 'a', in essence preventing
|
|
47
|
-
// the user from ever typing ','.
|
|
48
|
-
inputElm = $compile('<input type="text" ng-model="list" ng-list />')(
|
|
49
|
-
$rootScope,
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
changeInputValue("a ");
|
|
53
|
-
expect(inputElm.val()).toEqual("a ");
|
|
54
|
-
expect($rootScope.list).toEqual(["a"]);
|
|
55
|
-
|
|
56
|
-
changeInputValue("a ,");
|
|
57
|
-
expect(inputElm.val()).toEqual("a ,");
|
|
58
|
-
expect($rootScope.list).toEqual(["a"]);
|
|
59
|
-
|
|
60
|
-
changeInputValue("a , ");
|
|
61
|
-
expect(inputElm.val()).toEqual("a , ");
|
|
62
|
-
expect($rootScope.list).toEqual(["a"]);
|
|
63
|
-
|
|
64
|
-
changeInputValue("a , b");
|
|
65
|
-
expect(inputElm.val()).toEqual("a , b");
|
|
66
|
-
expect($rootScope.list).toEqual(["a", "b"]);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("should convert empty string to an empty array", () => {
|
|
70
|
-
inputElm = $compile('<input type="text" ng-model="list" ng-list />')(
|
|
71
|
-
$rootScope,
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
changeInputValue("");
|
|
75
|
-
expect($rootScope.list).toEqual([]);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("should be invalid if required and empty", () => {
|
|
79
|
-
inputElm = $compile('<input type="text" ng-list ng-model="list" required>')(
|
|
80
|
-
$rootScope,
|
|
81
|
-
);
|
|
82
|
-
changeInputValue("");
|
|
83
|
-
expect($rootScope.list).toBeUndefined();
|
|
84
|
-
expect(inputElm[0].classList.contains("ng-invalid")).toBeTrue();
|
|
85
|
-
changeInputValue("a,b");
|
|
86
|
-
expect($rootScope.list).toEqual(["a", "b"]);
|
|
87
|
-
expect(inputElm[0].classList.contains("ng-valid")).toBeTrue();
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
describe("with a custom separator", () => {
|
|
91
|
-
it("should split on the custom separator", () => {
|
|
92
|
-
inputElm = $compile('<input type="text" ng-model="list" ng-list=":" />')(
|
|
93
|
-
$rootScope,
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
changeInputValue("a,a");
|
|
97
|
-
expect($rootScope.list).toEqual(["a,a"]);
|
|
98
|
-
|
|
99
|
-
changeInputValue("a:b");
|
|
100
|
-
expect($rootScope.list).toEqual(["a", "b"]);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("should join the list back together with the custom separator", () => {
|
|
104
|
-
inputElm = $compile(
|
|
105
|
-
'<input type="text" ng-model="list" ng-list=" : " />',
|
|
106
|
-
)($rootScope);
|
|
107
|
-
|
|
108
|
-
$rootScope.$apply(() => {
|
|
109
|
-
$rootScope.list = ["x", "y", "z"];
|
|
110
|
-
});
|
|
111
|
-
expect(inputElm.val()).toBe("x : y : z");
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
describe("(with ngTrim undefined or true)", () => {
|
|
116
|
-
it("should ignore separator whitespace when splitting", () => {
|
|
117
|
-
inputElm = $compile(
|
|
118
|
-
'<input type="text" ng-model="list" ng-list=" | " />',
|
|
119
|
-
)($rootScope);
|
|
120
|
-
|
|
121
|
-
changeInputValue("a|b");
|
|
122
|
-
expect($rootScope.list).toEqual(["a", "b"]);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it("should trim whitespace from each list item", () => {
|
|
126
|
-
inputElm = $compile('<input type="text" ng-model="list" ng-list="|" />')(
|
|
127
|
-
$rootScope,
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
changeInputValue("a | b");
|
|
131
|
-
expect($rootScope.list).toEqual(["a", "b"]);
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
describe("(with ngTrim set to false)", () => {
|
|
136
|
-
it("should use separator whitespace when splitting", () => {
|
|
137
|
-
inputElm = $compile(
|
|
138
|
-
'<input type="text" ng-model="list" ng-trim="false" ng-list=" | " />',
|
|
139
|
-
)($rootScope);
|
|
140
|
-
|
|
141
|
-
changeInputValue("a|b");
|
|
142
|
-
expect($rootScope.list).toEqual(["a|b"]);
|
|
143
|
-
|
|
144
|
-
changeInputValue("a | b");
|
|
145
|
-
expect($rootScope.list).toEqual(["a", "b"]);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it("should not trim whitespace from each list item", () => {
|
|
149
|
-
inputElm = $compile(
|
|
150
|
-
'<input type="text" ng-model="list" ng-trim="false" ng-list="|" />',
|
|
151
|
-
)($rootScope);
|
|
152
|
-
changeInputValue("a | b");
|
|
153
|
-
expect($rootScope.list).toEqual(["a ", " b"]);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it("should support splitting on newlines", () => {
|
|
157
|
-
inputElm = $compile(
|
|
158
|
-
'<textarea type="text" ng-model="list" ng-trim="false" ng-list=" "></textarea>',
|
|
159
|
-
)($rootScope);
|
|
160
|
-
changeInputValue("a\nb");
|
|
161
|
-
expect($rootScope.list).toEqual(["a", "b"]);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it("should support splitting on whitespace", () => {
|
|
165
|
-
inputElm = $compile(
|
|
166
|
-
'<textarea type="text" ng-model="list" ng-trim="false" ng-list=" "></textarea>',
|
|
167
|
-
)($rootScope);
|
|
168
|
-
changeInputValue("a b");
|
|
169
|
-
expect($rootScope.list).toEqual(["a", "b"]);
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
});
|