@angular-wave/angular.ts 0.4.3 → 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.
Files changed (128) hide show
  1. package/dist/angular-ts.umd.js +10 -0
  2. package/index.html +74 -3
  3. package/package.json +1 -1
  4. package/src/angular.spec.js +0 -5
  5. package/src/animations/animate-css.js +5 -13
  6. package/src/animations/animate-queue.js +22 -21
  7. package/src/animations/animate-runner.js +4 -8
  8. package/src/animations/animate.md +1 -1
  9. package/src/animations/animate.spec.js +0 -21
  10. package/src/animations/animation.js +1 -1
  11. package/src/binding.spec.js +0 -1
  12. package/src/core/cache/cache.js +2 -29
  13. package/src/core/compile/compile.js +26 -27
  14. package/src/core/compile/compile.spec.js +17 -266
  15. package/src/core/compile/compile.test.js +1 -1
  16. package/src/core/controller/controller.js +2 -0
  17. package/src/core/di/injector.md +1 -1
  18. package/src/core/di/injector.spec.js +0 -2
  19. package/src/core/di/internal-injector.js +2 -1
  20. package/src/core/interpolate/interpolate.js +16 -3
  21. package/src/core/interpolate/interpolate.spec.js +70 -16
  22. package/src/core/interval/interval.test.js +1 -1
  23. package/src/core/location/location.js +0 -2
  24. package/src/core/location/location.spec.js +27 -27
  25. package/src/core/{scope/scope.html → model/model.html} +1 -1
  26. package/src/core/model/model.js +944 -0
  27. package/src/core/model/model.spec.js +3012 -0
  28. package/src/core/on.spec.js +0 -7
  29. package/src/core/parse/interpreter.js +10 -7
  30. package/src/core/parse/parse.js +26 -5
  31. package/src/core/parse/parse.spec.js +95 -91
  32. package/src/core/prop.spec.js +4 -60
  33. package/src/core/sce/sce.spec.js +0 -8
  34. package/src/core/scope/scope.js +61 -30
  35. package/src/core/scope/scope.spec.js +25 -1960
  36. package/src/directive/aria/aria.js +3 -6
  37. package/src/directive/aria/aria.spec.js +0 -87
  38. package/src/directive/attrs/attrs.spec.js +0 -5
  39. package/src/directive/attrs/boolean.spec.js +0 -15
  40. package/src/directive/attrs/element-style.spec.js +0 -8
  41. package/src/directive/attrs/src.spec.js +0 -7
  42. package/src/directive/bind/bind.spec.js +0 -33
  43. package/src/directive/bind/bing-html.spec.js +0 -3
  44. package/src/{core/q/q.html → directive/channel/channel.html} +1 -1
  45. package/src/directive/channel/channel.js +29 -0
  46. package/src/directive/channel/channel.spec.js +52 -0
  47. package/src/directive/{list/list.test.js → channel/channel.test.js} +2 -4
  48. package/src/directive/class/class.js +3 -3
  49. package/src/directive/class/class.spec.js +9 -75
  50. package/src/directive/controller/controller.spec.js +0 -13
  51. package/src/directive/events/click.spec.js +0 -3
  52. package/src/directive/events/event.spec.js +0 -6
  53. package/src/directive/form/form.js +2 -3
  54. package/src/directive/form/form.spec.js +0 -65
  55. package/src/directive/if/if.spec.js +0 -4
  56. package/src/directive/include/include.spec.js +8 -59
  57. package/src/directive/init/init.js +6 -2
  58. package/src/directive/init/init.spec.js +0 -2
  59. package/src/directive/input/input.spec.js +0 -136
  60. package/src/directive/messages/messages.spec.js +4 -35
  61. package/src/directive/model/model.js +18 -25
  62. package/src/directive/model/model.spec.js +2 -49
  63. package/src/directive/model-options/model-options.spec.js +0 -6
  64. package/src/directive/non-bindable/non-bindable.spec.js +0 -1
  65. package/src/directive/observe/observe.js +0 -1
  66. package/src/directive/observe/observe.spec.js +0 -1
  67. package/src/directive/options/options.spec.js +0 -34
  68. package/src/directive/ref/href.spec.js +0 -15
  69. package/src/directive/repeat/repeat.spec.js +8 -135
  70. package/src/directive/script/script.spec.js +0 -2
  71. package/src/directive/select/select.js +3 -3
  72. package/src/directive/select/select.spec.js +0 -96
  73. package/src/directive/show-hide/show-hide.js +2 -2
  74. package/src/directive/show-hide/show-hide.spec.js +8 -19
  75. package/src/directive/style/style.spec.js +0 -7
  76. package/src/directive/switch/switch.spec.js +5 -5
  77. package/src/directive/validators/validators.spec.js +0 -1
  78. package/src/loader.js +0 -1
  79. package/src/public.js +75 -80
  80. package/src/router/common/coreservices.js +0 -2
  81. package/src/router/directives/state-directives.js +6 -14
  82. package/src/router/directives/state-directives.spec.js +0 -83
  83. package/src/router/directives/view-directive.js +4 -13
  84. package/src/router/directives/view-directive.spec.js +25 -71
  85. package/src/router/hooks/lazy-load.js +2 -2
  86. package/src/router/hooks/views.js +3 -5
  87. package/src/router/resolve/resolvable.js +3 -6
  88. package/src/router/resolve/resolve-context.js +2 -2
  89. package/src/router/state/state-service.js +4 -4
  90. package/src/router/state/state.spec.js +2 -5
  91. package/src/router/state/views.js +7 -10
  92. package/src/router/template-factory.js +3 -6
  93. package/src/router/template-factory.spec.js +0 -4
  94. package/src/router/transition/transition-hook.js +1 -1
  95. package/src/router/transition/transition.js +1 -1
  96. package/src/router/view-hook.spec.js +2 -2
  97. package/src/router/view-scroll.js +4 -6
  98. package/src/services/http/http.js +6 -9
  99. package/src/services/http/http.spec.js +30 -31
  100. package/src/services/http/template-request.spec.js +0 -10
  101. package/src/services/http-backend/http-backend.spec.js +3 -3
  102. package/src/services/template-request.js +2 -4
  103. package/src/shared/common.js +1 -2
  104. package/src/shared/jqlite/jqlite.js +0 -3
  105. package/types/core/cache/cache.d.ts +1 -1
  106. package/types/core/model/model.d.ts +204 -0
  107. package/types/core/parse/parse.d.ts +26 -0
  108. package/types/core/scope/scope.d.ts +22 -21
  109. package/types/directive/channel/channel.d.ts +11 -0
  110. package/src/core/interval/interval-factory.js +0 -50
  111. package/src/core/interval/interval.html +0 -18
  112. package/src/core/interval/interval.js +0 -77
  113. package/src/core/interval/interval.md +0 -123
  114. package/src/core/interval/interval.spec.js +0 -280
  115. package/src/core/q/q.js +0 -472
  116. package/src/core/q/q.md +0 -211
  117. package/src/core/q/q.spec.js +0 -2748
  118. package/src/core/q/q.test.js +0 -12
  119. package/src/core/scope/scope.test.js +0 -12
  120. package/src/core/timeout/timeout.html +0 -18
  121. package/src/core/timeout/timeout.js +0 -109
  122. package/src/core/timeout/timeout.spec.js +0 -354
  123. package/src/core/timeout/timout.test.js +0 -12
  124. package/src/directive/list/list.html +0 -18
  125. package/src/directive/list/list.js +0 -46
  126. package/src/directive/list/list.md +0 -22
  127. package/src/directive/list/list.spec.js +0 -172
  128. package/types/directive/list/list.d.ts +0 -4
@@ -1,280 +0,0 @@
1
- import { Angular } from "../../loader";
2
- import { createInjector } from "../di/injector";
3
- import { wait } from "../../shared/test-utils";
4
-
5
- describe("$interval", () => {
6
- let injector;
7
- let $interval;
8
- let $rootScope;
9
- let errors;
10
-
11
- beforeEach(() => {
12
- errors = [];
13
- window.angular = new Angular();
14
- window.angular
15
- .module("myModule", ["ng"])
16
- .decorator("$exceptionHandler", () => {
17
- return (exception) => {
18
- errors.push(exception);
19
- };
20
- });
21
- injector = createInjector(["myModule"]);
22
-
23
- $interval = injector.get("$interval");
24
- $rootScope = injector.get("$rootScope");
25
- });
26
-
27
- it("should run tasks repeatedly", async () => {
28
- let counter = 0;
29
- $interval(() => {
30
- counter++;
31
- }, 1);
32
- expect(counter).toBe(0);
33
- await wait(15);
34
- expect(counter).toBeGreaterThanOrEqual(1);
35
- });
36
-
37
- it("should call $apply after each task is executed", (done) => {
38
- const applySpy = spyOn($rootScope, "$apply").and.callThrough();
39
-
40
- $interval(() => {}, 1);
41
- expect(applySpy).not.toHaveBeenCalled();
42
-
43
- setTimeout(() => {
44
- expect(applySpy).toHaveBeenCalled();
45
- }, 3);
46
-
47
- applySpy.calls.reset();
48
-
49
- $interval(() => {}, 1);
50
- $interval(() => {}, 1);
51
-
52
- setTimeout(() => {
53
- expect(applySpy).toHaveBeenCalledTimes(3);
54
- done();
55
- }, 1);
56
- });
57
-
58
- it("should allow you to specify a number of iterations", async () => {
59
- let counter = 0;
60
- $interval(
61
- () => {
62
- counter++;
63
- },
64
- 1,
65
- 2,
66
- );
67
-
68
- await wait(15);
69
- expect(counter).toBe(2);
70
- });
71
-
72
- it("should allow you to specify a number of arguments", (done) => {
73
- const task1 = jasmine.createSpy("task1");
74
- const task2 = jasmine.createSpy("task2");
75
- const task3 = jasmine.createSpy("task3");
76
- $interval(task1, 1, 2, true, "Task1");
77
- $interval(task2, 1, 2, true, "Task2");
78
- $interval(task3, 1, 2, true, "I", "am", "a", "Task3", "spy");
79
-
80
- setTimeout(() => {
81
- expect(task1).toHaveBeenCalledWith("Task1");
82
- expect(task2).toHaveBeenCalledWith("Task2");
83
- expect(task3).toHaveBeenCalledWith("I", "am", "a", "Task3", "spy");
84
- }, 1);
85
-
86
- task1.calls.reset();
87
- task2.calls.reset();
88
- task3.calls.reset();
89
-
90
- setTimeout(() => {
91
- expect(task1).toHaveBeenCalledWith("Task1");
92
- expect(task2).toHaveBeenCalledWith("Task2");
93
- expect(task3).toHaveBeenCalledWith("I", "am", "a", "Task3", "spy");
94
- done();
95
- }, 1);
96
- });
97
-
98
- it("should return a promise which will be updated with the count on each iteration", async () => {
99
- const log = [];
100
- const promise = $interval(() => {
101
- log.push("tick");
102
- }, 1);
103
-
104
- promise.then(
105
- (value) => {
106
- log.push(`promise success: ${value}`);
107
- },
108
- (err) => {
109
- log.push(`promise error: ${err}`);
110
- },
111
- (note) => {
112
- log.push(`promise update: ${note}`);
113
- },
114
- );
115
- expect(log).toEqual([]);
116
-
117
- await wait(5);
118
- expect(log[0]).toEqual("tick");
119
- expect(log[1]).toEqual("tick");
120
- });
121
-
122
- it("should return a promise which will be resolved after the specified number of iterations", async () => {
123
- const log = [];
124
- const promise = $interval(
125
- () => {
126
- log.push("tick");
127
- },
128
- 1,
129
- 2,
130
- );
131
-
132
- promise.then(
133
- (value) => {
134
- log.push(`promise success: ${value}`);
135
- },
136
- (err) => {
137
- log.push(`promise error: ${err}`);
138
- },
139
- );
140
- expect(log).toEqual([]);
141
- await wait(15);
142
- expect(log).toEqual(["tick", "tick", "promise success: 2"]);
143
- });
144
-
145
- describe("exception handling", () => {
146
- it("should delegate exception to the $exceptionHandler service", (done) => {
147
- errors = [];
148
- $interval(() => {
149
- throw "Test Error";
150
- }, 10);
151
-
152
- setTimeout(() => {
153
- expect(errors).toContain("Test Error");
154
- done();
155
- }, 20);
156
- });
157
-
158
- it("should call $apply even if an exception is thrown in callback", (done) => {
159
- const applySpy = spyOn($rootScope, "$apply").and.callThrough();
160
-
161
- $interval(() => {
162
- throw "Test Error2";
163
- }, 10);
164
- expect(applySpy).not.toHaveBeenCalled();
165
-
166
- setTimeout(() => {
167
- expect(applySpy).toHaveBeenCalled();
168
- done();
169
- }, 11);
170
- });
171
- });
172
-
173
- describe("cancel", () => {
174
- it("should cancel tasks", (done) => {
175
- const task1 = jasmine.createSpy("task1", 1);
176
- const task2 = jasmine.createSpy("task2", 1);
177
- const task3 = jasmine.createSpy("task3", 1);
178
- let promise1;
179
- let promise3;
180
-
181
- promise1 = $interval(task1, 2);
182
- $interval(task2, 1);
183
- promise3 = $interval(task3, 3);
184
-
185
- $interval.cancel(promise3);
186
- $interval.cancel(promise1);
187
- setTimeout(() => {
188
- expect(task1).not.toHaveBeenCalled();
189
- expect(task2).toHaveBeenCalled();
190
- expect(task3).not.toHaveBeenCalled();
191
- done();
192
- }, 1);
193
- });
194
-
195
- it("should cancel the promise", (done) => {
196
- const promise = $interval(() => {}, 1);
197
- const log = [];
198
- promise.then(
199
- (value) => {
200
- log.push(`promise success: ${value}`);
201
- },
202
- (err) => {
203
- log.push(`promise error: ${err}`);
204
- },
205
- );
206
- expect(log).toEqual([]);
207
-
208
- setTimeout(() => {
209
- $interval.cancel(promise);
210
- }, 1);
211
-
212
- setTimeout(() => {
213
- $rootScope.$apply(); // For resolving the promise -
214
- // necessary since q uses $rootScope.evalAsync.
215
-
216
- expect(log).toEqual(["promise error: canceled"]);
217
- done();
218
- }, 2);
219
- });
220
-
221
- it("should return true if a task was successfully canceled", (done) => {
222
- const task1 = jasmine.createSpy("task1");
223
- const task2 = jasmine.createSpy("task2");
224
- let promise1;
225
- let promise2;
226
-
227
- promise1 = $interval(task1, 1, 1);
228
- setTimeout(() => {
229
- promise2 = $interval(task2, 1, 1);
230
-
231
- expect($interval.cancel(promise1)).toBe(false);
232
- expect($interval.cancel(promise2)).toBe(true);
233
- done();
234
- }, 1);
235
- });
236
-
237
- it("should not throw an error when given an undefined promise", () => {
238
- expect($interval.cancel()).toBe(false);
239
- });
240
-
241
- it("should throw an error when given a non-$interval promise", () => {
242
- const promise = $interval(() => {}).then(() => {});
243
- expect(() => {
244
- $interval.cancel(promise);
245
- }).toThrowError(/badprom/);
246
- });
247
-
248
- it("should not trigger digest when cancelled", () => {
249
- const watchSpy = jasmine.createSpy("watchSpy");
250
- $rootScope.$watch(watchSpy);
251
-
252
- const t = $interval();
253
- $interval.cancel(t);
254
- expect(watchSpy).not.toHaveBeenCalled();
255
- });
256
- });
257
-
258
- describe("$window delegation", () => {
259
- it("should use $window.setInterval instead of the global function", () => {
260
- const setIntervalSpy = spyOn(window, "setInterval");
261
-
262
- $interval(() => {}, 1);
263
- expect(setIntervalSpy).toHaveBeenCalled();
264
- });
265
-
266
- it("should use $window.clearInterval instead of the global function", (done) => {
267
- const clearIntervalSpy = spyOn(window, "clearInterval");
268
-
269
- $interval(() => {}, 1, 1);
270
- setTimeout(() => {
271
- expect(clearIntervalSpy).toHaveBeenCalled();
272
-
273
- clearIntervalSpy.calls.reset();
274
- $interval.cancel($interval(() => {}, 1));
275
- expect(clearIntervalSpy).toHaveBeenCalled();
276
- done();
277
- }, 1);
278
- });
279
- });
280
- });