@angular-wave/angular.ts 0.4.4 → 0.4.6
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 -0
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -12
- package/index.html +3 -74
- package/package.json +1 -1
- package/src/angular.spec.js +5 -0
- package/src/animations/animate-css.js +13 -5
- package/src/animations/animate-queue.js +21 -22
- package/src/animations/animate-runner.js +8 -4
- package/src/animations/animate.md +1 -1
- package/src/animations/animate.spec.js +21 -0
- package/src/animations/animation.js +1 -1
- package/src/binding.spec.js +1 -0
- package/src/core/compile/compile.js +25 -27
- package/src/core/compile/compile.spec.js +266 -17
- package/src/core/controller/controller.js +0 -2
- package/src/core/di/injector.md +1 -1
- package/src/core/di/injector.spec.js +2 -0
- package/src/core/di/internal-injector.js +1 -2
- package/src/core/interpolate/interpolate.js +12 -28
- package/src/core/interpolate/interpolate.spec.js +16 -70
- package/src/core/interval/interval-factory.js +50 -0
- package/src/core/interval/interval.html +18 -0
- package/src/core/interval/interval.js +77 -0
- package/src/core/interval/interval.md +123 -0
- package/src/core/interval/interval.spec.js +280 -0
- package/src/core/interval/interval.test.js +1 -1
- package/src/core/location/location.js +53 -59
- package/src/core/location/location.spec.js +27 -27
- package/src/core/on.spec.js +7 -0
- package/src/core/parse/interpreter.js +7 -10
- package/src/core/parse/parse.js +5 -26
- package/src/core/parse/parse.spec.js +91 -95
- package/src/core/prop.spec.js +60 -4
- package/src/core/q/q.html +18 -0
- package/src/core/q/q.js +472 -0
- package/src/core/q/q.md +211 -0
- package/src/core/q/q.spec.js +2748 -0
- package/src/core/q/q.test.js +12 -0
- package/src/core/sce/sce.spec.js +8 -0
- package/src/core/{model/model.html → scope/scope.html} +1 -1
- package/src/core/scope/scope.js +16 -15
- package/src/core/scope/scope.spec.js +1959 -24
- package/src/core/scope/scope.test.js +12 -0
- package/src/core/timeout/timeout.html +18 -0
- package/src/core/timeout/timeout.js +109 -0
- package/src/core/timeout/timeout.spec.js +354 -0
- package/src/core/timeout/timout.test.js +12 -0
- package/src/core/url-utils/url-utils.spec.js +1 -1
- package/src/directive/aria/aria.js +6 -3
- package/src/directive/aria/aria.spec.js +87 -0
- package/src/directive/attrs/attrs.spec.js +5 -0
- package/src/directive/attrs/boolean.spec.js +15 -0
- package/src/directive/attrs/element-style.spec.js +8 -0
- package/src/directive/attrs/src.spec.js +7 -0
- package/src/directive/bind/bind.spec.js +33 -0
- package/src/directive/bind/bing-html.spec.js +3 -0
- package/src/directive/class/class.js +3 -3
- package/src/directive/class/class.spec.js +75 -9
- package/src/directive/controller/controller.spec.js +13 -0
- package/src/directive/events/click.spec.js +3 -0
- package/src/directive/events/event.spec.js +6 -0
- package/src/directive/events/events.html +1 -0
- package/src/directive/form/form.js +3 -2
- package/src/directive/form/form.spec.js +65 -0
- package/src/directive/if/if.spec.js +4 -0
- package/src/directive/include/include.spec.js +59 -8
- package/src/directive/init/init.js +2 -6
- package/src/directive/init/init.spec.js +2 -0
- package/src/directive/input/input.spec.js +136 -0
- package/src/directive/messages/messages.spec.js +35 -4
- package/src/directive/model/model.js +25 -18
- package/src/directive/model/model.spec.js +49 -2
- package/src/directive/model-options/model-options.spec.js +6 -0
- package/src/directive/non-bindable/non-bindable.spec.js +1 -0
- package/src/directive/observe/observe.js +5 -1
- package/src/directive/observe/observe.spec.js +22 -0
- package/src/directive/observe/test.html +3 -11
- package/src/directive/options/options.spec.js +34 -0
- package/src/directive/ref/href.spec.js +15 -0
- package/src/directive/repeat/repeat.spec.js +135 -8
- package/src/directive/script/script.spec.js +2 -0
- package/src/directive/select/select.js +3 -3
- package/src/directive/select/select.spec.js +96 -0
- package/src/directive/show-hide/show-hide.js +2 -2
- package/src/directive/show-hide/show-hide.spec.js +19 -8
- package/src/directive/style/style.spec.js +7 -0
- package/src/directive/switch/switch.spec.js +5 -5
- package/src/directive/validators/validators.spec.js +1 -0
- package/src/loader.js +1 -0
- package/src/public.js +10 -2
- package/src/router/common/coreservices.js +2 -0
- package/src/router/directives/state-directives.js +14 -6
- package/src/router/directives/state-directives.spec.js +83 -0
- package/src/router/directives/view-directive.js +13 -4
- package/src/router/directives/view-directive.spec.js +71 -25
- package/src/router/hooks/lazy-load.js +2 -2
- package/src/router/hooks/views.js +5 -3
- package/src/router/resolve/resolvable.js +6 -3
- 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 +5 -2
- package/src/router/state/state.test.js +1 -1
- package/src/router/state/views.js +10 -7
- package/src/router/template-factory.js +6 -3
- package/src/router/template-factory.spec.js +4 -0
- package/src/router/transition/transition-hook.js +1 -1
- package/src/router/transition/transition.js +1 -1
- package/src/router/view-hook.spec.js +2 -2
- package/src/router/view-scroll.js +6 -4
- package/src/services/browser.js +5 -8
- package/src/services/http/http.js +9 -6
- package/src/services/http/http.spec.js +31 -30
- package/src/services/http/template-request.spec.js +10 -0
- package/src/services/http-backend/http-backend.spec.js +3 -3
- package/src/services/template-request.js +4 -2
- package/src/shared/common.js +2 -1
- package/types/core/location/location.d.ts +37 -34
- package/types/core/parse/parse.d.ts +0 -26
- package/types/core/scope/scope.d.ts +11 -11
- package/src/core/model/model.js +0 -944
- package/src/core/model/model.spec.js +0 -3012
- package/types/core/model/model.d.ts +0 -204
|
@@ -69,6 +69,7 @@ describe("ngController", () => {
|
|
|
69
69
|
element = $compile('<div ng-controller="Greeter">{{greet(name)}}</div>')(
|
|
70
70
|
$rootScope,
|
|
71
71
|
);
|
|
72
|
+
$rootScope.$digest();
|
|
72
73
|
expect(element.text()).toBe("Hello Misko!");
|
|
73
74
|
});
|
|
74
75
|
|
|
@@ -76,6 +77,7 @@ describe("ngController", () => {
|
|
|
76
77
|
element = $compile('<div ng-controller="BoundFoo">{{mark}}</div>')(
|
|
77
78
|
$rootScope,
|
|
78
79
|
);
|
|
80
|
+
$rootScope.$digest();
|
|
79
81
|
expect(element.text()).toBe("foo");
|
|
80
82
|
});
|
|
81
83
|
|
|
@@ -83,6 +85,7 @@ describe("ngController", () => {
|
|
|
83
85
|
element = $compile('<div ng-controller="Public as p">{{p.mark}}</div>')(
|
|
84
86
|
$rootScope,
|
|
85
87
|
);
|
|
88
|
+
$rootScope.$digest();
|
|
86
89
|
expect(element.text()).toBe("works");
|
|
87
90
|
});
|
|
88
91
|
|
|
@@ -90,6 +93,7 @@ describe("ngController", () => {
|
|
|
90
93
|
element = $compile(
|
|
91
94
|
'<div ng-controller="PublicModule as p">{{p.mark}}</div>',
|
|
92
95
|
)($rootScope);
|
|
96
|
+
$rootScope.$digest();
|
|
93
97
|
expect(element.text()).toBe("works");
|
|
94
98
|
});
|
|
95
99
|
|
|
@@ -97,12 +101,14 @@ describe("ngController", () => {
|
|
|
97
101
|
element = $compile(
|
|
98
102
|
'<div ng-controller="Greeter"><div ng-controller="Child">{{greet(name)}}</div></div>',
|
|
99
103
|
)($rootScope);
|
|
104
|
+
$rootScope.$digest();
|
|
100
105
|
expect(element.text()).toBe("Hello Adam!");
|
|
101
106
|
dealoc(element);
|
|
102
107
|
|
|
103
108
|
element = $compile(
|
|
104
109
|
'<div ng-controller="Greeter"><div ng-controller="Child">{{protoGreet(name)}}</div></div>',
|
|
105
110
|
)($rootScope);
|
|
111
|
+
$rootScope.$digest();
|
|
106
112
|
expect(element.text()).toBe("Hello Adam!");
|
|
107
113
|
});
|
|
108
114
|
|
|
@@ -119,6 +125,7 @@ describe("ngController", () => {
|
|
|
119
125
|
injector = angular.bootstrap(element, ["myModule"]);
|
|
120
126
|
|
|
121
127
|
$rootScope = injector.get("$rootScope");
|
|
128
|
+
$rootScope.$digest();
|
|
122
129
|
setTimeout(() => {
|
|
123
130
|
expect(element.text()).toEqual("Vojta");
|
|
124
131
|
dealoc($rootScope);
|
|
@@ -143,7 +150,11 @@ describe("ngController", () => {
|
|
|
143
150
|
$rootScope = injector.get("$rootScope");
|
|
144
151
|
|
|
145
152
|
$rootScope.expr = "first";
|
|
153
|
+
$rootScope.$digest();
|
|
154
|
+
|
|
146
155
|
$rootScope.expr = "second";
|
|
156
|
+
$rootScope.$digest();
|
|
157
|
+
|
|
147
158
|
expect(count).toBe(1);
|
|
148
159
|
});
|
|
149
160
|
|
|
@@ -163,6 +174,8 @@ describe("ngController", () => {
|
|
|
163
174
|
injector = angular.bootstrap(element, ["myModule"]);
|
|
164
175
|
|
|
165
176
|
$rootScope = injector.get("$rootScope");
|
|
177
|
+
$rootScope.$digest();
|
|
178
|
+
|
|
166
179
|
expect(controllerScope.name).toBeUndefined();
|
|
167
180
|
});
|
|
168
181
|
});
|
|
@@ -21,6 +21,7 @@ describe("ngClick", () => {
|
|
|
21
21
|
|
|
22
22
|
it("should get called on a click", () => {
|
|
23
23
|
element = $compile('<div ng-click="clicked = true"></div>')($rootScope);
|
|
24
|
+
$rootScope.$digest();
|
|
24
25
|
expect($rootScope.clicked).toBeFalsy();
|
|
25
26
|
|
|
26
27
|
element[0].click();
|
|
@@ -29,6 +30,8 @@ describe("ngClick", () => {
|
|
|
29
30
|
|
|
30
31
|
it("should pass event object", () => {
|
|
31
32
|
element = $compile('<div ng-click="event = $event"></div>')($rootScope);
|
|
33
|
+
$rootScope.$digest();
|
|
34
|
+
|
|
32
35
|
element[0].click();
|
|
33
36
|
expect($rootScope.event).toBeDefined();
|
|
34
37
|
});
|
|
@@ -40,6 +40,8 @@ describe("event directives", () => {
|
|
|
40
40
|
'<input type="submit" />' +
|
|
41
41
|
"</form>",
|
|
42
42
|
)($rootScope);
|
|
43
|
+
$rootScope.$digest();
|
|
44
|
+
|
|
43
45
|
// Support: Chrome 60+
|
|
44
46
|
// We need to add the form to the DOM in order for `submit` events to be properly fired.
|
|
45
47
|
document.getElementById("dummy").appendChild(element[0]);
|
|
@@ -67,6 +69,8 @@ describe("event directives", () => {
|
|
|
67
69
|
'<input type="submit" />' +
|
|
68
70
|
"</form>",
|
|
69
71
|
)($rootScope);
|
|
72
|
+
$rootScope.$digest();
|
|
73
|
+
|
|
70
74
|
// Support: Chrome 60+ (on Windows)
|
|
71
75
|
// We need to add the form to the DOM in order for `submit` events to be properly fired.
|
|
72
76
|
document.getElementById("dummy").appendChild(element[0]);
|
|
@@ -272,6 +276,8 @@ describe("event directives", () => {
|
|
|
272
276
|
logs.push("done");
|
|
273
277
|
});
|
|
274
278
|
|
|
279
|
+
$rootScope.$digest();
|
|
280
|
+
|
|
275
281
|
expect(logs[0]).toEqual("listener error");
|
|
276
282
|
expect(logs[1]).toEqual("done");
|
|
277
283
|
});
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
12
|
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
13
|
<script type="module" src="/src/directive/events/event.spec.js"></script>
|
|
14
|
+
<script type="module" src="/src/directive/events/click.spec.js"></script>
|
|
14
15
|
</head>
|
|
15
16
|
<body>
|
|
16
17
|
<div id="dummy"></div>
|
|
@@ -448,8 +448,9 @@ addSetValidityMethod({
|
|
|
448
448
|
*/
|
|
449
449
|
const formDirectiveFactory = function (isNgForm) {
|
|
450
450
|
return [
|
|
451
|
+
"$timeout",
|
|
451
452
|
"$parse",
|
|
452
|
-
function ($parse) {
|
|
453
|
+
function ($timeout, $parse) {
|
|
453
454
|
const formDirective = {
|
|
454
455
|
name: "form",
|
|
455
456
|
restrict: isNgForm ? "EA" : "E",
|
|
@@ -491,7 +492,7 @@ const formDirectiveFactory = function (isNgForm) {
|
|
|
491
492
|
// unregister the preventDefault listener so that we don't not leak memory but in a
|
|
492
493
|
// way that will achieve the prevention of the default action.
|
|
493
494
|
formElement.on("$destroy", () => {
|
|
494
|
-
|
|
495
|
+
$timeout(
|
|
495
496
|
() => {
|
|
496
497
|
formElement[0].removeEventListener(
|
|
497
498
|
"submit",
|
|
@@ -53,6 +53,8 @@ describe("form", () => {
|
|
|
53
53
|
"</form>",
|
|
54
54
|
)(scope);
|
|
55
55
|
scope.inputPresent = true;
|
|
56
|
+
scope.$digest();
|
|
57
|
+
|
|
56
58
|
const form = scope.myForm;
|
|
57
59
|
control.$setValidity("required", false);
|
|
58
60
|
|
|
@@ -113,6 +115,8 @@ describe("form", () => {
|
|
|
113
115
|
"</form>",
|
|
114
116
|
)(scope);
|
|
115
117
|
|
|
118
|
+
scope.$digest();
|
|
119
|
+
|
|
116
120
|
const form = scope.myForm;
|
|
117
121
|
|
|
118
122
|
const input = doc.find("input").eq(0);
|
|
@@ -154,6 +158,8 @@ describe("form", () => {
|
|
|
154
158
|
'<form name="otherForm"></form>',
|
|
155
159
|
)(scope);
|
|
156
160
|
|
|
161
|
+
scope.$digest();
|
|
162
|
+
|
|
157
163
|
const form = scope.myForm;
|
|
158
164
|
const { otherForm } = scope;
|
|
159
165
|
const { childControl } = form;
|
|
@@ -167,11 +173,15 @@ describe("form", () => {
|
|
|
167
173
|
|
|
168
174
|
// rename the childControl
|
|
169
175
|
scope.controlName = "childControlMoved";
|
|
176
|
+
scope.$digest();
|
|
177
|
+
|
|
170
178
|
expect(form.childControlMoved).toBeUndefined();
|
|
171
179
|
expect(otherForm.childControl).toBeUndefined();
|
|
172
180
|
expect(otherForm.childControlMoved).toBe(childControl);
|
|
173
181
|
|
|
174
182
|
scope.hasChildControl = false;
|
|
183
|
+
scope.$digest();
|
|
184
|
+
|
|
175
185
|
expect(form.childControlMoved).toBeUndefined();
|
|
176
186
|
expect(otherForm.childControlMoved).toBeUndefined();
|
|
177
187
|
});
|
|
@@ -185,6 +195,7 @@ describe("form", () => {
|
|
|
185
195
|
"</form></div>",
|
|
186
196
|
)(scope);
|
|
187
197
|
|
|
198
|
+
scope.$digest();
|
|
188
199
|
expect(scope.ctrl.myForm).toBeUndefined();
|
|
189
200
|
|
|
190
201
|
scope.$apply("formPresent = true");
|
|
@@ -245,6 +256,7 @@ describe("form", () => {
|
|
|
245
256
|
</form>
|
|
246
257
|
</div>
|
|
247
258
|
`)(scope);
|
|
259
|
+
scope.$digest();
|
|
248
260
|
expect(scope.formA.$error.required.length).toBe(1);
|
|
249
261
|
expect(scope.formA.$error.required).toEqual([scope.formA.firstName]);
|
|
250
262
|
expect(scope.formB.$error.required.length).toBe(1);
|
|
@@ -298,6 +310,8 @@ describe("form", () => {
|
|
|
298
310
|
'<input type="text" ng-model="name" />' +
|
|
299
311
|
"</form>",
|
|
300
312
|
)(scope);
|
|
313
|
+
scope.$digest();
|
|
314
|
+
|
|
301
315
|
const inputElm = form.find("input").eq(0);
|
|
302
316
|
|
|
303
317
|
inputElm[0].setAttribute("value", "a");
|
|
@@ -317,6 +331,8 @@ describe("form", () => {
|
|
|
317
331
|
"</div>" +
|
|
318
332
|
"</form>",
|
|
319
333
|
)(scope);
|
|
334
|
+
scope.$digest();
|
|
335
|
+
|
|
320
336
|
const inputElm = form.find("input").eq(0);
|
|
321
337
|
inputElm[0].setAttribute("value", "a");
|
|
322
338
|
inputElm[0].dispatchEvent(new Event("change"));
|
|
@@ -334,6 +350,8 @@ describe("form", () => {
|
|
|
334
350
|
'<input type="text" ng-model="name" />' +
|
|
335
351
|
"</form>",
|
|
336
352
|
)(scope);
|
|
353
|
+
scope.$digest();
|
|
354
|
+
|
|
337
355
|
const inputElm = form.find("input").eq(0);
|
|
338
356
|
inputElm[0].setAttribute("value", "a");
|
|
339
357
|
inputElm[0].dispatchEvent(new Event("change"));
|
|
@@ -355,6 +373,8 @@ describe("form", () => {
|
|
|
355
373
|
'<button ng-click="test.$rollbackViewValue()" />' +
|
|
356
374
|
"</form>",
|
|
357
375
|
)(scope);
|
|
376
|
+
scope.$digest();
|
|
377
|
+
|
|
358
378
|
const inputElm = form.find("input").eq(0);
|
|
359
379
|
inputElm[0].setAttribute("value", "a");
|
|
360
380
|
inputElm[0].dispatchEvent(new Event("click"));
|
|
@@ -374,6 +394,8 @@ describe("form", () => {
|
|
|
374
394
|
'<button ng-click="test.$rollbackViewValue()" />' +
|
|
375
395
|
"</form>",
|
|
376
396
|
)(scope);
|
|
397
|
+
scope.$digest();
|
|
398
|
+
|
|
377
399
|
const inputElm = form.find("input").eq(0);
|
|
378
400
|
inputElm[0].setAttribute("value", "a");
|
|
379
401
|
inputElm[0].dispatchEvent(new Event("click"));
|
|
@@ -923,6 +945,8 @@ describe("form", () => {
|
|
|
923
945
|
'<form name="otherForm"></form>',
|
|
924
946
|
)(scope);
|
|
925
947
|
|
|
948
|
+
scope.$digest();
|
|
949
|
+
|
|
926
950
|
const form = scope.myForm;
|
|
927
951
|
const { otherForm } = scope;
|
|
928
952
|
const { childForm } = form;
|
|
@@ -936,11 +960,15 @@ describe("form", () => {
|
|
|
936
960
|
|
|
937
961
|
// rename the childForm
|
|
938
962
|
scope.formName = "childFormMoved";
|
|
963
|
+
scope.$digest();
|
|
964
|
+
|
|
939
965
|
expect(form.childFormMoved).toBeUndefined();
|
|
940
966
|
expect(otherForm.childForm).toBeUndefined();
|
|
941
967
|
expect(otherForm.childFormMoved).toBe(childForm);
|
|
942
968
|
|
|
943
969
|
scope.hasChildForm = false;
|
|
970
|
+
scope.$digest();
|
|
971
|
+
|
|
944
972
|
expect(form.childFormMoved).toBeUndefined();
|
|
945
973
|
expect(otherForm.childFormMoved).toBeUndefined();
|
|
946
974
|
});
|
|
@@ -985,23 +1013,28 @@ describe("form", () => {
|
|
|
985
1013
|
'<input ng-model="name" name="name" store-model-ctrl/>' +
|
|
986
1014
|
"</form>",
|
|
987
1015
|
)(scope);
|
|
1016
|
+
|
|
1017
|
+
scope.$digest();
|
|
988
1018
|
});
|
|
989
1019
|
|
|
990
1020
|
it("should have ng-valid/ng-invalid css class", () => {
|
|
991
1021
|
expect(doc[0].classList.contains("ng-valid")).toBeTrue();
|
|
992
1022
|
|
|
993
1023
|
control.$setValidity("error", false);
|
|
1024
|
+
scope.$digest();
|
|
994
1025
|
expect(doc[0].classList.contains("ng-invalid")).toBeTrue();
|
|
995
1026
|
expect(doc[0].classList.contains("ng-valid-error")).toBe(false);
|
|
996
1027
|
expect(doc[0].classList.contains("ng-invalid-error")).toBe(true);
|
|
997
1028
|
|
|
998
1029
|
control.$setValidity("another", false);
|
|
1030
|
+
scope.$digest();
|
|
999
1031
|
expect(doc[0].classList.contains("ng-valid-error")).toBe(false);
|
|
1000
1032
|
expect(doc[0].classList.contains("ng-invalid-error")).toBe(true);
|
|
1001
1033
|
expect(doc[0].classList.contains("ng-valid-another")).toBe(false);
|
|
1002
1034
|
expect(doc[0].classList.contains("ng-invalid-another")).toBe(true);
|
|
1003
1035
|
|
|
1004
1036
|
control.$setValidity("error", true);
|
|
1037
|
+
scope.$digest();
|
|
1005
1038
|
expect(doc[0].classList.contains("ng-invalid")).toBeTrue();
|
|
1006
1039
|
expect(doc[0].classList.contains("ng-valid-error")).toBe(true);
|
|
1007
1040
|
expect(doc[0].classList.contains("ng-invalid-error")).toBe(false);
|
|
@@ -1009,6 +1042,7 @@ describe("form", () => {
|
|
|
1009
1042
|
expect(doc[0].classList.contains("ng-invalid-another")).toBe(true);
|
|
1010
1043
|
|
|
1011
1044
|
control.$setValidity("another", true);
|
|
1045
|
+
scope.$digest();
|
|
1012
1046
|
expect(doc[0].classList.contains("ng-valid")).toBeTrue();
|
|
1013
1047
|
expect(doc[0].classList.contains("ng-valid-error")).toBe(true);
|
|
1014
1048
|
expect(doc[0].classList.contains("ng-invalid-error")).toBe(false);
|
|
@@ -1018,6 +1052,7 @@ describe("form", () => {
|
|
|
1018
1052
|
// validators are skipped, e.g. because of a parser error
|
|
1019
1053
|
control.$setValidity("error", null);
|
|
1020
1054
|
control.$setValidity("another", null);
|
|
1055
|
+
scope.$digest();
|
|
1021
1056
|
expect(doc[0].classList.contains("ng-valid-error")).toBe(false);
|
|
1022
1057
|
expect(doc[0].classList.contains("ng-invalid-error")).toBe(false);
|
|
1023
1058
|
expect(doc[0].classList.contains("ng-valid-another")).toBe(false);
|
|
@@ -1038,6 +1073,7 @@ describe("form", () => {
|
|
|
1038
1073
|
describe("$pending", () => {
|
|
1039
1074
|
beforeEach(() => {
|
|
1040
1075
|
doc = $compile('<form name="form"></form>')(scope);
|
|
1076
|
+
scope.$digest();
|
|
1041
1077
|
});
|
|
1042
1078
|
|
|
1043
1079
|
it("should set valid and invalid to undefined when a validation error state is set as pending", () => {
|
|
@@ -1074,6 +1110,8 @@ describe("form", () => {
|
|
|
1074
1110
|
"</form>",
|
|
1075
1111
|
)(scope);
|
|
1076
1112
|
|
|
1113
|
+
scope.$digest();
|
|
1114
|
+
|
|
1077
1115
|
const form = doc;
|
|
1078
1116
|
const formCtrl = scope.testForm;
|
|
1079
1117
|
const input1 = form.find("input").eq(0);
|
|
@@ -1089,6 +1127,8 @@ describe("form", () => {
|
|
|
1089
1127
|
expect(input2[0].classList.contains("ng-dirty")).toBeTrue();
|
|
1090
1128
|
|
|
1091
1129
|
formCtrl.$setPristine();
|
|
1130
|
+
scope.$digest();
|
|
1131
|
+
|
|
1092
1132
|
expect(form[0].classList.contains("ng-pristine")).toBeTrue();
|
|
1093
1133
|
expect(form[0].classList.contains("ng-dirty")).toBeFalse();
|
|
1094
1134
|
expect(formCtrl.$pristine).toBe(true);
|
|
@@ -1107,6 +1147,8 @@ describe("form", () => {
|
|
|
1107
1147
|
'<form name="testForm">' + '<input ng-model="anonymous">' + "</form>",
|
|
1108
1148
|
)(scope);
|
|
1109
1149
|
|
|
1150
|
+
scope.$digest();
|
|
1151
|
+
|
|
1110
1152
|
const form = doc;
|
|
1111
1153
|
const formCtrl = scope.testForm;
|
|
1112
1154
|
const input = form.find("input").eq(0);
|
|
@@ -1118,6 +1160,7 @@ describe("form", () => {
|
|
|
1118
1160
|
expect(input[0].classList.contains("ng-dirty")).toBeTrue();
|
|
1119
1161
|
|
|
1120
1162
|
formCtrl.$setPristine();
|
|
1163
|
+
scope.$digest();
|
|
1121
1164
|
expect(form[0].classList.contains("ng-pristine")).toBeTrue();
|
|
1122
1165
|
expect(formCtrl.$pristine).toBe(true);
|
|
1123
1166
|
expect(formCtrl.$dirty).toBe(false);
|
|
@@ -1135,6 +1178,8 @@ describe("form", () => {
|
|
|
1135
1178
|
"</form>",
|
|
1136
1179
|
)(scope);
|
|
1137
1180
|
|
|
1181
|
+
scope.$digest();
|
|
1182
|
+
|
|
1138
1183
|
const form = doc;
|
|
1139
1184
|
const formCtrl = scope.testForm;
|
|
1140
1185
|
const nestedForm = form.find("div");
|
|
@@ -1149,7 +1194,10 @@ describe("form", () => {
|
|
|
1149
1194
|
expect(nestedInput[0].classList.contains("ng-dirty")).toBeTrue();
|
|
1150
1195
|
|
|
1151
1196
|
formCtrl.$setPristine();
|
|
1197
|
+
scope.$digest();
|
|
1152
1198
|
expect(form[0].classList.contains("ng-pristine")).toBeTrue();
|
|
1199
|
+
scope.$digest();
|
|
1200
|
+
|
|
1153
1201
|
expect(formCtrl.$pristine).toBe(true);
|
|
1154
1202
|
expect(formCtrl.$dirty).toBe(false);
|
|
1155
1203
|
expect(nestedForm[0].classList.contains("ng-pristine")).toBeTrue();
|
|
@@ -1168,6 +1216,8 @@ describe("form", () => {
|
|
|
1168
1216
|
'<input name="alias" type="text" ng-model="name" />' +
|
|
1169
1217
|
"</form>",
|
|
1170
1218
|
)(scope);
|
|
1219
|
+
scope.$digest();
|
|
1220
|
+
|
|
1171
1221
|
scope.myForm.alias.$setTouched();
|
|
1172
1222
|
expect(scope.myForm.alias.$touched).toBe(true);
|
|
1173
1223
|
scope.myForm.$setUntouched();
|
|
@@ -1183,6 +1233,8 @@ describe("form", () => {
|
|
|
1183
1233
|
"</div>" +
|
|
1184
1234
|
"</form>",
|
|
1185
1235
|
)(scope);
|
|
1236
|
+
scope.$digest();
|
|
1237
|
+
|
|
1186
1238
|
scope.myForm.childForm.alias.$setTouched();
|
|
1187
1239
|
expect(scope.myForm.childForm.alias.$touched).toBe(true);
|
|
1188
1240
|
scope.myForm.$setUntouched();
|
|
@@ -1195,6 +1247,8 @@ describe("form", () => {
|
|
|
1195
1247
|
it("should return an empty array if the controller has no controls", () => {
|
|
1196
1248
|
doc = $compile('<form name="testForm"></form>')(scope);
|
|
1197
1249
|
|
|
1250
|
+
scope.$digest();
|
|
1251
|
+
|
|
1198
1252
|
const formCtrl = scope.testForm;
|
|
1199
1253
|
|
|
1200
1254
|
expect(formCtrl.$getControls()).toEqual([]);
|
|
@@ -1210,6 +1264,8 @@ describe("form", () => {
|
|
|
1210
1264
|
"</form>",
|
|
1211
1265
|
)(scope);
|
|
1212
1266
|
|
|
1267
|
+
scope.$digest();
|
|
1268
|
+
|
|
1213
1269
|
const form = doc;
|
|
1214
1270
|
const formCtrl = scope.testForm;
|
|
1215
1271
|
const formInput = form.children("input").eq(0);
|
|
@@ -1248,6 +1304,7 @@ describe("form", () => {
|
|
|
1248
1304
|
"</form>",
|
|
1249
1305
|
)(scope);
|
|
1250
1306
|
|
|
1307
|
+
scope.$digest();
|
|
1251
1308
|
const formA = scope.form.nestedA;
|
|
1252
1309
|
expect(formA).toBeDefined();
|
|
1253
1310
|
expect(formA.$name).toBe("nestedA");
|
|
@@ -1258,6 +1315,8 @@ describe("form", () => {
|
|
|
1258
1315
|
|
|
1259
1316
|
scope.idA = "B";
|
|
1260
1317
|
scope.idB = "Y";
|
|
1318
|
+
scope.$digest();
|
|
1319
|
+
|
|
1261
1320
|
expect(scope.form.nestedA).toBeUndefined();
|
|
1262
1321
|
expect(scope.form.nestedB).toBe(formA);
|
|
1263
1322
|
expect(formA.nestedX).toBeUndefined();
|
|
@@ -1268,6 +1327,7 @@ describe("form", () => {
|
|
|
1268
1327
|
const element = $compile('<form name="name{{nameID}}"></form>')(scope);
|
|
1269
1328
|
const element2 = $compile('<div ng-form="ngform{{nameID}}"></div>')(scope);
|
|
1270
1329
|
scope.nameID = "A";
|
|
1330
|
+
scope.$digest();
|
|
1271
1331
|
const form = element.controller("form");
|
|
1272
1332
|
const form2 = element2.controller("form");
|
|
1273
1333
|
expect(scope.nameA).toBe(form);
|
|
@@ -1276,6 +1336,7 @@ describe("form", () => {
|
|
|
1276
1336
|
expect(form2.$name).toBe("ngformA");
|
|
1277
1337
|
|
|
1278
1338
|
scope.nameID = "B";
|
|
1339
|
+
scope.$digest();
|
|
1279
1340
|
expect(scope.nameA).toBeUndefined();
|
|
1280
1341
|
expect(scope.ngformA).toBeUndefined();
|
|
1281
1342
|
expect(scope.nameB).toBe(form);
|
|
@@ -1286,10 +1347,12 @@ describe("form", () => {
|
|
|
1286
1347
|
|
|
1287
1348
|
it("should rename forms with an initially blank name", () => {
|
|
1288
1349
|
const element = $compile('<form name="{{name}}"></form>')(scope);
|
|
1350
|
+
scope.$digest();
|
|
1289
1351
|
const form = element.controller("form");
|
|
1290
1352
|
expect(scope[""]).toBe(form);
|
|
1291
1353
|
expect(form.$name).toBe("");
|
|
1292
1354
|
scope.name = "foo";
|
|
1355
|
+
scope.$digest();
|
|
1293
1356
|
expect(scope.foo).toBe(form);
|
|
1294
1357
|
expect(form.$name).toBe("foo");
|
|
1295
1358
|
expect(scope.foo).toBe(form);
|
|
@@ -1303,6 +1366,8 @@ describe("form", () => {
|
|
|
1303
1366
|
'<input type="submit" />' +
|
|
1304
1367
|
"</form>",
|
|
1305
1368
|
)(scope);
|
|
1369
|
+
|
|
1370
|
+
scope.$digest();
|
|
1306
1371
|
});
|
|
1307
1372
|
|
|
1308
1373
|
it("should not init in submitted state", () => {
|
|
@@ -146,6 +146,8 @@ describe("ngIf", () => {
|
|
|
146
146
|
});
|
|
147
147
|
injector = angular.bootstrap(element, ["myModule"]);
|
|
148
148
|
|
|
149
|
+
$rootScope.$digest();
|
|
150
|
+
|
|
149
151
|
setTimeout(() => {
|
|
150
152
|
expect(element.text()).toBe("Hello");
|
|
151
153
|
done();
|
|
@@ -210,6 +212,7 @@ describe("ngIf", () => {
|
|
|
210
212
|
|
|
211
213
|
it("should not trigger a digest when the element is removed", () => {
|
|
212
214
|
const spy = spyOn($rootScope, "$digest").and.callThrough();
|
|
215
|
+
let $timeout = injector.get("$timeout");
|
|
213
216
|
$scope.hello = true;
|
|
214
217
|
makeIf("hello");
|
|
215
218
|
expect(element.children().length).toBe(1);
|
|
@@ -265,6 +268,7 @@ describe("ngIf", () => {
|
|
|
265
268
|
const element = $compile('<iso><span ng-bind="val"></span></iso>')(
|
|
266
269
|
$rootScope,
|
|
267
270
|
);
|
|
271
|
+
$rootScope.$digest();
|
|
268
272
|
expect(element.text().trim()).toEqual(
|
|
269
273
|
"val=value in iso scope-transcluded content",
|
|
270
274
|
);
|