@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
|
@@ -50,10 +50,8 @@ describe("ngStateRef", () => {
|
|
|
50
50
|
$injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
51
51
|
"defaultModule",
|
|
52
52
|
]);
|
|
53
|
-
$q = $injector.get("$q");
|
|
54
53
|
$rootScope = $injector.get("$rootScope");
|
|
55
54
|
$compile = $injector.get("$compile");
|
|
56
|
-
$timeout = $injector.get("$timeout");
|
|
57
55
|
$state = $injector.get("$state");
|
|
58
56
|
$stateParams = $injector.get("$stateParams");
|
|
59
57
|
$urlService = $injector.get("$urlService");
|
|
@@ -74,7 +72,6 @@ describe("ngStateRef", () => {
|
|
|
74
72
|
defer.resolve({ id: 6 });
|
|
75
73
|
el = $compile(el)($rootScope);
|
|
76
74
|
|
|
77
|
-
$rootScope.$digest();
|
|
78
75
|
expect(el.attr("href")).toBe("#/contacts/6");
|
|
79
76
|
});
|
|
80
77
|
});
|
|
@@ -91,7 +88,6 @@ describe("ngStateRef", () => {
|
|
|
91
88
|
|
|
92
89
|
$compile(el)(scope);
|
|
93
90
|
$compile(el2)(scope);
|
|
94
|
-
scope.$digest();
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
describe("links", () => {
|
|
@@ -118,7 +114,6 @@ describe("ngStateRef", () => {
|
|
|
118
114
|
$rootScope.$apply();
|
|
119
115
|
|
|
120
116
|
$compile(el)($rootScope);
|
|
121
|
-
$rootScope.$digest();
|
|
122
117
|
expect(el.attr("href")).toBe("#/contacts/3");
|
|
123
118
|
});
|
|
124
119
|
|
|
@@ -194,12 +189,8 @@ describe("ngStateRef", () => {
|
|
|
194
189
|
it("should allow passing params to current state", async () => {
|
|
195
190
|
$state.go("other", { id: "abc" });
|
|
196
191
|
$rootScope.$index = "def";
|
|
197
|
-
$rootScope.$digest();
|
|
198
|
-
|
|
199
192
|
el = JQLite('<a ng-sref="{id: $index}">Details</a>');
|
|
200
193
|
$compile(el)($rootScope);
|
|
201
|
-
$rootScope.$digest();
|
|
202
|
-
|
|
203
194
|
expect($state.current.name).toBe("other");
|
|
204
195
|
expect($state.params.id).toEqual("abc");
|
|
205
196
|
expect(el.attr("href")).toBe("#/other/def");
|
|
@@ -211,8 +202,6 @@ describe("ngStateRef", () => {
|
|
|
211
202
|
|
|
212
203
|
$rootScope.$index = "ghi";
|
|
213
204
|
$state.go("other.detail");
|
|
214
|
-
$rootScope.$digest();
|
|
215
|
-
|
|
216
205
|
expect($state.current.name).toBe("other.detail");
|
|
217
206
|
expect($state.params.id).toEqual("def");
|
|
218
207
|
|
|
@@ -226,14 +215,11 @@ describe("ngStateRef", () => {
|
|
|
226
215
|
|
|
227
216
|
it("should allow multi-line attribute values when passing params to current state", async () => {
|
|
228
217
|
$state.go("contacts.item.detail", { id: "123" });
|
|
229
|
-
$rootScope.$digest();
|
|
230
|
-
|
|
231
218
|
el = JQLite('<a ng-sref="{\n\tid: $index\n}">Details</a>');
|
|
232
219
|
$rootScope.$index = 3;
|
|
233
220
|
$rootScope.$apply();
|
|
234
221
|
|
|
235
222
|
$compile(el)($rootScope);
|
|
236
|
-
$rootScope.$digest();
|
|
237
223
|
expect(el.attr("href")).toBe("#/contacts/3");
|
|
238
224
|
});
|
|
239
225
|
|
|
@@ -244,13 +230,11 @@ describe("ngStateRef", () => {
|
|
|
244
230
|
template = $compile(el)($rootScope);
|
|
245
231
|
|
|
246
232
|
$rootScope.urlParams = { id: 1 };
|
|
247
|
-
$rootScope.$digest();
|
|
248
233
|
expect(JQLite(template[0].querySelector("a")).attr("href")).toBe(
|
|
249
234
|
"#/contacts/1",
|
|
250
235
|
);
|
|
251
236
|
|
|
252
237
|
$rootScope.urlParams.id = 2;
|
|
253
|
-
$rootScope.$digest();
|
|
254
238
|
expect(JQLite(template[0].querySelector("a")).attr("href")).toBe(
|
|
255
239
|
"#/contacts/2",
|
|
256
240
|
);
|
|
@@ -300,7 +284,6 @@ describe("ngStateRef", () => {
|
|
|
300
284
|
scope = $rootScope;
|
|
301
285
|
Object.assign(scope, { state: "contacts", params: {} });
|
|
302
286
|
template = $compile(el)(scope);
|
|
303
|
-
scope.$digest();
|
|
304
287
|
});
|
|
305
288
|
|
|
306
289
|
it("sets the correct initial href", () => {
|
|
@@ -312,11 +295,9 @@ describe("ngStateRef", () => {
|
|
|
312
295
|
|
|
313
296
|
scope.state = "contacts.item";
|
|
314
297
|
scope.params = { id: 5 };
|
|
315
|
-
scope.$digest();
|
|
316
298
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/5");
|
|
317
299
|
|
|
318
300
|
scope.params.id = 25;
|
|
319
|
-
scope.$digest();
|
|
320
301
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/25");
|
|
321
302
|
});
|
|
322
303
|
|
|
@@ -325,31 +306,26 @@ describe("ngStateRef", () => {
|
|
|
325
306
|
expect(template[0].className).not.toContain("activeeq");
|
|
326
307
|
|
|
327
308
|
$state.go("contacts");
|
|
328
|
-
scope.$digest();
|
|
329
309
|
await wait(100);
|
|
330
310
|
expect(template[0].className).toContain("active activeeq");
|
|
331
311
|
|
|
332
312
|
scope.state = "contacts.item";
|
|
333
313
|
scope.params = { id: 5 };
|
|
334
|
-
scope.$digest();
|
|
335
314
|
await wait(100);
|
|
336
315
|
expect(template[0].className).not.toContain("active");
|
|
337
316
|
expect(template[0].className).not.toContain("activeeq");
|
|
338
317
|
|
|
339
318
|
$state.go("contacts.item", { id: -5 });
|
|
340
|
-
scope.$digest();
|
|
341
319
|
await wait(100);
|
|
342
320
|
expect(template[0].className).not.toContain("active");
|
|
343
321
|
expect(template[0].className).not.toContain("activeeq");
|
|
344
322
|
|
|
345
323
|
$state.go("contacts.item", { id: 5 });
|
|
346
|
-
scope.$digest();
|
|
347
324
|
await wait(100);
|
|
348
325
|
expect(template[0].className).toContain("active activeeq");
|
|
349
326
|
|
|
350
327
|
scope.state = "contacts";
|
|
351
328
|
scope.params = {};
|
|
352
|
-
scope.$digest();
|
|
353
329
|
await wait(100);
|
|
354
330
|
expect(template[0].className).toContain("active");
|
|
355
331
|
expect(template[0].className).not.toContain("activeeq");
|
|
@@ -359,15 +335,12 @@ describe("ngStateRef", () => {
|
|
|
359
335
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts");
|
|
360
336
|
scope.state = "other";
|
|
361
337
|
scope.params = { id: "123" };
|
|
362
|
-
scope.$digest();
|
|
363
338
|
expect(JQLite(template[0]).attr("href")).toBe("#/other/123");
|
|
364
339
|
});
|
|
365
340
|
|
|
366
341
|
it("should allow passing params to current state using empty ng-state", async () => {
|
|
367
342
|
await $state.go("other", { id: "abc" });
|
|
368
343
|
$rootScope.$index = "def";
|
|
369
|
-
$rootScope.$digest();
|
|
370
|
-
|
|
371
344
|
el = JQLite('<a ng-state="" ng-state-params="{id: $index}">Details</a>');
|
|
372
345
|
$compile(el)($rootScope);
|
|
373
346
|
|
|
@@ -383,8 +356,6 @@ describe("ngStateRef", () => {
|
|
|
383
356
|
|
|
384
357
|
$rootScope.$index = "ghi";
|
|
385
358
|
await $state.go("other.detail");
|
|
386
|
-
$rootScope.$digest();
|
|
387
|
-
|
|
388
359
|
expect($state.current.name).toBe("other.detail");
|
|
389
360
|
expect($state.params.id).toEqual("def");
|
|
390
361
|
|
|
@@ -400,25 +371,21 @@ describe("ngStateRef", () => {
|
|
|
400
371
|
it("retains the old href if the new points to a non-state", () => {
|
|
401
372
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts");
|
|
402
373
|
scope.state = "nostate";
|
|
403
|
-
scope.$digest();
|
|
404
374
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts");
|
|
405
375
|
});
|
|
406
376
|
|
|
407
377
|
it("accepts param overrides", () => {
|
|
408
378
|
scope.state = "contacts.item";
|
|
409
379
|
scope.params = { id: 10 };
|
|
410
|
-
scope.$digest();
|
|
411
380
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/10");
|
|
412
381
|
});
|
|
413
382
|
|
|
414
383
|
it("accepts param overrides", () => {
|
|
415
384
|
scope.state = "contacts.item";
|
|
416
385
|
scope.params = { id: 10 };
|
|
417
|
-
scope.$digest();
|
|
418
386
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/10");
|
|
419
387
|
|
|
420
388
|
scope.params.id = 22;
|
|
421
|
-
scope.$digest();
|
|
422
389
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/22");
|
|
423
390
|
});
|
|
424
391
|
|
|
@@ -432,11 +399,9 @@ describe("ngStateRef", () => {
|
|
|
432
399
|
scope.state1 = "contacts.item";
|
|
433
400
|
scope.state2 = "other";
|
|
434
401
|
scope.params = { id: 10 };
|
|
435
|
-
scope.$digest();
|
|
436
402
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/10");
|
|
437
403
|
|
|
438
404
|
scope.exprvar = "state2";
|
|
439
|
-
scope.$digest();
|
|
440
405
|
expect(JQLite(template[0]).attr("href")).toBe("#/other/10");
|
|
441
406
|
});
|
|
442
407
|
|
|
@@ -446,13 +411,11 @@ describe("ngStateRef", () => {
|
|
|
446
411
|
scope.state = "contacts.item";
|
|
447
412
|
scope.params = { id: 10 };
|
|
448
413
|
template = $compile(el)(scope);
|
|
449
|
-
scope.$digest();
|
|
450
414
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/10");
|
|
451
415
|
|
|
452
416
|
scope.state = "other";
|
|
453
417
|
scope.params = { id: 22 };
|
|
454
418
|
|
|
455
|
-
scope.$digest();
|
|
456
419
|
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/10");
|
|
457
420
|
});
|
|
458
421
|
|
|
@@ -463,8 +426,6 @@ describe("ngStateRef", () => {
|
|
|
463
426
|
scope.state = "contacts";
|
|
464
427
|
scope.opts = { reload: true };
|
|
465
428
|
template = $compile(el)(scope);
|
|
466
|
-
scope.$digest();
|
|
467
|
-
|
|
468
429
|
spyOn($state, "go").and.callFake(function (state, params, options) {
|
|
469
430
|
transitionOptions = options;
|
|
470
431
|
});
|
|
@@ -496,8 +457,6 @@ describe("ngStateRef", () => {
|
|
|
496
457
|
|
|
497
458
|
scope.state = "contacts";
|
|
498
459
|
$compile(el)(scope);
|
|
499
|
-
scope.$digest();
|
|
500
|
-
|
|
501
460
|
browserTrigger(el, "change");
|
|
502
461
|
await wait(100);
|
|
503
462
|
|
|
@@ -511,15 +470,11 @@ describe("ngStateRef", () => {
|
|
|
511
470
|
|
|
512
471
|
scope.state = "contacts";
|
|
513
472
|
$compile(el)(scope);
|
|
514
|
-
scope.$digest();
|
|
515
|
-
|
|
516
473
|
browserTrigger(el, "change");
|
|
517
474
|
await wait(100);
|
|
518
475
|
expect($state.current.name).toEqual("contacts");
|
|
519
476
|
|
|
520
477
|
$state.go("top");
|
|
521
|
-
scope.$digest();
|
|
522
|
-
|
|
523
478
|
expect($state.current.name).toEqual("top");
|
|
524
479
|
|
|
525
480
|
browserTrigger(el, "blur");
|
|
@@ -535,15 +490,11 @@ describe("ngStateRef", () => {
|
|
|
535
490
|
|
|
536
491
|
scope.state = "contacts";
|
|
537
492
|
$compile(el)(scope);
|
|
538
|
-
scope.$digest();
|
|
539
|
-
|
|
540
493
|
browserTrigger(el, "mouseover");
|
|
541
494
|
await wait(100);
|
|
542
495
|
expect($state.current.name).toEqual("contacts");
|
|
543
496
|
|
|
544
497
|
$state.go("top");
|
|
545
|
-
scope.$digest();
|
|
546
|
-
|
|
547
498
|
expect($state.current.name).toEqual("top");
|
|
548
499
|
|
|
549
500
|
browserTrigger(el, "mousedown");
|
|
@@ -565,7 +516,6 @@ describe("ngStateRef", () => {
|
|
|
565
516
|
scope.$apply();
|
|
566
517
|
|
|
567
518
|
$compile(el)(scope);
|
|
568
|
-
scope.$digest();
|
|
569
519
|
});
|
|
570
520
|
|
|
571
521
|
it("should generate the correct action", () => {
|
|
@@ -637,7 +587,6 @@ describe("ngStateRef", () => {
|
|
|
637
587
|
it("should bind click event by default", async () => {
|
|
638
588
|
el = JQLite('<a ng-sref="contacts"></a>');
|
|
639
589
|
$compile(el)($rootScope);
|
|
640
|
-
$rootScope.$digest();
|
|
641
590
|
expect($state.current.name).toEqual("top");
|
|
642
591
|
|
|
643
592
|
browserTrigger(el, "click");
|
|
@@ -651,7 +600,6 @@ describe("ngStateRef", () => {
|
|
|
651
600
|
'<input type="text" ng-sref="contacts" ng-sref-opts="{ events: [\'change\'] }">',
|
|
652
601
|
);
|
|
653
602
|
$compile(el)($rootScope);
|
|
654
|
-
$rootScope.$digest();
|
|
655
603
|
expect($state.current.name).toEqual("top");
|
|
656
604
|
|
|
657
605
|
browserTrigger(el, "change");
|
|
@@ -665,7 +613,6 @@ describe("ngStateRef", () => {
|
|
|
665
613
|
'<input type="text" ng-sref="contacts" ng-sref-opts="{ events: [\'change\', \'blur\'] }">',
|
|
666
614
|
);
|
|
667
615
|
$compile(el)($rootScope);
|
|
668
|
-
$rootScope.$digest();
|
|
669
616
|
expect($state.current.name).toEqual("top");
|
|
670
617
|
|
|
671
618
|
browserTrigger(el, "change");
|
|
@@ -673,8 +620,6 @@ describe("ngStateRef", () => {
|
|
|
673
620
|
expect($state.current.name).toEqual("contacts");
|
|
674
621
|
|
|
675
622
|
await $state.go("top");
|
|
676
|
-
$rootScope.$digest();
|
|
677
|
-
|
|
678
623
|
expect($state.current.name).toEqual("top");
|
|
679
624
|
|
|
680
625
|
browserTrigger(el, "blur");
|
|
@@ -687,7 +632,6 @@ describe("ngStateRef", () => {
|
|
|
687
632
|
"<a ng-sref=\"contacts\" ng-sref-opts=\"{ events: ['mouseover', 'mousedown'] }\">",
|
|
688
633
|
);
|
|
689
634
|
$compile(el)($rootScope);
|
|
690
|
-
$rootScope.$digest();
|
|
691
635
|
expect($state.current.name).toEqual("top");
|
|
692
636
|
|
|
693
637
|
browserTrigger(el, "mouseover");
|
|
@@ -695,8 +639,6 @@ describe("ngStateRef", () => {
|
|
|
695
639
|
expect($state.current.name).toEqual("contacts");
|
|
696
640
|
|
|
697
641
|
await $state.go("top");
|
|
698
|
-
$rootScope.$digest();
|
|
699
|
-
|
|
700
642
|
expect($state.current.name).toEqual("top");
|
|
701
643
|
|
|
702
644
|
browserTrigger(el, "mousedown");
|
|
@@ -759,10 +701,8 @@ describe("ngSrefActive", () => {
|
|
|
759
701
|
$injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
760
702
|
"defaultModule",
|
|
761
703
|
]);
|
|
762
|
-
$q = $injector.get("$q");
|
|
763
704
|
$rootScope = $injector.get("$rootScope");
|
|
764
705
|
$compile = $injector.get("$compile");
|
|
765
|
-
$timeout = $injector.get("$timeout");
|
|
766
706
|
$state = $injector.get("$state");
|
|
767
707
|
$stateParams = $injector.get("$stateParams");
|
|
768
708
|
});
|
|
@@ -772,8 +712,6 @@ describe("ngSrefActive", () => {
|
|
|
772
712
|
'<div><a ng-sref="contacts.item({ id: 1 })" ng-sref-active="active">Contacts</a><a ng-sref="contacts.item({ id: 2 })" ng-sref-active="active">Contacts</a></div>',
|
|
773
713
|
);
|
|
774
714
|
template = $compile(el)($rootScope);
|
|
775
|
-
$rootScope.$digest();
|
|
776
|
-
|
|
777
715
|
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
778
716
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
779
717
|
await wait(100);
|
|
@@ -789,8 +727,6 @@ describe("ngSrefActive", () => {
|
|
|
789
727
|
'<div><a ng-sref="contacts.item.detail({ foo: \'bar\' })" ng-sref-active="active">Contacts</a></div>',
|
|
790
728
|
);
|
|
791
729
|
template = $compile(el)($rootScope);
|
|
792
|
-
$rootScope.$digest();
|
|
793
|
-
|
|
794
730
|
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
795
731
|
$state.transitionTo("contacts.item.detail", { id: 5, foo: "bar" });
|
|
796
732
|
await wait(100);
|
|
@@ -807,8 +743,6 @@ describe("ngSrefActive", () => {
|
|
|
807
743
|
'<div><a ng-sref="arrayparam({ foo: [1,2,3] })" ng-sref-active="active">foo 123</a></div>',
|
|
808
744
|
);
|
|
809
745
|
template = $compile(el)($rootScope);
|
|
810
|
-
$rootScope.$digest();
|
|
811
|
-
|
|
812
746
|
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
813
747
|
|
|
814
748
|
$state.transitionTo("arrayparam", { foo: [1, 2, 3] });
|
|
@@ -830,8 +764,6 @@ describe("ngSrefActive", () => {
|
|
|
830
764
|
'<div><a ng-sref="arrayparam({ foo: [1,2,3] })" ng-sref-active-eq="active">foo 123</a></div>',
|
|
831
765
|
);
|
|
832
766
|
template = $compile(el)($rootScope);
|
|
833
|
-
$rootScope.$digest();
|
|
834
|
-
|
|
835
767
|
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
836
768
|
|
|
837
769
|
$state.transitionTo("arrayparam", { foo: [1, 2, 3] });
|
|
@@ -853,15 +785,12 @@ describe("ngSrefActive", () => {
|
|
|
853
785
|
);
|
|
854
786
|
template = $compile(el)($rootScope);
|
|
855
787
|
$rootScope.fooId = "bar";
|
|
856
|
-
$rootScope.$digest();
|
|
857
|
-
|
|
858
788
|
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
859
789
|
$state.transitionTo("contacts.item.detail", { id: 5, foo: "bar" });
|
|
860
790
|
await wait(100);
|
|
861
791
|
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
862
792
|
|
|
863
793
|
$rootScope.fooId = "baz";
|
|
864
|
-
$rootScope.$digest();
|
|
865
794
|
await wait(100);
|
|
866
795
|
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
867
796
|
});
|
|
@@ -870,7 +799,6 @@ describe("ngSrefActive", () => {
|
|
|
870
799
|
template = $compile(
|
|
871
800
|
'<div><a ng-sref="contacts.item({ id: 1 })" ng-sref-active="active">Contacts</a></div>',
|
|
872
801
|
)($rootScope);
|
|
873
|
-
$rootScope.$digest();
|
|
874
802
|
const a = JQLite(template[0].getElementsByTagName("a")[0]);
|
|
875
803
|
|
|
876
804
|
$state.transitionTo("contacts.item.edit", { id: 1 });
|
|
@@ -888,7 +816,6 @@ describe("ngSrefActive", () => {
|
|
|
888
816
|
template = $compile(
|
|
889
817
|
'<div><a ng-sref="contacts.item({ id: 1 })" ng-sref-active-eq="active">Contacts</a></div>',
|
|
890
818
|
)($rootScope);
|
|
891
|
-
$rootScope.$digest();
|
|
892
819
|
const a = JQLite(template[0].getElementsByTagName("a")[0]);
|
|
893
820
|
|
|
894
821
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
@@ -904,7 +831,6 @@ describe("ngSrefActive", () => {
|
|
|
904
831
|
template = $compile(
|
|
905
832
|
'<div><a ng-sref="contacts.item({ id: 1 })" ng-sref-active="active" ng-sref-active-eq="active-eq">Contacts</a></div>',
|
|
906
833
|
)($rootScope);
|
|
907
|
-
$rootScope.$digest();
|
|
908
834
|
const a = JQLite(template[0].getElementsByTagName("a")[0]);
|
|
909
835
|
|
|
910
836
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
@@ -921,8 +847,6 @@ describe("ngSrefActive", () => {
|
|
|
921
847
|
it("should resolve relative state refs", async () => {
|
|
922
848
|
el = JQLite("<section><div ng-view></div></section>");
|
|
923
849
|
template = $compile(el)($rootScope);
|
|
924
|
-
$rootScope.$digest();
|
|
925
|
-
|
|
926
850
|
$state.transitionTo("contacts");
|
|
927
851
|
await wait(100);
|
|
928
852
|
expect(
|
|
@@ -943,8 +867,6 @@ describe("ngSrefActive", () => {
|
|
|
943
867
|
'<div ng-sref-active="active"><a ng-sref="contacts.item({ id: 1 })">Contacts</a><a ng-sref="contacts.item({ id: 2 })">Contacts</a></div>',
|
|
944
868
|
);
|
|
945
869
|
template = $compile(el)($rootScope);
|
|
946
|
-
$rootScope.$digest();
|
|
947
|
-
|
|
948
870
|
expect(JQLite(template[0]).attr("class")).toBeUndefined();
|
|
949
871
|
|
|
950
872
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
@@ -1006,7 +928,6 @@ describe("ngSrefActive", () => {
|
|
|
1006
928
|
template = $compile(
|
|
1007
929
|
'<div><a ng-sref="contacts.item({ id: 1 })" ng-sref-active="active also-active">Contacts</a></div>',
|
|
1008
930
|
)($rootScope);
|
|
1009
|
-
$rootScope.$digest();
|
|
1010
931
|
const a = JQLite(template[0].getElementsByTagName("a")[0]);
|
|
1011
932
|
|
|
1012
933
|
$state.transitionTo("contacts.item.edit", { id: 1 });
|
|
@@ -1031,7 +952,6 @@ describe("ngSrefActive", () => {
|
|
|
1031
952
|
template = $compile(
|
|
1032
953
|
'<div ng-sref-active="active"><a ng-sref="contacts.lazy.s1">Lazy</a></div><div ng-sref-active="active"><a ng-sref="contacts.lazy.s2"></a></div>',
|
|
1033
954
|
)($rootScope);
|
|
1034
|
-
$rootScope.$digest();
|
|
1035
955
|
$state.transitionTo("contacts.lazy.s1");
|
|
1036
956
|
await wait(100);
|
|
1037
957
|
|
|
@@ -1094,7 +1014,6 @@ describe("ngSrefActive", () => {
|
|
|
1094
1014
|
el = $compile("<div ng-sref-active=\"{active: 'admin.roles'}\"/>")(
|
|
1095
1015
|
$rootScope,
|
|
1096
1016
|
);
|
|
1097
|
-
$rootScope.$digest();
|
|
1098
1017
|
timeoutFlush();
|
|
1099
1018
|
expect(el.hasClass("active")).toBeTruthy();
|
|
1100
1019
|
});
|
|
@@ -1115,7 +1034,6 @@ describe("ngSrefActive", () => {
|
|
|
1115
1034
|
template = $compile(
|
|
1116
1035
|
'<div ng-sref-active="{ active: \'contacts.lazy.s1\' }"><a ng-sref="contacts.lazy.s1">Lazy</a></div><div ng-sref-active="{ active: \'contacts.lazy.s2\' }"></div>',
|
|
1117
1036
|
)($rootScope);
|
|
1118
|
-
$rootScope.$digest();
|
|
1119
1037
|
$state.transitionTo("contacts.lazy.s1");
|
|
1120
1038
|
await wait(100);
|
|
1121
1039
|
expect(template.eq(0).hasClass("active")).toBeTruthy();
|
|
@@ -1165,7 +1083,6 @@ describe("ngSrefActive", () => {
|
|
|
1165
1083
|
el = $compile(
|
|
1166
1084
|
"<div ng-sref-active=\"{active: ['admin.roles', 'admin.someOtherState']}\"/>",
|
|
1167
1085
|
)($rootScope);
|
|
1168
|
-
$rootScope.$digest();
|
|
1169
1086
|
timeoutFlush();
|
|
1170
1087
|
expect(el.hasClass("active")).toBeTruthy();
|
|
1171
1088
|
});
|
|
@@ -137,8 +137,7 @@ export let ngView = [
|
|
|
137
137
|
"$animate",
|
|
138
138
|
"$ngViewScroll",
|
|
139
139
|
"$interpolate",
|
|
140
|
-
|
|
141
|
-
function $ViewDirective($view, $animate, $ngViewScroll, $interpolate, $q) {
|
|
140
|
+
function $ViewDirective($view, $animate, $ngViewScroll, $interpolate) {
|
|
142
141
|
function getRenderer() {
|
|
143
142
|
return {
|
|
144
143
|
enter: function (element, target, cb) {
|
|
@@ -158,7 +157,7 @@ export let ngView = [
|
|
|
158
157
|
};
|
|
159
158
|
const directive = {
|
|
160
159
|
count: 0,
|
|
161
|
-
restrict: "
|
|
160
|
+
restrict: "EA",
|
|
162
161
|
terminal: true,
|
|
163
162
|
priority: 400,
|
|
164
163
|
transclude: "element",
|
|
@@ -237,6 +236,7 @@ export let ngView = [
|
|
|
237
236
|
}
|
|
238
237
|
function updateView(config) {
|
|
239
238
|
const newScope = scope.$new();
|
|
239
|
+
|
|
240
240
|
const animEnter = $q.defer(),
|
|
241
241
|
animLeave = $q.defer();
|
|
242
242
|
const $ngViewData = {
|
|
@@ -292,19 +292,12 @@ $ViewDirectiveFill.$inject = [
|
|
|
292
292
|
"$controller",
|
|
293
293
|
"$transitions",
|
|
294
294
|
"$view",
|
|
295
|
-
"$q",
|
|
296
295
|
];
|
|
297
|
-
export function $ViewDirectiveFill(
|
|
298
|
-
$compile,
|
|
299
|
-
$controller,
|
|
300
|
-
$transitions,
|
|
301
|
-
$view,
|
|
302
|
-
$q,
|
|
303
|
-
) {
|
|
296
|
+
export function $ViewDirectiveFill($compile, $controller, $transitions, $view) {
|
|
304
297
|
const getControllerAs = parse("viewDecl.controllerAs");
|
|
305
298
|
const getResolveAs = parse("viewDecl.resolveAs");
|
|
306
299
|
return {
|
|
307
|
-
restrict: "
|
|
300
|
+
restrict: "EA",
|
|
308
301
|
priority: -400,
|
|
309
302
|
compile: function (tElement) {
|
|
310
303
|
const initial = tElement.html();
|
|
@@ -373,7 +366,6 @@ export function $ViewDirectiveFill(
|
|
|
373
366
|
function (ctrlInstance) {
|
|
374
367
|
if (!ctrlInstance) return;
|
|
375
368
|
registerControllerCallbacks(
|
|
376
|
-
$q,
|
|
377
369
|
$transitions,
|
|
378
370
|
ctrlInstance,
|
|
379
371
|
scope,
|
|
@@ -393,7 +385,6 @@ export function $ViewDirectiveFill(
|
|
|
393
385
|
let _uiCanExitId = 0;
|
|
394
386
|
/** @ignore TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */
|
|
395
387
|
function registerControllerCallbacks(
|
|
396
|
-
$q,
|
|
397
388
|
$transitions,
|
|
398
389
|
controllerInstance,
|
|
399
390
|
$scope,
|
|
@@ -470,7 +461,7 @@ function registerControllerCallbacks(
|
|
|
470
461
|
let promise;
|
|
471
462
|
const ids = (trans[cacheProp] = trans[cacheProp] || {});
|
|
472
463
|
if (!prevTruthyAnswer(trans)) {
|
|
473
|
-
promise =
|
|
464
|
+
promise = Promise.resolve(controllerInstance.uiCanExit(trans));
|
|
474
465
|
promise.then((val) => (ids[id] = val !== false));
|
|
475
466
|
}
|
|
476
467
|
return promise;
|