@angular-wave/angular.ts 0.0.26 → 0.0.27
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 +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/index.html +3 -3
- package/package.json +1 -1
- package/src/router/globals.js +0 -5
- package/src/router/params/param-types.js +0 -3
- package/src/router/router.js +5 -53
- package/src/router/services.js +2 -4
- package/src/router/state/state-queue-manager.js +0 -3
- package/src/router/state/state-registry.js +0 -5
- package/src/router/state/state-service.js +0 -4
- package/src/router/transition/transition-hook.js +1 -8
- package/src/router/transition/transition-service.js +0 -12
- package/src/router/url/url-config.js +7 -7
- package/src/router/url/url-router.js +1 -1
- package/src/router/url/url-rules.js +0 -4
- package/src/router/url/url-service.js +113 -80
- package/test/core/interval.spec.js +1 -1
- package/test/router/state-directives.spec.js +72 -72
- package/test/router/state.spec.js +5 -5
- package/test/router/template-factory.spec.js +2 -2
- package/test/router/view-directive.spec.js +65 -65
- package/test/router/view-hook.spec.js +11 -11
- package/test/router/view-scroll.spec.js +2 -2
- package/test/router/view.spec.js +1 -1
- package/src/router/location-services.js +0 -67
|
@@ -122,7 +122,7 @@ describe("uiStateRef", () => {
|
|
|
122
122
|
|
|
123
123
|
it("should transition states when left-clicked", async () => {
|
|
124
124
|
browserTrigger(el, "click");
|
|
125
|
-
await wait(
|
|
125
|
+
await wait(200);
|
|
126
126
|
expect($state.current.name).toEqual("contacts.item.detail");
|
|
127
127
|
expect($stateParams.id).toEqual(5);
|
|
128
128
|
});
|
|
@@ -135,7 +135,7 @@ describe("uiStateRef", () => {
|
|
|
135
135
|
cancelable: true,
|
|
136
136
|
}),
|
|
137
137
|
);
|
|
138
|
-
await wait(
|
|
138
|
+
await wait(200);
|
|
139
139
|
expect($state.current.name).toEqual("top");
|
|
140
140
|
expect($stateParams.id).toBeUndefined();
|
|
141
141
|
});
|
|
@@ -281,7 +281,7 @@ describe("uiStateRef", () => {
|
|
|
281
281
|
|
|
282
282
|
// triggerClick(el2);
|
|
283
283
|
// timeoutFlush();
|
|
284
|
-
// await wait(
|
|
284
|
+
// await wait(100);
|
|
285
285
|
|
|
286
286
|
// expect($state.current.name).toEqual('top');
|
|
287
287
|
// expect(obj($stateParams)).toEqual({});
|
|
@@ -324,31 +324,31 @@ describe("uiStateRef", () => {
|
|
|
324
324
|
|
|
325
325
|
$state.go("contacts");
|
|
326
326
|
scope.$digest();
|
|
327
|
-
await wait(
|
|
327
|
+
await wait(100);
|
|
328
328
|
expect(template[0].className).toContain("active activeeq");
|
|
329
329
|
|
|
330
330
|
scope.state = "contacts.item";
|
|
331
331
|
scope.params = { id: 5 };
|
|
332
332
|
scope.$digest();
|
|
333
|
-
await wait(
|
|
333
|
+
await wait(100);
|
|
334
334
|
expect(template[0].className).not.toContain("active");
|
|
335
335
|
expect(template[0].className).not.toContain("activeeq");
|
|
336
336
|
|
|
337
337
|
$state.go("contacts.item", { id: -5 });
|
|
338
338
|
scope.$digest();
|
|
339
|
-
await wait(
|
|
339
|
+
await wait(100);
|
|
340
340
|
expect(template[0].className).not.toContain("active");
|
|
341
341
|
expect(template[0].className).not.toContain("activeeq");
|
|
342
342
|
|
|
343
343
|
$state.go("contacts.item", { id: 5 });
|
|
344
344
|
scope.$digest();
|
|
345
|
-
await wait(
|
|
345
|
+
await wait(100);
|
|
346
346
|
expect(template[0].className).toContain("active activeeq");
|
|
347
347
|
|
|
348
348
|
scope.state = "contacts";
|
|
349
349
|
scope.params = {};
|
|
350
350
|
scope.$digest();
|
|
351
|
-
await wait(
|
|
351
|
+
await wait(100);
|
|
352
352
|
expect(template[0].className).toContain("active");
|
|
353
353
|
expect(template[0].className).not.toContain("activeeq");
|
|
354
354
|
});
|
|
@@ -375,7 +375,7 @@ describe("uiStateRef", () => {
|
|
|
375
375
|
expect(el.attr("href")).toBe("#/other/def");
|
|
376
376
|
|
|
377
377
|
browserTrigger(el, "click");
|
|
378
|
-
await wait(
|
|
378
|
+
await wait(100);
|
|
379
379
|
|
|
380
380
|
expect($state.current.name).toBe("other");
|
|
381
381
|
expect($state.params.id).toEqual("def");
|
|
@@ -390,7 +390,7 @@ describe("uiStateRef", () => {
|
|
|
390
390
|
expect(el.attr("href")).toBe("#/other/ghi/detail");
|
|
391
391
|
|
|
392
392
|
browserTrigger(el, "click");
|
|
393
|
-
await wait(
|
|
393
|
+
await wait(100);
|
|
394
394
|
|
|
395
395
|
expect($state.current.name).toBe("other.detail");
|
|
396
396
|
expect($state.params.id).toEqual("ghi");
|
|
@@ -469,7 +469,7 @@ describe("uiStateRef", () => {
|
|
|
469
469
|
});
|
|
470
470
|
|
|
471
471
|
browserTrigger(template, "click");
|
|
472
|
-
await wait(
|
|
472
|
+
await wait(100);
|
|
473
473
|
|
|
474
474
|
expect(transitionOptions.reload).toEqual(true);
|
|
475
475
|
expect(transitionOptions.absolute).toBeUndefined();
|
|
@@ -487,7 +487,7 @@ describe("uiStateRef", () => {
|
|
|
487
487
|
scope.$digest();
|
|
488
488
|
|
|
489
489
|
browserTrigger(el, "click");
|
|
490
|
-
await wait(
|
|
490
|
+
await wait(100);
|
|
491
491
|
|
|
492
492
|
expect($state.current.name).toBe("contacts");
|
|
493
493
|
});
|
|
@@ -504,7 +504,7 @@ describe("uiStateRef", () => {
|
|
|
504
504
|
scope.$digest();
|
|
505
505
|
|
|
506
506
|
browserTrigger(el, "change");
|
|
507
|
-
await wait(
|
|
507
|
+
await wait(100);
|
|
508
508
|
|
|
509
509
|
expect($state.current.name).toEqual("contacts");
|
|
510
510
|
});
|
|
@@ -521,7 +521,7 @@ describe("uiStateRef", () => {
|
|
|
521
521
|
scope.$digest();
|
|
522
522
|
|
|
523
523
|
browserTrigger(el, "change");
|
|
524
|
-
await wait(
|
|
524
|
+
await wait(100);
|
|
525
525
|
expect($state.current.name).toEqual("contacts");
|
|
526
526
|
|
|
527
527
|
$state.go("top");
|
|
@@ -530,7 +530,7 @@ describe("uiStateRef", () => {
|
|
|
530
530
|
expect($state.current.name).toEqual("top");
|
|
531
531
|
|
|
532
532
|
browserTrigger(el, "blur");
|
|
533
|
-
await wait(
|
|
533
|
+
await wait(100);
|
|
534
534
|
|
|
535
535
|
expect($state.current.name).toEqual("contacts");
|
|
536
536
|
});
|
|
@@ -547,7 +547,7 @@ describe("uiStateRef", () => {
|
|
|
547
547
|
scope.$digest();
|
|
548
548
|
|
|
549
549
|
browserTrigger(el, "mouseover");
|
|
550
|
-
await wait(
|
|
550
|
+
await wait(100);
|
|
551
551
|
expect($state.current.name).toEqual("contacts");
|
|
552
552
|
|
|
553
553
|
$state.go("top");
|
|
@@ -556,7 +556,7 @@ describe("uiStateRef", () => {
|
|
|
556
556
|
expect($state.current.name).toEqual("top");
|
|
557
557
|
|
|
558
558
|
browserTrigger(el, "mousedown");
|
|
559
|
-
await wait(
|
|
559
|
+
await wait(100);
|
|
560
560
|
expect($state.current.name).toEqual("contacts");
|
|
561
561
|
});
|
|
562
562
|
});
|
|
@@ -596,7 +596,7 @@ describe("uiStateRef", () => {
|
|
|
596
596
|
|
|
597
597
|
it("should work", async () => {
|
|
598
598
|
browserTrigger(el, "click");
|
|
599
|
-
await wait(
|
|
599
|
+
await wait(100);
|
|
600
600
|
|
|
601
601
|
expect($state.$current.name).toBe("contacts.item.detail");
|
|
602
602
|
expect($state.params.id).toEqual(5);
|
|
@@ -607,7 +607,7 @@ describe("uiStateRef", () => {
|
|
|
607
607
|
|
|
608
608
|
const parentToChild = jqLite(template[0].querySelector("a.item"));
|
|
609
609
|
browserTrigger(parentToChild, "click");
|
|
610
|
-
await wait(
|
|
610
|
+
await wait(100);
|
|
611
611
|
|
|
612
612
|
expect($state.$current.name).toBe("contacts.item");
|
|
613
613
|
|
|
@@ -617,7 +617,7 @@ describe("uiStateRef", () => {
|
|
|
617
617
|
const childToParent = jqLite(template[0].querySelector("a.item-parent"));
|
|
618
618
|
|
|
619
619
|
browserTrigger(childToGrandchild, "click");
|
|
620
|
-
await wait(
|
|
620
|
+
await wait(100);
|
|
621
621
|
|
|
622
622
|
const grandchildToParent = jqLite(
|
|
623
623
|
template[0].querySelector("a.item-parent2"),
|
|
@@ -625,13 +625,13 @@ describe("uiStateRef", () => {
|
|
|
625
625
|
expect($state.$current.name).toBe("contacts.item.detail");
|
|
626
626
|
|
|
627
627
|
browserTrigger(grandchildToParent, "click");
|
|
628
|
-
await wait(
|
|
628
|
+
await wait(100);
|
|
629
629
|
|
|
630
630
|
expect($state.$current.name).toBe("contacts.item");
|
|
631
631
|
|
|
632
632
|
$state.transitionTo("contacts.item.detail", { id: 3 });
|
|
633
633
|
browserTrigger(childToParent, "click");
|
|
634
|
-
await wait(
|
|
634
|
+
await wait(100);
|
|
635
635
|
expect($state.$current.name).toBe("contacts");
|
|
636
636
|
});
|
|
637
637
|
});
|
|
@@ -646,7 +646,7 @@ describe("uiStateRef", () => {
|
|
|
646
646
|
expect($state.current.name).toEqual("top");
|
|
647
647
|
|
|
648
648
|
browserTrigger(el, "click");
|
|
649
|
-
await wait(
|
|
649
|
+
await wait(100);
|
|
650
650
|
|
|
651
651
|
expect($state.current.name).toEqual("contacts");
|
|
652
652
|
});
|
|
@@ -661,7 +661,7 @@ describe("uiStateRef", () => {
|
|
|
661
661
|
expect($state.current.name).toEqual("top");
|
|
662
662
|
|
|
663
663
|
browserTrigger(el, "change");
|
|
664
|
-
await wait(
|
|
664
|
+
await wait(100);
|
|
665
665
|
|
|
666
666
|
expect($state.current.name).toEqual("contacts");
|
|
667
667
|
});
|
|
@@ -676,7 +676,7 @@ describe("uiStateRef", () => {
|
|
|
676
676
|
expect($state.current.name).toEqual("top");
|
|
677
677
|
|
|
678
678
|
browserTrigger(el, "change");
|
|
679
|
-
await wait(
|
|
679
|
+
await wait(100);
|
|
680
680
|
expect($state.current.name).toEqual("contacts");
|
|
681
681
|
|
|
682
682
|
$state.go("top");
|
|
@@ -685,7 +685,7 @@ describe("uiStateRef", () => {
|
|
|
685
685
|
expect($state.current.name).toEqual("top");
|
|
686
686
|
|
|
687
687
|
browserTrigger(el, "blur");
|
|
688
|
-
await wait(
|
|
688
|
+
await wait(100);
|
|
689
689
|
expect($state.current.name).toEqual("contacts");
|
|
690
690
|
});
|
|
691
691
|
|
|
@@ -699,7 +699,7 @@ describe("uiStateRef", () => {
|
|
|
699
699
|
expect($state.current.name).toEqual("top");
|
|
700
700
|
|
|
701
701
|
browserTrigger(el, "mouseover");
|
|
702
|
-
await wait(
|
|
702
|
+
await wait(100);
|
|
703
703
|
expect($state.current.name).toEqual("contacts");
|
|
704
704
|
|
|
705
705
|
$state.go("top");
|
|
@@ -708,7 +708,7 @@ describe("uiStateRef", () => {
|
|
|
708
708
|
expect($state.current.name).toEqual("top");
|
|
709
709
|
|
|
710
710
|
browserTrigger(el, "mousedown");
|
|
711
|
-
await wait(
|
|
711
|
+
await wait(100);
|
|
712
712
|
expect($state.current.name).toEqual("contacts");
|
|
713
713
|
});
|
|
714
714
|
});
|
|
@@ -785,11 +785,11 @@ describe("uiSrefActive", () => {
|
|
|
785
785
|
|
|
786
786
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
787
787
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
788
|
-
await wait(
|
|
788
|
+
await wait(100);
|
|
789
789
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
790
790
|
|
|
791
791
|
$state.transitionTo("contacts.item", { id: 2 });
|
|
792
|
-
await wait(
|
|
792
|
+
await wait(100);
|
|
793
793
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
794
794
|
});
|
|
795
795
|
|
|
@@ -802,11 +802,11 @@ describe("uiSrefActive", () => {
|
|
|
802
802
|
|
|
803
803
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
804
804
|
$state.transitionTo("contacts.item.detail", { id: 5, foo: "bar" });
|
|
805
|
-
await wait(
|
|
805
|
+
await wait(100);
|
|
806
806
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
807
807
|
|
|
808
808
|
$state.transitionTo("contacts.item.detail", { id: 5, foo: "baz" });
|
|
809
|
-
await wait(
|
|
809
|
+
await wait(100);
|
|
810
810
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
811
811
|
});
|
|
812
812
|
|
|
@@ -821,15 +821,15 @@ describe("uiSrefActive", () => {
|
|
|
821
821
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
822
822
|
|
|
823
823
|
$state.transitionTo("arrayparam", { foo: [1, 2, 3] });
|
|
824
|
-
await wait(
|
|
824
|
+
await wait(100);
|
|
825
825
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
826
826
|
|
|
827
827
|
$state.transitionTo("arrayparam", { foo: [1, 2, 3], bar: "asdf" });
|
|
828
|
-
await wait(
|
|
828
|
+
await wait(100);
|
|
829
829
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
830
830
|
|
|
831
831
|
$state.transitionTo("arrayparam", { foo: [1, 2] });
|
|
832
|
-
await wait(
|
|
832
|
+
await wait(100);
|
|
833
833
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
834
834
|
});
|
|
835
835
|
|
|
@@ -844,15 +844,15 @@ describe("uiSrefActive", () => {
|
|
|
844
844
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
845
845
|
|
|
846
846
|
$state.transitionTo("arrayparam", { foo: [1, 2, 3] });
|
|
847
|
-
await wait(
|
|
847
|
+
await wait(100);
|
|
848
848
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
849
849
|
|
|
850
850
|
$state.transitionTo("arrayparam", { foo: [1, 2, 3], bar: "asdf" });
|
|
851
|
-
await wait(
|
|
851
|
+
await wait(100);
|
|
852
852
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
853
853
|
|
|
854
854
|
$state.transitionTo("arrayparam", { foo: [1, 2] });
|
|
855
|
-
await wait(
|
|
855
|
+
await wait(100);
|
|
856
856
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
857
857
|
});
|
|
858
858
|
|
|
@@ -866,12 +866,12 @@ describe("uiSrefActive", () => {
|
|
|
866
866
|
|
|
867
867
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
868
868
|
$state.transitionTo("contacts.item.detail", { id: 5, foo: "bar" });
|
|
869
|
-
await wait(
|
|
869
|
+
await wait(100);
|
|
870
870
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
871
871
|
|
|
872
872
|
$rootScope.fooId = "baz";
|
|
873
873
|
$rootScope.$digest();
|
|
874
|
-
await wait(
|
|
874
|
+
await wait(100);
|
|
875
875
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
876
876
|
});
|
|
877
877
|
|
|
@@ -883,12 +883,12 @@ describe("uiSrefActive", () => {
|
|
|
883
883
|
const a = jqLite(template[0].getElementsByTagName("a")[0]);
|
|
884
884
|
|
|
885
885
|
$state.transitionTo("contacts.item.edit", { id: 1 });
|
|
886
|
-
await wait(
|
|
886
|
+
await wait(100);
|
|
887
887
|
expect($state.params.id).toBe("1");
|
|
888
888
|
expect(a.attr("class")).toMatch(/active/);
|
|
889
889
|
|
|
890
890
|
$state.transitionTo("contacts.item.edit", { id: 4 });
|
|
891
|
-
await wait(
|
|
891
|
+
await wait(100);
|
|
892
892
|
expect($state.params.id).toBe("4");
|
|
893
893
|
expect(a.attr("class")).not.toMatch(/active/);
|
|
894
894
|
});
|
|
@@ -901,11 +901,11 @@ describe("uiSrefActive", () => {
|
|
|
901
901
|
const a = jqLite(template[0].getElementsByTagName("a")[0]);
|
|
902
902
|
|
|
903
903
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
904
|
-
await wait(
|
|
904
|
+
await wait(100);
|
|
905
905
|
expect(a.attr("class")).toMatch(/active/);
|
|
906
906
|
|
|
907
907
|
$state.transitionTo("contacts.item.edit", { id: 1 });
|
|
908
|
-
await wait(
|
|
908
|
+
await wait(100);
|
|
909
909
|
expect(a.attr("class")).not.toMatch(/active/);
|
|
910
910
|
});
|
|
911
911
|
|
|
@@ -917,12 +917,12 @@ describe("uiSrefActive", () => {
|
|
|
917
917
|
const a = jqLite(template[0].getElementsByTagName("a")[0]);
|
|
918
918
|
|
|
919
919
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
920
|
-
await wait(
|
|
920
|
+
await wait(100);
|
|
921
921
|
expect(a.attr("class")).toMatch(/active/);
|
|
922
922
|
expect(a.attr("class")).toMatch(/active-eq/);
|
|
923
923
|
|
|
924
924
|
$state.transitionTo("contacts.item.edit", { id: 1 });
|
|
925
|
-
await wait(
|
|
925
|
+
await wait(100);
|
|
926
926
|
expect(a.attr("class")).toMatch(/active/);
|
|
927
927
|
expect(a.attr("class")).not.toMatch(/active-eq/);
|
|
928
928
|
});
|
|
@@ -933,17 +933,17 @@ describe("uiSrefActive", () => {
|
|
|
933
933
|
$rootScope.$digest();
|
|
934
934
|
|
|
935
935
|
$state.transitionTo("contacts");
|
|
936
|
-
await wait(
|
|
936
|
+
await wait(100);
|
|
937
937
|
expect(
|
|
938
938
|
jqLite(template[0].querySelector("a")).attr("class"),
|
|
939
939
|
).toBeUndefined();
|
|
940
940
|
|
|
941
941
|
$state.transitionTo("contacts.item", { id: 6 });
|
|
942
|
-
await wait(
|
|
942
|
+
await wait(100);
|
|
943
943
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
944
944
|
|
|
945
945
|
$state.transitionTo("contacts.item", { id: 5 });
|
|
946
|
-
await wait(
|
|
946
|
+
await wait(100);
|
|
947
947
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("");
|
|
948
948
|
});
|
|
949
949
|
|
|
@@ -957,11 +957,11 @@ describe("uiSrefActive", () => {
|
|
|
957
957
|
expect(jqLite(template[0]).attr("class")).toBeUndefined();
|
|
958
958
|
|
|
959
959
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
960
|
-
await wait(
|
|
960
|
+
await wait(100);
|
|
961
961
|
expect(jqLite(template[0]).attr("class")).toBe("active");
|
|
962
962
|
|
|
963
963
|
$state.transitionTo("contacts.item", { id: 2 });
|
|
964
|
-
await wait(
|
|
964
|
+
await wait(100);
|
|
965
965
|
expect(jqLite(template[0]).attr("class")).toBe("active");
|
|
966
966
|
});
|
|
967
967
|
|
|
@@ -970,7 +970,7 @@ describe("uiSrefActive", () => {
|
|
|
970
970
|
'<div><a ui-sref="contacts.lazy" ui-sref-active="active">Lazy Contact</a></div>',
|
|
971
971
|
);
|
|
972
972
|
template = $compile(el)($rootScope);
|
|
973
|
-
await wait(
|
|
973
|
+
await wait(100);
|
|
974
974
|
|
|
975
975
|
_stateProvider.onInvalid(function ($to$) {
|
|
976
976
|
if ($to$.name() === "contacts.lazy") {
|
|
@@ -980,11 +980,11 @@ describe("uiSrefActive", () => {
|
|
|
980
980
|
});
|
|
981
981
|
|
|
982
982
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
983
|
-
await wait(
|
|
983
|
+
await wait(100);
|
|
984
984
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
985
985
|
|
|
986
986
|
$state.transitionTo("contacts.lazy");
|
|
987
|
-
await wait(
|
|
987
|
+
await wait(100);
|
|
988
988
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
989
989
|
});
|
|
990
990
|
|
|
@@ -993,7 +993,7 @@ describe("uiSrefActive", () => {
|
|
|
993
993
|
'<div><a ui-sref="contacts.lazy" ui-sref-active-eq="active">Lazy Contact</a></div>',
|
|
994
994
|
);
|
|
995
995
|
template = $compile(el)($rootScope);
|
|
996
|
-
await wait(
|
|
996
|
+
await wait(100);
|
|
997
997
|
|
|
998
998
|
_stateProvider.onInvalid(function ($to$) {
|
|
999
999
|
if ($to$.name() === "contacts.lazy") {
|
|
@@ -1003,11 +1003,11 @@ describe("uiSrefActive", () => {
|
|
|
1003
1003
|
});
|
|
1004
1004
|
|
|
1005
1005
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
1006
|
-
await wait(
|
|
1006
|
+
await wait(100);
|
|
1007
1007
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
1008
1008
|
|
|
1009
1009
|
$state.transitionTo("contacts.lazy");
|
|
1010
|
-
await wait(
|
|
1010
|
+
await wait(100);
|
|
1011
1011
|
expect(jqLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
1012
1012
|
});
|
|
1013
1013
|
|
|
@@ -1019,7 +1019,7 @@ describe("uiSrefActive", () => {
|
|
|
1019
1019
|
const a = jqLite(template[0].getElementsByTagName("a")[0]);
|
|
1020
1020
|
|
|
1021
1021
|
$state.transitionTo("contacts.item.edit", { id: 1 });
|
|
1022
|
-
await wait(
|
|
1022
|
+
await wait(100);
|
|
1023
1023
|
expect(a.attr("class")).toMatch(/active also-active/);
|
|
1024
1024
|
});
|
|
1025
1025
|
|
|
@@ -1042,7 +1042,7 @@ describe("uiSrefActive", () => {
|
|
|
1042
1042
|
)($rootScope);
|
|
1043
1043
|
$rootScope.$digest();
|
|
1044
1044
|
$state.transitionTo("contacts.lazy.s1");
|
|
1045
|
-
await wait(
|
|
1045
|
+
await wait(100);
|
|
1046
1046
|
|
|
1047
1047
|
expect(template.eq(0)[0].hasClass("active")).toBeTruthy();
|
|
1048
1048
|
//expect(template.eq(1).hasClass("active")).toBeFalsy();
|
|
@@ -1055,7 +1055,7 @@ describe("uiSrefActive", () => {
|
|
|
1055
1055
|
'<div ui-sref-active="{active: \'admin.*\'}"><a ui-sref-active="active" ui-sref="admin.roles">Roles</a></div>',
|
|
1056
1056
|
)($rootScope);
|
|
1057
1057
|
$state.transitionTo("admin.roles");
|
|
1058
|
-
await wait(
|
|
1058
|
+
await wait(100);
|
|
1059
1059
|
const abstractParent = el[0];
|
|
1060
1060
|
expect(abstractParent.className).toMatch(/active/);
|
|
1061
1061
|
const child = el[0].querySelector("a");
|
|
@@ -1067,7 +1067,7 @@ describe("uiSrefActive", () => {
|
|
|
1067
1067
|
"<div ui-sref-active=\"{active: 'admin.roles({page: 1})'}\"></div>",
|
|
1068
1068
|
)($rootScope);
|
|
1069
1069
|
$state.transitionTo("admin.roles", { page: 1 });
|
|
1070
|
-
await wait(
|
|
1070
|
+
await wait(100);
|
|
1071
1071
|
expect(el[0].className).toMatch(/active/);
|
|
1072
1072
|
});
|
|
1073
1073
|
|
|
@@ -1076,10 +1076,10 @@ describe("uiSrefActive", () => {
|
|
|
1076
1076
|
'<div ui-sref-active="{active: \'admin.roles({page: 1})\'}"><a ui-sref="admin.roles"></a></div>',
|
|
1077
1077
|
)($rootScope);
|
|
1078
1078
|
$state.transitionTo("admin.roles");
|
|
1079
|
-
await wait(
|
|
1079
|
+
await wait(100);
|
|
1080
1080
|
expect(el[0].className).not.toMatch(/active/);
|
|
1081
1081
|
$state.transitionTo("admin.roles", { page: 1 });
|
|
1082
|
-
await wait(
|
|
1082
|
+
await wait(100);
|
|
1083
1083
|
expect(el[0].className).toMatch(/active/);
|
|
1084
1084
|
});
|
|
1085
1085
|
|
|
@@ -1088,18 +1088,18 @@ describe("uiSrefActive", () => {
|
|
|
1088
1088
|
"<div ui-sref-active=\"{contacts: 'contacts.**', admin: 'admin.roles({page: 1})'}\"></div>",
|
|
1089
1089
|
)($rootScope);
|
|
1090
1090
|
$state.transitionTo("contacts");
|
|
1091
|
-
await wait(
|
|
1091
|
+
await wait(100);
|
|
1092
1092
|
expect(el[0].className).toMatch(/contacts/);
|
|
1093
1093
|
expect(el[0].className).not.toMatch(/admin/);
|
|
1094
1094
|
$state.transitionTo("admin.roles", { page: 1 });
|
|
1095
|
-
await wait(
|
|
1095
|
+
await wait(100);
|
|
1096
1096
|
expect(el[0].className).toMatch(/admin/);
|
|
1097
1097
|
expect(el[0].className).not.toMatch(/contacts/);
|
|
1098
1098
|
});
|
|
1099
1099
|
|
|
1100
1100
|
it("should update the active classes when compiled", async () => {
|
|
1101
1101
|
$state.transitionTo("admin.roles");
|
|
1102
|
-
await wait(
|
|
1102
|
+
await wait(100);
|
|
1103
1103
|
el = $compile("<div ui-sref-active=\"{active: 'admin.roles'}\"/>")(
|
|
1104
1104
|
$rootScope,
|
|
1105
1105
|
);
|
|
@@ -1126,7 +1126,7 @@ describe("uiSrefActive", () => {
|
|
|
1126
1126
|
)($rootScope);
|
|
1127
1127
|
$rootScope.$digest();
|
|
1128
1128
|
$state.transitionTo("contacts.lazy.s1");
|
|
1129
|
-
await wait(
|
|
1129
|
+
await wait(100);
|
|
1130
1130
|
expect(template.eq(0).hasClass("active")).toBeTruthy();
|
|
1131
1131
|
expect(template.eq(1).hasClass("active")).toBeFalsy();
|
|
1132
1132
|
});
|
|
@@ -1138,7 +1138,7 @@ describe("uiSrefActive", () => {
|
|
|
1138
1138
|
'<div ui-sref-active="{active: [\'randomState.**\', \'admin.roles\']}"><a ui-sref-active="active" ui-sref="admin.roles">Roles</a></div>',
|
|
1139
1139
|
)($rootScope);
|
|
1140
1140
|
$state.transitionTo("admin.roles");
|
|
1141
|
-
await wait(
|
|
1141
|
+
await wait(100);
|
|
1142
1142
|
const abstractParent = el[0];
|
|
1143
1143
|
expect(abstractParent.className).toMatch(/active/);
|
|
1144
1144
|
const child = el[0].querySelector("a");
|
|
@@ -1150,7 +1150,7 @@ describe("uiSrefActive", () => {
|
|
|
1150
1150
|
"<div ui-sref-active=\"{active: ['admin.roles({page: 1})']}\"></div>",
|
|
1151
1151
|
)($rootScope);
|
|
1152
1152
|
$state.transitionTo("admin.roles", { page: 1 });
|
|
1153
|
-
await wait(
|
|
1153
|
+
await wait(100);
|
|
1154
1154
|
expect(el[0].className).toMatch(/active/);
|
|
1155
1155
|
});
|
|
1156
1156
|
|
|
@@ -1159,18 +1159,18 @@ describe("uiSrefActive", () => {
|
|
|
1159
1159
|
"<div ui-sref-active=\"{contacts: ['contacts.item', 'contacts.item.detail'], admin: 'admin.roles({page: 1})'}\"></div>",
|
|
1160
1160
|
)($rootScope);
|
|
1161
1161
|
$state.transitionTo("contacts.item.detail", { id: 1, foo: "bar" });
|
|
1162
|
-
await wait(
|
|
1162
|
+
await wait(100);
|
|
1163
1163
|
expect(el[0].className).toMatch(/contacts/);
|
|
1164
1164
|
expect(el[0].className).not.toMatch(/admin/);
|
|
1165
1165
|
$state.transitionTo("admin.roles", { page: 1 });
|
|
1166
|
-
await wait(
|
|
1166
|
+
await wait(100);
|
|
1167
1167
|
expect(el[0].className).toMatch(/admin/);
|
|
1168
1168
|
expect(el[0].className).not.toMatch(/contacts/);
|
|
1169
1169
|
});
|
|
1170
1170
|
|
|
1171
1171
|
it("should update the active classes when compiled", async () => {
|
|
1172
1172
|
$state.transitionTo("admin.roles");
|
|
1173
|
-
await wait(
|
|
1173
|
+
await wait(100);
|
|
1174
1174
|
el = $compile(
|
|
1175
1175
|
"<div ui-sref-active=\"{active: ['admin.roles', 'admin.someOtherState']}\"/>",
|
|
1176
1176
|
)($rootScope);
|
|
@@ -625,14 +625,14 @@ describe("$state", () => {
|
|
|
625
625
|
it("does not exit nor enter a state when only dynamic params change (triggered via url)", async () => {
|
|
626
626
|
$location.search({ search: "s1", searchDyn: "sd2" });
|
|
627
627
|
$rootScope.$broadcast("$locationChangeSuccess");
|
|
628
|
-
await wait(
|
|
628
|
+
await wait(100);
|
|
629
629
|
expect(dynlog).toBe("success;[searchDyn=sd2];");
|
|
630
630
|
});
|
|
631
631
|
|
|
632
632
|
it("exits and enters a state when any non-dynamic params change (triggered via url)", async () => {
|
|
633
633
|
$location.search({ search: "s2", searchDyn: "sd2" });
|
|
634
634
|
$rootScope.$broadcast("$locationChangeSuccess");
|
|
635
|
-
await wait(
|
|
635
|
+
await wait(100);
|
|
636
636
|
expect(dynlog).toBe("exit:dyn;enter:dyn;success;");
|
|
637
637
|
});
|
|
638
638
|
|
|
@@ -686,11 +686,11 @@ describe("$state", () => {
|
|
|
686
686
|
$rootScope.$watch(stateParamsTerm, function (newval, oldval) {
|
|
687
687
|
observedParamValue = newval;
|
|
688
688
|
});
|
|
689
|
-
await wait(
|
|
689
|
+
await wait(100);
|
|
690
690
|
|
|
691
691
|
$location.search({ search: "s1", searchDyn: "sd2" });
|
|
692
692
|
$rootScope.$broadcast("$locationChangeSuccess");
|
|
693
|
-
await wait(
|
|
693
|
+
await wait(100);
|
|
694
694
|
|
|
695
695
|
expect(observedParamValue).toBe("sd2");
|
|
696
696
|
});
|
|
@@ -812,7 +812,7 @@ describe("$state", () => {
|
|
|
812
812
|
await initStateTo(RS);
|
|
813
813
|
$location.search({ term: "hello" });
|
|
814
814
|
$rootScope.$broadcast("$locationChangeSuccess");
|
|
815
|
-
await wait(
|
|
815
|
+
await wait(100);
|
|
816
816
|
expect($stateParams.term).toEqual("hello");
|
|
817
817
|
expect(entered).toBeFalsy();
|
|
818
818
|
});
|
|
@@ -32,7 +32,7 @@ describe("templateFactory", () => {
|
|
|
32
32
|
it("accepts relative URLs", async () => {
|
|
33
33
|
let res = $templateFactory.fromUrl("mock/hello");
|
|
34
34
|
$scope.$digest();
|
|
35
|
-
await wait(
|
|
35
|
+
await wait(100);
|
|
36
36
|
expect(res.$$state.status).toBe(1);
|
|
37
37
|
});
|
|
38
38
|
|
|
@@ -122,7 +122,7 @@ describe("templateFactory", () => {
|
|
|
122
122
|
$router.stateRegistry.register({ name: "cmp", component: "myComponent" });
|
|
123
123
|
$router.stateService.go("cmp");
|
|
124
124
|
$scope.$digest();
|
|
125
|
-
await wait(
|
|
125
|
+
await wait(100);
|
|
126
126
|
expect(el.html()).toMatch(/\<my-component/);
|
|
127
127
|
});
|
|
128
128
|
|