@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.
- package/dist/angular-ts.umd.js +10 -0
- package/index.html +74 -3
- package/package.json +1 -1
- package/src/angular.spec.js +0 -5
- package/src/animations/animate-css.js +5 -13
- package/src/animations/animate-queue.js +22 -21
- 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 +1 -1
- package/src/binding.spec.js +0 -1
- package/src/core/cache/cache.js +2 -29
- package/src/core/compile/compile.js +26 -27
- package/src/core/compile/compile.spec.js +17 -266
- 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/interval/interval.test.js +1 -1
- 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 +26 -5
- package/src/core/parse/parse.spec.js +95 -91
- package/src/core/prop.spec.js +4 -60
- package/src/core/sce/sce.spec.js +0 -8
- package/src/core/scope/scope.js +61 -30
- 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/attrs/boolean.spec.js +0 -15
- package/src/directive/attrs/element-style.spec.js +0 -8
- 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 +0 -3
- package/src/{core/q/q.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/{list/list.test.js → channel/channel.test.js} +2 -4
- 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 +2 -3
- package/src/directive/form/form.spec.js +0 -65
- package/src/directive/if/if.spec.js +0 -4
- 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.spec.js +0 -136
- package/src/directive/messages/messages.spec.js +4 -35
- package/src/directive/model/model.js +18 -25
- package/src/directive/model/model.spec.js +2 -49
- 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.spec.js +0 -34
- package/src/directive/ref/href.spec.js +0 -15
- package/src/directive/repeat/repeat.spec.js +8 -135
- package/src/directive/script/script.spec.js +0 -2
- package/src/directive/select/select.js +3 -3
- package/src/directive/select/select.spec.js +0 -96
- 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.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 +6 -14
- package/src/router/directives/state-directives.spec.js +0 -83
- package/src/router/directives/view-directive.js +4 -13
- 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 +7 -10
- 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/view-hook.spec.js +2 -2
- package/src/router/view-scroll.js +4 -6
- package/src/services/http/http.js +6 -9
- 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.spec.js +3 -3
- package/src/services/template-request.js +2 -4
- package/src/shared/common.js +1 -2
- package/src/shared/jqlite/jqlite.js +0 -3
- 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/src/core/interval/interval-factory.js +0 -50
- package/src/core/interval/interval.html +0 -18
- 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/q/q.test.js +0 -12
- package/src/core/scope/scope.test.js +0 -12
- package/src/core/timeout/timeout.html +0 -18
- 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
|
@@ -53,8 +53,6 @@ describe("form", () => {
|
|
|
53
53
|
"</form>",
|
|
54
54
|
)(scope);
|
|
55
55
|
scope.inputPresent = true;
|
|
56
|
-
scope.$digest();
|
|
57
|
-
|
|
58
56
|
const form = scope.myForm;
|
|
59
57
|
control.$setValidity("required", false);
|
|
60
58
|
|
|
@@ -115,8 +113,6 @@ describe("form", () => {
|
|
|
115
113
|
"</form>",
|
|
116
114
|
)(scope);
|
|
117
115
|
|
|
118
|
-
scope.$digest();
|
|
119
|
-
|
|
120
116
|
const form = scope.myForm;
|
|
121
117
|
|
|
122
118
|
const input = doc.find("input").eq(0);
|
|
@@ -158,8 +154,6 @@ describe("form", () => {
|
|
|
158
154
|
'<form name="otherForm"></form>',
|
|
159
155
|
)(scope);
|
|
160
156
|
|
|
161
|
-
scope.$digest();
|
|
162
|
-
|
|
163
157
|
const form = scope.myForm;
|
|
164
158
|
const { otherForm } = scope;
|
|
165
159
|
const { childControl } = form;
|
|
@@ -173,15 +167,11 @@ describe("form", () => {
|
|
|
173
167
|
|
|
174
168
|
// rename the childControl
|
|
175
169
|
scope.controlName = "childControlMoved";
|
|
176
|
-
scope.$digest();
|
|
177
|
-
|
|
178
170
|
expect(form.childControlMoved).toBeUndefined();
|
|
179
171
|
expect(otherForm.childControl).toBeUndefined();
|
|
180
172
|
expect(otherForm.childControlMoved).toBe(childControl);
|
|
181
173
|
|
|
182
174
|
scope.hasChildControl = false;
|
|
183
|
-
scope.$digest();
|
|
184
|
-
|
|
185
175
|
expect(form.childControlMoved).toBeUndefined();
|
|
186
176
|
expect(otherForm.childControlMoved).toBeUndefined();
|
|
187
177
|
});
|
|
@@ -195,7 +185,6 @@ describe("form", () => {
|
|
|
195
185
|
"</form></div>",
|
|
196
186
|
)(scope);
|
|
197
187
|
|
|
198
|
-
scope.$digest();
|
|
199
188
|
expect(scope.ctrl.myForm).toBeUndefined();
|
|
200
189
|
|
|
201
190
|
scope.$apply("formPresent = true");
|
|
@@ -256,7 +245,6 @@ describe("form", () => {
|
|
|
256
245
|
</form>
|
|
257
246
|
</div>
|
|
258
247
|
`)(scope);
|
|
259
|
-
scope.$digest();
|
|
260
248
|
expect(scope.formA.$error.required.length).toBe(1);
|
|
261
249
|
expect(scope.formA.$error.required).toEqual([scope.formA.firstName]);
|
|
262
250
|
expect(scope.formB.$error.required.length).toBe(1);
|
|
@@ -310,8 +298,6 @@ describe("form", () => {
|
|
|
310
298
|
'<input type="text" ng-model="name" />' +
|
|
311
299
|
"</form>",
|
|
312
300
|
)(scope);
|
|
313
|
-
scope.$digest();
|
|
314
|
-
|
|
315
301
|
const inputElm = form.find("input").eq(0);
|
|
316
302
|
|
|
317
303
|
inputElm[0].setAttribute("value", "a");
|
|
@@ -331,8 +317,6 @@ describe("form", () => {
|
|
|
331
317
|
"</div>" +
|
|
332
318
|
"</form>",
|
|
333
319
|
)(scope);
|
|
334
|
-
scope.$digest();
|
|
335
|
-
|
|
336
320
|
const inputElm = form.find("input").eq(0);
|
|
337
321
|
inputElm[0].setAttribute("value", "a");
|
|
338
322
|
inputElm[0].dispatchEvent(new Event("change"));
|
|
@@ -350,8 +334,6 @@ describe("form", () => {
|
|
|
350
334
|
'<input type="text" ng-model="name" />' +
|
|
351
335
|
"</form>",
|
|
352
336
|
)(scope);
|
|
353
|
-
scope.$digest();
|
|
354
|
-
|
|
355
337
|
const inputElm = form.find("input").eq(0);
|
|
356
338
|
inputElm[0].setAttribute("value", "a");
|
|
357
339
|
inputElm[0].dispatchEvent(new Event("change"));
|
|
@@ -373,8 +355,6 @@ describe("form", () => {
|
|
|
373
355
|
'<button ng-click="test.$rollbackViewValue()" />' +
|
|
374
356
|
"</form>",
|
|
375
357
|
)(scope);
|
|
376
|
-
scope.$digest();
|
|
377
|
-
|
|
378
358
|
const inputElm = form.find("input").eq(0);
|
|
379
359
|
inputElm[0].setAttribute("value", "a");
|
|
380
360
|
inputElm[0].dispatchEvent(new Event("click"));
|
|
@@ -394,8 +374,6 @@ describe("form", () => {
|
|
|
394
374
|
'<button ng-click="test.$rollbackViewValue()" />' +
|
|
395
375
|
"</form>",
|
|
396
376
|
)(scope);
|
|
397
|
-
scope.$digest();
|
|
398
|
-
|
|
399
377
|
const inputElm = form.find("input").eq(0);
|
|
400
378
|
inputElm[0].setAttribute("value", "a");
|
|
401
379
|
inputElm[0].dispatchEvent(new Event("click"));
|
|
@@ -945,8 +923,6 @@ describe("form", () => {
|
|
|
945
923
|
'<form name="otherForm"></form>',
|
|
946
924
|
)(scope);
|
|
947
925
|
|
|
948
|
-
scope.$digest();
|
|
949
|
-
|
|
950
926
|
const form = scope.myForm;
|
|
951
927
|
const { otherForm } = scope;
|
|
952
928
|
const { childForm } = form;
|
|
@@ -960,15 +936,11 @@ describe("form", () => {
|
|
|
960
936
|
|
|
961
937
|
// rename the childForm
|
|
962
938
|
scope.formName = "childFormMoved";
|
|
963
|
-
scope.$digest();
|
|
964
|
-
|
|
965
939
|
expect(form.childFormMoved).toBeUndefined();
|
|
966
940
|
expect(otherForm.childForm).toBeUndefined();
|
|
967
941
|
expect(otherForm.childFormMoved).toBe(childForm);
|
|
968
942
|
|
|
969
943
|
scope.hasChildForm = false;
|
|
970
|
-
scope.$digest();
|
|
971
|
-
|
|
972
944
|
expect(form.childFormMoved).toBeUndefined();
|
|
973
945
|
expect(otherForm.childFormMoved).toBeUndefined();
|
|
974
946
|
});
|
|
@@ -1013,28 +985,23 @@ describe("form", () => {
|
|
|
1013
985
|
'<input ng-model="name" name="name" store-model-ctrl/>' +
|
|
1014
986
|
"</form>",
|
|
1015
987
|
)(scope);
|
|
1016
|
-
|
|
1017
|
-
scope.$digest();
|
|
1018
988
|
});
|
|
1019
989
|
|
|
1020
990
|
it("should have ng-valid/ng-invalid css class", () => {
|
|
1021
991
|
expect(doc[0].classList.contains("ng-valid")).toBeTrue();
|
|
1022
992
|
|
|
1023
993
|
control.$setValidity("error", false);
|
|
1024
|
-
scope.$digest();
|
|
1025
994
|
expect(doc[0].classList.contains("ng-invalid")).toBeTrue();
|
|
1026
995
|
expect(doc[0].classList.contains("ng-valid-error")).toBe(false);
|
|
1027
996
|
expect(doc[0].classList.contains("ng-invalid-error")).toBe(true);
|
|
1028
997
|
|
|
1029
998
|
control.$setValidity("another", false);
|
|
1030
|
-
scope.$digest();
|
|
1031
999
|
expect(doc[0].classList.contains("ng-valid-error")).toBe(false);
|
|
1032
1000
|
expect(doc[0].classList.contains("ng-invalid-error")).toBe(true);
|
|
1033
1001
|
expect(doc[0].classList.contains("ng-valid-another")).toBe(false);
|
|
1034
1002
|
expect(doc[0].classList.contains("ng-invalid-another")).toBe(true);
|
|
1035
1003
|
|
|
1036
1004
|
control.$setValidity("error", true);
|
|
1037
|
-
scope.$digest();
|
|
1038
1005
|
expect(doc[0].classList.contains("ng-invalid")).toBeTrue();
|
|
1039
1006
|
expect(doc[0].classList.contains("ng-valid-error")).toBe(true);
|
|
1040
1007
|
expect(doc[0].classList.contains("ng-invalid-error")).toBe(false);
|
|
@@ -1042,7 +1009,6 @@ describe("form", () => {
|
|
|
1042
1009
|
expect(doc[0].classList.contains("ng-invalid-another")).toBe(true);
|
|
1043
1010
|
|
|
1044
1011
|
control.$setValidity("another", true);
|
|
1045
|
-
scope.$digest();
|
|
1046
1012
|
expect(doc[0].classList.contains("ng-valid")).toBeTrue();
|
|
1047
1013
|
expect(doc[0].classList.contains("ng-valid-error")).toBe(true);
|
|
1048
1014
|
expect(doc[0].classList.contains("ng-invalid-error")).toBe(false);
|
|
@@ -1052,7 +1018,6 @@ describe("form", () => {
|
|
|
1052
1018
|
// validators are skipped, e.g. because of a parser error
|
|
1053
1019
|
control.$setValidity("error", null);
|
|
1054
1020
|
control.$setValidity("another", null);
|
|
1055
|
-
scope.$digest();
|
|
1056
1021
|
expect(doc[0].classList.contains("ng-valid-error")).toBe(false);
|
|
1057
1022
|
expect(doc[0].classList.contains("ng-invalid-error")).toBe(false);
|
|
1058
1023
|
expect(doc[0].classList.contains("ng-valid-another")).toBe(false);
|
|
@@ -1073,7 +1038,6 @@ describe("form", () => {
|
|
|
1073
1038
|
describe("$pending", () => {
|
|
1074
1039
|
beforeEach(() => {
|
|
1075
1040
|
doc = $compile('<form name="form"></form>')(scope);
|
|
1076
|
-
scope.$digest();
|
|
1077
1041
|
});
|
|
1078
1042
|
|
|
1079
1043
|
it("should set valid and invalid to undefined when a validation error state is set as pending", () => {
|
|
@@ -1110,8 +1074,6 @@ describe("form", () => {
|
|
|
1110
1074
|
"</form>",
|
|
1111
1075
|
)(scope);
|
|
1112
1076
|
|
|
1113
|
-
scope.$digest();
|
|
1114
|
-
|
|
1115
1077
|
const form = doc;
|
|
1116
1078
|
const formCtrl = scope.testForm;
|
|
1117
1079
|
const input1 = form.find("input").eq(0);
|
|
@@ -1127,8 +1089,6 @@ describe("form", () => {
|
|
|
1127
1089
|
expect(input2[0].classList.contains("ng-dirty")).toBeTrue();
|
|
1128
1090
|
|
|
1129
1091
|
formCtrl.$setPristine();
|
|
1130
|
-
scope.$digest();
|
|
1131
|
-
|
|
1132
1092
|
expect(form[0].classList.contains("ng-pristine")).toBeTrue();
|
|
1133
1093
|
expect(form[0].classList.contains("ng-dirty")).toBeFalse();
|
|
1134
1094
|
expect(formCtrl.$pristine).toBe(true);
|
|
@@ -1147,8 +1107,6 @@ describe("form", () => {
|
|
|
1147
1107
|
'<form name="testForm">' + '<input ng-model="anonymous">' + "</form>",
|
|
1148
1108
|
)(scope);
|
|
1149
1109
|
|
|
1150
|
-
scope.$digest();
|
|
1151
|
-
|
|
1152
1110
|
const form = doc;
|
|
1153
1111
|
const formCtrl = scope.testForm;
|
|
1154
1112
|
const input = form.find("input").eq(0);
|
|
@@ -1160,7 +1118,6 @@ describe("form", () => {
|
|
|
1160
1118
|
expect(input[0].classList.contains("ng-dirty")).toBeTrue();
|
|
1161
1119
|
|
|
1162
1120
|
formCtrl.$setPristine();
|
|
1163
|
-
scope.$digest();
|
|
1164
1121
|
expect(form[0].classList.contains("ng-pristine")).toBeTrue();
|
|
1165
1122
|
expect(formCtrl.$pristine).toBe(true);
|
|
1166
1123
|
expect(formCtrl.$dirty).toBe(false);
|
|
@@ -1178,8 +1135,6 @@ describe("form", () => {
|
|
|
1178
1135
|
"</form>",
|
|
1179
1136
|
)(scope);
|
|
1180
1137
|
|
|
1181
|
-
scope.$digest();
|
|
1182
|
-
|
|
1183
1138
|
const form = doc;
|
|
1184
1139
|
const formCtrl = scope.testForm;
|
|
1185
1140
|
const nestedForm = form.find("div");
|
|
@@ -1194,10 +1149,7 @@ describe("form", () => {
|
|
|
1194
1149
|
expect(nestedInput[0].classList.contains("ng-dirty")).toBeTrue();
|
|
1195
1150
|
|
|
1196
1151
|
formCtrl.$setPristine();
|
|
1197
|
-
scope.$digest();
|
|
1198
1152
|
expect(form[0].classList.contains("ng-pristine")).toBeTrue();
|
|
1199
|
-
scope.$digest();
|
|
1200
|
-
|
|
1201
1153
|
expect(formCtrl.$pristine).toBe(true);
|
|
1202
1154
|
expect(formCtrl.$dirty).toBe(false);
|
|
1203
1155
|
expect(nestedForm[0].classList.contains("ng-pristine")).toBeTrue();
|
|
@@ -1216,8 +1168,6 @@ describe("form", () => {
|
|
|
1216
1168
|
'<input name="alias" type="text" ng-model="name" />' +
|
|
1217
1169
|
"</form>",
|
|
1218
1170
|
)(scope);
|
|
1219
|
-
scope.$digest();
|
|
1220
|
-
|
|
1221
1171
|
scope.myForm.alias.$setTouched();
|
|
1222
1172
|
expect(scope.myForm.alias.$touched).toBe(true);
|
|
1223
1173
|
scope.myForm.$setUntouched();
|
|
@@ -1233,8 +1183,6 @@ describe("form", () => {
|
|
|
1233
1183
|
"</div>" +
|
|
1234
1184
|
"</form>",
|
|
1235
1185
|
)(scope);
|
|
1236
|
-
scope.$digest();
|
|
1237
|
-
|
|
1238
1186
|
scope.myForm.childForm.alias.$setTouched();
|
|
1239
1187
|
expect(scope.myForm.childForm.alias.$touched).toBe(true);
|
|
1240
1188
|
scope.myForm.$setUntouched();
|
|
@@ -1247,8 +1195,6 @@ describe("form", () => {
|
|
|
1247
1195
|
it("should return an empty array if the controller has no controls", () => {
|
|
1248
1196
|
doc = $compile('<form name="testForm"></form>')(scope);
|
|
1249
1197
|
|
|
1250
|
-
scope.$digest();
|
|
1251
|
-
|
|
1252
1198
|
const formCtrl = scope.testForm;
|
|
1253
1199
|
|
|
1254
1200
|
expect(formCtrl.$getControls()).toEqual([]);
|
|
@@ -1264,8 +1210,6 @@ describe("form", () => {
|
|
|
1264
1210
|
"</form>",
|
|
1265
1211
|
)(scope);
|
|
1266
1212
|
|
|
1267
|
-
scope.$digest();
|
|
1268
|
-
|
|
1269
1213
|
const form = doc;
|
|
1270
1214
|
const formCtrl = scope.testForm;
|
|
1271
1215
|
const formInput = form.children("input").eq(0);
|
|
@@ -1304,7 +1248,6 @@ describe("form", () => {
|
|
|
1304
1248
|
"</form>",
|
|
1305
1249
|
)(scope);
|
|
1306
1250
|
|
|
1307
|
-
scope.$digest();
|
|
1308
1251
|
const formA = scope.form.nestedA;
|
|
1309
1252
|
expect(formA).toBeDefined();
|
|
1310
1253
|
expect(formA.$name).toBe("nestedA");
|
|
@@ -1315,8 +1258,6 @@ describe("form", () => {
|
|
|
1315
1258
|
|
|
1316
1259
|
scope.idA = "B";
|
|
1317
1260
|
scope.idB = "Y";
|
|
1318
|
-
scope.$digest();
|
|
1319
|
-
|
|
1320
1261
|
expect(scope.form.nestedA).toBeUndefined();
|
|
1321
1262
|
expect(scope.form.nestedB).toBe(formA);
|
|
1322
1263
|
expect(formA.nestedX).toBeUndefined();
|
|
@@ -1327,7 +1268,6 @@ describe("form", () => {
|
|
|
1327
1268
|
const element = $compile('<form name="name{{nameID}}"></form>')(scope);
|
|
1328
1269
|
const element2 = $compile('<div ng-form="ngform{{nameID}}"></div>')(scope);
|
|
1329
1270
|
scope.nameID = "A";
|
|
1330
|
-
scope.$digest();
|
|
1331
1271
|
const form = element.controller("form");
|
|
1332
1272
|
const form2 = element2.controller("form");
|
|
1333
1273
|
expect(scope.nameA).toBe(form);
|
|
@@ -1336,7 +1276,6 @@ describe("form", () => {
|
|
|
1336
1276
|
expect(form2.$name).toBe("ngformA");
|
|
1337
1277
|
|
|
1338
1278
|
scope.nameID = "B";
|
|
1339
|
-
scope.$digest();
|
|
1340
1279
|
expect(scope.nameA).toBeUndefined();
|
|
1341
1280
|
expect(scope.ngformA).toBeUndefined();
|
|
1342
1281
|
expect(scope.nameB).toBe(form);
|
|
@@ -1347,12 +1286,10 @@ describe("form", () => {
|
|
|
1347
1286
|
|
|
1348
1287
|
it("should rename forms with an initially blank name", () => {
|
|
1349
1288
|
const element = $compile('<form name="{{name}}"></form>')(scope);
|
|
1350
|
-
scope.$digest();
|
|
1351
1289
|
const form = element.controller("form");
|
|
1352
1290
|
expect(scope[""]).toBe(form);
|
|
1353
1291
|
expect(form.$name).toBe("");
|
|
1354
1292
|
scope.name = "foo";
|
|
1355
|
-
scope.$digest();
|
|
1356
1293
|
expect(scope.foo).toBe(form);
|
|
1357
1294
|
expect(form.$name).toBe("foo");
|
|
1358
1295
|
expect(scope.foo).toBe(form);
|
|
@@ -1366,8 +1303,6 @@ describe("form", () => {
|
|
|
1366
1303
|
'<input type="submit" />' +
|
|
1367
1304
|
"</form>",
|
|
1368
1305
|
)(scope);
|
|
1369
|
-
|
|
1370
|
-
scope.$digest();
|
|
1371
1306
|
});
|
|
1372
1307
|
|
|
1373
1308
|
it("should not init in submitted state", () => {
|
|
@@ -146,8 +146,6 @@ describe("ngIf", () => {
|
|
|
146
146
|
});
|
|
147
147
|
injector = angular.bootstrap(element, ["myModule"]);
|
|
148
148
|
|
|
149
|
-
$rootScope.$digest();
|
|
150
|
-
|
|
151
149
|
setTimeout(() => {
|
|
152
150
|
expect(element.text()).toBe("Hello");
|
|
153
151
|
done();
|
|
@@ -212,7 +210,6 @@ describe("ngIf", () => {
|
|
|
212
210
|
|
|
213
211
|
it("should not trigger a digest when the element is removed", () => {
|
|
214
212
|
const spy = spyOn($rootScope, "$digest").and.callThrough();
|
|
215
|
-
let $timeout = injector.get("$timeout");
|
|
216
213
|
$scope.hello = true;
|
|
217
214
|
makeIf("hello");
|
|
218
215
|
expect(element.children().length).toBe(1);
|
|
@@ -268,7 +265,6 @@ describe("ngIf", () => {
|
|
|
268
265
|
const element = $compile('<iso><span ng-bind="val"></span></iso>')(
|
|
269
266
|
$rootScope,
|
|
270
267
|
);
|
|
271
|
-
$rootScope.$digest();
|
|
272
268
|
expect(element.text().trim()).toEqual(
|
|
273
269
|
"val=value in iso scope-transcluded content",
|
|
274
270
|
);
|
|
@@ -41,7 +41,6 @@ describe("ngInclude", () => {
|
|
|
41
41
|
);
|
|
42
42
|
const injector = angular.bootstrap(element);
|
|
43
43
|
$rootScope = injector.get("$rootScope");
|
|
44
|
-
$rootScope.$digest();
|
|
45
44
|
setTimeout(() => {
|
|
46
45
|
expect(element.text()).toEqual("hello");
|
|
47
46
|
dealoc($rootScope);
|
|
@@ -57,7 +56,6 @@ describe("ngInclude", () => {
|
|
|
57
56
|
$rootScope.fooUrl = $sce.trustAsResourceUrl(
|
|
58
57
|
"http://localhost:4000/mock/hello",
|
|
59
58
|
);
|
|
60
|
-
$rootScope.$digest();
|
|
61
59
|
await wait(100);
|
|
62
60
|
expect(element.text()).toEqual("Hello");
|
|
63
61
|
dealoc($rootScope);
|
|
@@ -73,7 +71,6 @@ describe("ngInclude", () => {
|
|
|
73
71
|
$templateCache.set("myUrl", [200, "{{name}}", {}]);
|
|
74
72
|
$rootScope.name = "misko";
|
|
75
73
|
$rootScope.url = "myUrl";
|
|
76
|
-
$rootScope.$digest();
|
|
77
74
|
expect(body.text()).toEqual("misko");
|
|
78
75
|
body.empty();
|
|
79
76
|
dealoc($rootScope);
|
|
@@ -85,8 +82,6 @@ describe("ngInclude", () => {
|
|
|
85
82
|
$rootScope = injector.get("$rootScope");
|
|
86
83
|
$rootScope.expr = "Alibaba";
|
|
87
84
|
$rootScope.url = "/mock/interpolation";
|
|
88
|
-
$rootScope.$digest();
|
|
89
|
-
|
|
90
85
|
setTimeout(() => {
|
|
91
86
|
expect(element.text()).toEqual("Alibaba");
|
|
92
87
|
done();
|
|
@@ -98,9 +93,7 @@ describe("ngInclude", () => {
|
|
|
98
93
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
99
94
|
$rootScope = injector.get("$rootScope");
|
|
100
95
|
$rootScope.url = "http://example.com/myUrl";
|
|
101
|
-
expect(() => {
|
|
102
|
-
$rootScope.$digest();
|
|
103
|
-
}).toThrowError(/insecurl/);
|
|
96
|
+
expect(() => {}).toThrowError(/insecurl/);
|
|
104
97
|
});
|
|
105
98
|
|
|
106
99
|
it("should NOT use mistyped expressions ", () => {
|
|
@@ -110,9 +103,7 @@ describe("ngInclude", () => {
|
|
|
110
103
|
$rootScope.name = "chirayu";
|
|
111
104
|
let $sce = injector.get("$sce");
|
|
112
105
|
$rootScope.url = $sce.trustAsUrl("http://example.com/myUrl");
|
|
113
|
-
expect(() => {
|
|
114
|
-
$rootScope.$digest();
|
|
115
|
-
}).toThrowError(/insecurl/);
|
|
106
|
+
expect(() => {}).toThrowError(/insecurl/);
|
|
116
107
|
});
|
|
117
108
|
|
|
118
109
|
it("should remove previously included text if a falsy value is bound to src", (done) => {
|
|
@@ -121,11 +112,9 @@ describe("ngInclude", () => {
|
|
|
121
112
|
$rootScope = injector.get("$rootScope");
|
|
122
113
|
$rootScope.expr = "igor";
|
|
123
114
|
$rootScope.url = "/mock/interpolation";
|
|
124
|
-
$rootScope.$digest();
|
|
125
115
|
setTimeout(() => {
|
|
126
116
|
expect(element.text()).toEqual("igor");
|
|
127
117
|
$rootScope.url = undefined;
|
|
128
|
-
$rootScope.$digest();
|
|
129
118
|
}, 100);
|
|
130
119
|
setTimeout(() => {
|
|
131
120
|
expect(element.text()).toEqual("");
|
|
@@ -148,8 +137,6 @@ describe("ngInclude", () => {
|
|
|
148
137
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
149
138
|
$rootScope = injector.get("$rootScope");
|
|
150
139
|
$rootScope.url = "/mock/interpolation";
|
|
151
|
-
$rootScope.$digest();
|
|
152
|
-
|
|
153
140
|
setTimeout(() => {
|
|
154
141
|
expect(called).toBe(true);
|
|
155
142
|
done();
|
|
@@ -171,8 +158,6 @@ describe("ngInclude", () => {
|
|
|
171
158
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
172
159
|
$rootScope = injector.get("$rootScope");
|
|
173
160
|
$rootScope.url = "/mock/interpolation";
|
|
174
|
-
$rootScope.$digest();
|
|
175
|
-
|
|
176
161
|
setTimeout(() => {
|
|
177
162
|
expect(called).toBe(true);
|
|
178
163
|
done();
|
|
@@ -195,8 +180,6 @@ describe("ngInclude", () => {
|
|
|
195
180
|
|
|
196
181
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
197
182
|
$rootScope = injector.get("$rootScope");
|
|
198
|
-
$rootScope.$digest();
|
|
199
|
-
|
|
200
183
|
setTimeout(() => {
|
|
201
184
|
expect(contentLoadedSpy).not.toHaveBeenCalled();
|
|
202
185
|
expect(contentErrorSpy).toHaveBeenCalled();
|
|
@@ -212,12 +195,8 @@ describe("ngInclude", () => {
|
|
|
212
195
|
);
|
|
213
196
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
214
197
|
$rootScope = injector.get("$rootScope");
|
|
215
|
-
$rootScope.$digest();
|
|
216
|
-
|
|
217
198
|
expect($rootScope.loaded).not.toBeDefined();
|
|
218
199
|
$rootScope.url = "/mock/hello";
|
|
219
|
-
$rootScope.$digest();
|
|
220
|
-
|
|
221
200
|
setTimeout(() => {
|
|
222
201
|
expect(element.text()).toEqual("Hello");
|
|
223
202
|
expect($rootScope.loaded).toBe(true);
|
|
@@ -231,18 +210,14 @@ describe("ngInclude", () => {
|
|
|
231
210
|
element = JQLite('<div><ng-include src="url"></ng-include></div>');
|
|
232
211
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
233
212
|
$rootScope = injector.get("$rootScope");
|
|
234
|
-
$rootScope.$digest();
|
|
235
213
|
expect($rootScope.$$childHead).toBeFalsy();
|
|
236
214
|
|
|
237
215
|
$rootScope.url = "/mock/hello";
|
|
238
|
-
$rootScope.$digest();
|
|
239
|
-
|
|
240
216
|
setTimeout(() => {
|
|
241
217
|
expect($rootScope.$$childHead.$parent).toBe($rootScope);
|
|
242
218
|
expect(element.text()).toBe("Hello");
|
|
243
219
|
|
|
244
220
|
$rootScope.url = "/mock/401";
|
|
245
|
-
$rootScope.$digest();
|
|
246
221
|
}, 100);
|
|
247
222
|
|
|
248
223
|
setTimeout(() => {
|
|
@@ -250,14 +225,12 @@ describe("ngInclude", () => {
|
|
|
250
225
|
expect(element.text()).toBe("");
|
|
251
226
|
|
|
252
227
|
$rootScope.url = "/mock/hello";
|
|
253
|
-
$rootScope.$digest();
|
|
254
228
|
}, 200);
|
|
255
229
|
|
|
256
230
|
setTimeout(() => {
|
|
257
231
|
expect($rootScope.$$childHead.$parent).toBe($rootScope);
|
|
258
232
|
|
|
259
233
|
$rootScope.url = null;
|
|
260
|
-
$rootScope.$digest();
|
|
261
234
|
}, 300);
|
|
262
235
|
|
|
263
236
|
setTimeout(() => {
|
|
@@ -272,16 +245,13 @@ describe("ngInclude", () => {
|
|
|
272
245
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
273
246
|
$rootScope = injector.get("$rootScope");
|
|
274
247
|
$rootScope.url = "/mock/hello";
|
|
275
|
-
$rootScope.$digest();
|
|
276
248
|
await wait(100);
|
|
277
249
|
|
|
278
250
|
expect(element.text()).toEqual("Hello");
|
|
279
251
|
$rootScope.url = null;
|
|
280
|
-
$rootScope.$digest();
|
|
281
252
|
await wait(100);
|
|
282
253
|
expect(element.text()).toEqual("");
|
|
283
254
|
$rootScope.url = "/mock/hello";
|
|
284
|
-
$rootScope.$digest();
|
|
285
255
|
// No request being made
|
|
286
256
|
expect(element.text()).toEqual("Hello");
|
|
287
257
|
});
|
|
@@ -292,7 +262,6 @@ describe("ngInclude", () => {
|
|
|
292
262
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
293
263
|
$rootScope = injector.get("$rootScope");
|
|
294
264
|
$rootScope.url = "/mock/401";
|
|
295
|
-
$rootScope.$digest();
|
|
296
265
|
expect(element.text()).toBe("");
|
|
297
266
|
});
|
|
298
267
|
|
|
@@ -310,7 +279,6 @@ describe("ngInclude", () => {
|
|
|
310
279
|
called++;
|
|
311
280
|
});
|
|
312
281
|
|
|
313
|
-
$rootScope.$digest();
|
|
314
282
|
setTimeout(() => {
|
|
315
283
|
expect(element.text()).toBe("Hello");
|
|
316
284
|
done();
|
|
@@ -325,10 +293,8 @@ describe("ngInclude", () => {
|
|
|
325
293
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
326
294
|
$rootScope = injector.get("$rootScope");
|
|
327
295
|
$rootScope.templateUrl = "/mock/hello";
|
|
328
|
-
$rootScope.$digest();
|
|
329
296
|
$rootScope.expr = "test";
|
|
330
297
|
$rootScope.templateUrl = "/mock/interpolation";
|
|
331
|
-
$rootScope.$digest();
|
|
332
298
|
expect(element.text()).toBe("");
|
|
333
299
|
|
|
334
300
|
setTimeout(() => {
|
|
@@ -346,21 +312,15 @@ describe("ngInclude", () => {
|
|
|
346
312
|
$rootScope = injector.get("$rootScope");
|
|
347
313
|
$rootScope.hrefUrl = "fooUrl1";
|
|
348
314
|
$rootScope.includeUrl = "/mock/hello";
|
|
349
|
-
$rootScope.$digest();
|
|
350
|
-
|
|
351
315
|
await wait(100);
|
|
352
316
|
expect(element.text()).toBe("Hello");
|
|
353
317
|
expect(element.find("span").attr("foo")).toBe("#/fooUrl1");
|
|
354
318
|
|
|
355
319
|
$rootScope.hrefUrl = "fooUrl2";
|
|
356
|
-
$rootScope.$digest();
|
|
357
|
-
|
|
358
320
|
expect(element.text()).toBe("Hello");
|
|
359
321
|
expect(element.find("span").attr("foo")).toBe("#/fooUrl2");
|
|
360
322
|
|
|
361
323
|
$rootScope.includeUrl = "/mock/hello2";
|
|
362
|
-
$rootScope.$digest();
|
|
363
|
-
|
|
364
324
|
await wait(100);
|
|
365
325
|
expect(element.text()).toBe("Hello2");
|
|
366
326
|
expect(element.find("span").attr("foo")).toBe("#/fooUrl2");
|
|
@@ -378,7 +338,6 @@ describe("ngInclude", () => {
|
|
|
378
338
|
element = JQLite("<svg><test></test></svg>");
|
|
379
339
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
380
340
|
$rootScope = injector.get("$rootScope");
|
|
381
|
-
$rootScope.$digest();
|
|
382
341
|
await wait(100);
|
|
383
342
|
const child = element.find("rect");
|
|
384
343
|
expect(child.length).toBe(2);
|
|
@@ -397,7 +356,6 @@ describe("ngInclude", () => {
|
|
|
397
356
|
element = JQLite("<svg><test></test></svg>");
|
|
398
357
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
399
358
|
$rootScope = injector.get("$rootScope");
|
|
400
|
-
$rootScope.$digest();
|
|
401
359
|
await wait(200);
|
|
402
360
|
expect(element.find("a").length).toBe(0);
|
|
403
361
|
});
|
|
@@ -410,10 +368,7 @@ describe("ngInclude", () => {
|
|
|
410
368
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
411
369
|
$rootScope = injector.get("$rootScope");
|
|
412
370
|
$rootScope.show = true;
|
|
413
|
-
$rootScope.$digest();
|
|
414
371
|
$rootScope.show = false;
|
|
415
|
-
$rootScope.$digest();
|
|
416
|
-
|
|
417
372
|
setTimeout(() => {
|
|
418
373
|
expect(element.text()).toBe("");
|
|
419
374
|
done();
|
|
@@ -428,8 +383,6 @@ describe("ngInclude", () => {
|
|
|
428
383
|
const spy = spyOn($rootScope, "$digest").and.callThrough();
|
|
429
384
|
|
|
430
385
|
$rootScope.url = "/mock/hello";
|
|
431
|
-
$rootScope.$digest();
|
|
432
|
-
|
|
433
386
|
setTimeout(() => {
|
|
434
387
|
expect(element.text()).toEqual("Hello");
|
|
435
388
|
$rootScope.$apply('url = "/mock/hello2"');
|
|
@@ -491,8 +444,6 @@ describe("ngInclude", () => {
|
|
|
491
444
|
$rootScope.value = true;
|
|
492
445
|
});
|
|
493
446
|
|
|
494
|
-
$rootScope.$digest();
|
|
495
|
-
|
|
496
447
|
setTimeout(() => {
|
|
497
448
|
expect(autoScrollSpy).toHaveBeenCalled();
|
|
498
449
|
done();
|
|
@@ -514,8 +465,6 @@ describe("ngInclude", () => {
|
|
|
514
465
|
$rootScope.$apply(() => {
|
|
515
466
|
$rootScope.tpl = "/mock/hello";
|
|
516
467
|
});
|
|
517
|
-
$rootScope.$digest();
|
|
518
|
-
|
|
519
468
|
setTimeout(() => {
|
|
520
469
|
expect(autoScrollSpy).not.toHaveBeenCalled();
|
|
521
470
|
done();
|
|
@@ -568,7 +517,7 @@ describe("ngInclude", () => {
|
|
|
568
517
|
// expect($animate.queue.shift().event).toBe("enter");
|
|
569
518
|
|
|
570
519
|
// $animate.flush();
|
|
571
|
-
//
|
|
520
|
+
// ;
|
|
572
521
|
|
|
573
522
|
// expect(autoScrollSpy).toHaveBeenCalled();
|
|
574
523
|
// },
|
|
@@ -714,7 +663,7 @@ describe("ngInclude", () => {
|
|
|
714
663
|
// element = $compile(
|
|
715
664
|
// html("<div><div " + 'ng-include="tpl">' + "</div></div>"),
|
|
716
665
|
// )($rootScope);
|
|
717
|
-
//
|
|
666
|
+
// ;
|
|
718
667
|
|
|
719
668
|
// const animation = $animate.queue.pop();
|
|
720
669
|
// expect(animation.event).toBe("enter");
|
|
@@ -728,14 +677,14 @@ describe("ngInclude", () => {
|
|
|
728
677
|
// element = $compile(
|
|
729
678
|
// html("<div><div " + 'ng-include="tpl">' + "</div></div>"),
|
|
730
679
|
// )($rootScope);
|
|
731
|
-
//
|
|
680
|
+
// ;
|
|
732
681
|
|
|
733
682
|
// let animation = $animate.queue.shift();
|
|
734
683
|
// expect(animation.event).toBe("enter");
|
|
735
684
|
// expect(animation.element.text()).toBe("data");
|
|
736
685
|
|
|
737
686
|
// $rootScope.tpl = "";
|
|
738
|
-
//
|
|
687
|
+
// ;
|
|
739
688
|
|
|
740
689
|
// animation = $animate.queue.shift();
|
|
741
690
|
// expect(animation.event).toBe("leave");
|
|
@@ -750,13 +699,13 @@ describe("ngInclude", () => {
|
|
|
750
699
|
// element = $compile(
|
|
751
700
|
// html("<div><div " + 'ng-include="tpl">' + "</div></div>"),
|
|
752
701
|
// )($rootScope);
|
|
753
|
-
//
|
|
702
|
+
// ;
|
|
754
703
|
|
|
755
704
|
// const item1 = $animate.queue.shift().element;
|
|
756
705
|
// expect(item1.text()).toBe("one");
|
|
757
706
|
|
|
758
707
|
// $rootScope.tpl = "two";
|
|
759
|
-
//
|
|
708
|
+
// ;
|
|
760
709
|
|
|
761
710
|
// const itemA = $animate.queue.shift().element;
|
|
762
711
|
// const itemB = $animate.queue.shift().element;
|
|
@@ -6,8 +6,12 @@ export function ngInitDirective() {
|
|
|
6
6
|
priority: 450,
|
|
7
7
|
compile() {
|
|
8
8
|
return {
|
|
9
|
-
pre(scope,
|
|
10
|
-
|
|
9
|
+
pre(scope, element, attrs) {
|
|
10
|
+
if (element.controller()) {
|
|
11
|
+
element.controller().$eval(attrs.ngInit);
|
|
12
|
+
} else {
|
|
13
|
+
scope.$eval(attrs.ngInit);
|
|
14
|
+
}
|
|
11
15
|
},
|
|
12
16
|
};
|
|
13
17
|
},
|
|
@@ -39,7 +39,6 @@ describe("ngInit", () => {
|
|
|
39
39
|
});
|
|
40
40
|
injector = angular.bootstrap(element, ["myModule"]);
|
|
41
41
|
$rootScope = injector.get("$rootScope");
|
|
42
|
-
$rootScope.$digest();
|
|
43
42
|
expect($rootScope.template).toEqual("template2.tpl");
|
|
44
43
|
setTimeout(() => {
|
|
45
44
|
expect(element.find("span").text()).toEqual("2");
|
|
@@ -59,7 +58,6 @@ describe("ngInit", () => {
|
|
|
59
58
|
'<div><div ng-controller="TestCtrl" ' +
|
|
60
59
|
'ng-init="test=123"></div></div>',
|
|
61
60
|
)($rootScope);
|
|
62
|
-
$rootScope.$digest();
|
|
63
61
|
expect($rootScope.test).toBeUndefined();
|
|
64
62
|
expect($rootScope.$$childHead.test).toEqual(123);
|
|
65
63
|
});
|