@angular-wave/angular.ts 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/Makefile +1 -0
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -12
  4. package/index.html +3 -74
  5. package/package.json +1 -1
  6. package/src/angular.spec.js +5 -0
  7. package/src/animations/animate-css.js +13 -5
  8. package/src/animations/animate-queue.js +21 -22
  9. package/src/animations/animate-runner.js +8 -4
  10. package/src/animations/animate.md +1 -1
  11. package/src/animations/animate.spec.js +21 -0
  12. package/src/animations/animation.js +1 -1
  13. package/src/binding.spec.js +1 -0
  14. package/src/core/compile/compile.js +25 -27
  15. package/src/core/compile/compile.spec.js +266 -17
  16. package/src/core/controller/controller.js +0 -2
  17. package/src/core/di/injector.md +1 -1
  18. package/src/core/di/injector.spec.js +2 -0
  19. package/src/core/di/internal-injector.js +1 -2
  20. package/src/core/interpolate/interpolate.js +12 -28
  21. package/src/core/interpolate/interpolate.spec.js +16 -70
  22. package/src/core/interval/interval-factory.js +50 -0
  23. package/src/core/interval/interval.html +18 -0
  24. package/src/core/interval/interval.js +77 -0
  25. package/src/core/interval/interval.md +123 -0
  26. package/src/core/interval/interval.spec.js +280 -0
  27. package/src/core/interval/interval.test.js +1 -1
  28. package/src/core/location/location.js +53 -59
  29. package/src/core/location/location.spec.js +27 -27
  30. package/src/core/on.spec.js +7 -0
  31. package/src/core/parse/interpreter.js +7 -10
  32. package/src/core/parse/parse.js +5 -26
  33. package/src/core/parse/parse.spec.js +91 -95
  34. package/src/core/prop.spec.js +60 -4
  35. package/src/core/q/q.html +18 -0
  36. package/src/core/q/q.js +472 -0
  37. package/src/core/q/q.md +211 -0
  38. package/src/core/q/q.spec.js +2748 -0
  39. package/src/core/q/q.test.js +12 -0
  40. package/src/core/sce/sce.spec.js +8 -0
  41. package/src/core/{model/model.html → scope/scope.html} +1 -1
  42. package/src/core/scope/scope.js +16 -15
  43. package/src/core/scope/scope.spec.js +1959 -24
  44. package/src/core/scope/scope.test.js +12 -0
  45. package/src/core/timeout/timeout.html +18 -0
  46. package/src/core/timeout/timeout.js +109 -0
  47. package/src/core/timeout/timeout.spec.js +354 -0
  48. package/src/core/timeout/timout.test.js +12 -0
  49. package/src/core/url-utils/url-utils.spec.js +1 -1
  50. package/src/directive/aria/aria.js +6 -3
  51. package/src/directive/aria/aria.spec.js +87 -0
  52. package/src/directive/attrs/attrs.spec.js +5 -0
  53. package/src/directive/attrs/boolean.spec.js +15 -0
  54. package/src/directive/attrs/element-style.spec.js +8 -0
  55. package/src/directive/attrs/src.spec.js +7 -0
  56. package/src/directive/bind/bind.spec.js +33 -0
  57. package/src/directive/bind/bing-html.spec.js +3 -0
  58. package/src/directive/class/class.js +3 -3
  59. package/src/directive/class/class.spec.js +75 -9
  60. package/src/directive/controller/controller.spec.js +13 -0
  61. package/src/directive/events/click.spec.js +3 -0
  62. package/src/directive/events/event.spec.js +6 -0
  63. package/src/directive/events/events.html +1 -0
  64. package/src/directive/form/form.js +3 -2
  65. package/src/directive/form/form.spec.js +65 -0
  66. package/src/directive/if/if.spec.js +4 -0
  67. package/src/directive/include/include.spec.js +59 -8
  68. package/src/directive/init/init.js +2 -6
  69. package/src/directive/init/init.spec.js +2 -0
  70. package/src/directive/input/input.spec.js +136 -0
  71. package/src/directive/messages/messages.spec.js +35 -4
  72. package/src/directive/model/model.js +25 -18
  73. package/src/directive/model/model.spec.js +49 -2
  74. package/src/directive/model-options/model-options.spec.js +6 -0
  75. package/src/directive/non-bindable/non-bindable.spec.js +1 -0
  76. package/src/directive/observe/observe.js +5 -1
  77. package/src/directive/observe/observe.spec.js +22 -0
  78. package/src/directive/observe/test.html +3 -11
  79. package/src/directive/options/options.spec.js +34 -0
  80. package/src/directive/ref/href.spec.js +15 -0
  81. package/src/directive/repeat/repeat.spec.js +135 -8
  82. package/src/directive/script/script.spec.js +2 -0
  83. package/src/directive/select/select.js +3 -3
  84. package/src/directive/select/select.spec.js +96 -0
  85. package/src/directive/show-hide/show-hide.js +2 -2
  86. package/src/directive/show-hide/show-hide.spec.js +19 -8
  87. package/src/directive/style/style.spec.js +7 -0
  88. package/src/directive/switch/switch.spec.js +5 -5
  89. package/src/directive/validators/validators.spec.js +1 -0
  90. package/src/loader.js +1 -0
  91. package/src/public.js +10 -2
  92. package/src/router/common/coreservices.js +2 -0
  93. package/src/router/directives/state-directives.js +14 -6
  94. package/src/router/directives/state-directives.spec.js +83 -0
  95. package/src/router/directives/view-directive.js +13 -4
  96. package/src/router/directives/view-directive.spec.js +71 -25
  97. package/src/router/hooks/lazy-load.js +2 -2
  98. package/src/router/hooks/views.js +5 -3
  99. package/src/router/resolve/resolvable.js +6 -3
  100. package/src/router/resolve/resolve-context.js +2 -2
  101. package/src/router/state/state-service.js +4 -4
  102. package/src/router/state/state.spec.js +5 -2
  103. package/src/router/state/state.test.js +1 -1
  104. package/src/router/state/views.js +10 -7
  105. package/src/router/template-factory.js +6 -3
  106. package/src/router/template-factory.spec.js +4 -0
  107. package/src/router/transition/transition-hook.js +1 -1
  108. package/src/router/transition/transition.js +1 -1
  109. package/src/router/view-hook.spec.js +2 -2
  110. package/src/router/view-scroll.js +6 -4
  111. package/src/services/browser.js +5 -8
  112. package/src/services/http/http.js +9 -6
  113. package/src/services/http/http.spec.js +31 -30
  114. package/src/services/http/template-request.spec.js +10 -0
  115. package/src/services/http-backend/http-backend.spec.js +3 -3
  116. package/src/services/template-request.js +4 -2
  117. package/src/shared/common.js +2 -1
  118. package/types/core/location/location.d.ts +37 -34
  119. package/types/core/parse/parse.d.ts +0 -26
  120. package/types/core/scope/scope.d.ts +11 -11
  121. package/src/core/model/model.js +0 -944
  122. package/src/core/model/model.spec.js +0 -3012
  123. package/types/core/model/model.d.ts +0 -204
@@ -10,7 +10,6 @@ import {
10
10
  import { createInjector } from "../di/injector.js";
11
11
  import { ASTType } from "./ast-type.js";
12
12
  import { Angular } from "../../loader.js";
13
- import { wait } from "../../shared/test-utils.js";
14
13
 
15
14
  describe("parser", () => {
16
15
  let $rootScope;
@@ -930,51 +929,52 @@ describe("parser", () => {
930
929
  expect($parse("::foo")).toBe($parse("::foo"));
931
930
  });
932
931
 
933
- it("should not affect calling the parseFn directly", async () => {
934
- $rootScope.$watch("::foo");
932
+ it("should not affect calling the parseFn directly", () => {
933
+ const fn = $parse("::foo");
934
+ $rootScope.$watch(fn);
935
935
 
936
936
  $rootScope.foo = "bar";
937
- expect($rootScope.$$watchersCount).toBe(1);
938
- expect($rootScope.foo).toEqual("bar");
937
+ expect($rootScope.$$watchers.length).toBe(1);
938
+ expect(fn($rootScope)).toEqual("bar");
939
939
 
940
- await wait();
941
- expect($rootScope.$$watchersCount).toBe(0);
942
- expect($rootScope.foo).toEqual("bar");
940
+ $rootScope.$digest();
941
+ expect($rootScope.$$watchers.length).toBe(0);
942
+ expect(fn($rootScope)).toEqual("bar");
943
943
 
944
944
  $rootScope.foo = "man";
945
- await wait();
946
- expect($rootScope.$$watchersCount).toBe(0);
947
- expect($rootScope.foo).toEqual("man");
945
+ $rootScope.$digest();
946
+ expect($rootScope.$$watchers.length).toBe(0);
947
+ expect(fn($rootScope)).toEqual("man");
948
948
 
949
949
  $rootScope.foo = "shell";
950
- await wait();
951
- expect($rootScope.$$watchersCount).toBe(0);
952
- expect($rootScope.foo).toEqual("shell");
950
+ $rootScope.$digest();
951
+ expect($rootScope.$$watchers.length).toBe(0);
952
+ expect(fn($rootScope)).toEqual("shell");
953
953
  });
954
954
 
955
- it("should stay stable once the value defined", async () => {
956
- $rootScope.$watch("::foo", (value, old) => {
955
+ it("should stay stable once the value defined", () => {
956
+ const fn = $parse("::foo");
957
+ $rootScope.$watch(fn, (value, old) => {
957
958
  if (value !== old) logs.push(value);
958
959
  });
959
- expect(logs.length).toEqual(0);
960
960
 
961
- expect($rootScope.$$watchersCount).toBe(1);
961
+ $rootScope.$digest();
962
+ expect($rootScope.$$watchers.length).toBe(1);
962
963
 
963
964
  $rootScope.foo = "bar";
964
- await wait();
965
-
966
- expect($rootScope.$$watchersCount).toBe(0);
965
+ $rootScope.$digest();
966
+ expect($rootScope.$$watchers.length).toBe(0);
967
967
  expect(logs[0]).toEqual("bar");
968
968
 
969
969
  $rootScope.foo = "man";
970
- await wait();
971
-
972
- expect($rootScope.$$watchersCount).toBe(0);
970
+ $rootScope.$digest();
971
+ expect($rootScope.$$watchers.length).toBe(0);
973
972
  expect(logs.length).toEqual(1);
974
973
  });
975
974
 
976
- it("should have a stable value if at the end of a $digest it has a defined value", async () => {
977
- $rootScope.$watch("::foo", (value, old) => {
975
+ it("should have a stable value if at the end of a $digest it has a defined value", () => {
976
+ const fn = $parse("::foo");
977
+ $rootScope.$watch(fn, (value, old) => {
978
978
  if (value !== old) logs.push(value);
979
979
  });
980
980
  $rootScope.$watch("foo", () => {
@@ -984,37 +984,35 @@ describe("parser", () => {
984
984
  });
985
985
 
986
986
  $rootScope.foo = "bar";
987
- await wait();
988
-
989
- expect($rootScope.$$watchersCount).toBe(1);
990
- expect(logs[0]).toEqual("bar");
987
+ $rootScope.$digest();
988
+ expect($rootScope.$$watchers.length).toBe(2);
989
+ expect(logs[0]).toBeUndefined();
991
990
 
992
991
  $rootScope.foo = "man";
993
- await wait();
994
- expect($rootScope.$$watchersCount).toBe(1);
995
- expect(logs[0]).toEqual("bar");
992
+ $rootScope.$digest();
993
+ expect($rootScope.$$watchers.length).toBe(1);
994
+ expect(logs[1]).toEqual("man");
996
995
 
997
996
  $rootScope.foo = "shell";
998
-
999
- await wait();
1000
- expect($rootScope.$$watchersCount).toBe(1);
1001
- expect(logs.length).toEqual(1);
997
+ $rootScope.$digest();
998
+ expect($rootScope.$$watchers.length).toBe(1);
999
+ expect(logs.length).toEqual(2);
1002
1000
  });
1003
1001
 
1004
- it("should not throw if the stable value is `null`", async () => {
1005
- $rootScope.$watch("::foo");
1002
+ it("should not throw if the stable value is `null`", () => {
1003
+ const fn = $parse("::foo");
1004
+ $rootScope.$watch(fn);
1006
1005
  $rootScope.foo = null;
1007
- await wait();
1008
-
1006
+ $rootScope.$digest();
1009
1007
  $rootScope.foo = "foo";
1010
-
1011
- await wait();
1012
- expect($rootScope.foo).toEqual("foo");
1008
+ $rootScope.$digest();
1009
+ expect(fn()).toEqual(undefined);
1013
1010
  });
1014
1011
 
1015
- xit("should invoke a stateless filter", async () => {
1012
+ it("should invoke a stateless filter once when the parsed expression has an interceptor", () => {
1016
1013
  const countFilter = jasmine.createSpy();
1017
- countFilter.and.callThrough();
1014
+ const interceptor = jasmine.createSpy();
1015
+ countFilter.and.returnValue(1);
1018
1016
  createInjector([
1019
1017
  "ng",
1020
1018
  function ($filterProvider) {
@@ -1024,15 +1022,12 @@ describe("parser", () => {
1024
1022
  scope = _$rootScope_;
1025
1023
  $parse = _$parse_;
1026
1024
  });
1027
- scope.count = 0;
1025
+
1028
1026
  scope.foo = function () {
1029
- scope.count++;
1030
- return scope.count;
1027
+ return 1;
1031
1028
  };
1032
- // todo investiage our function stategy
1033
- scope.$watch("::foo() | count");
1034
-
1035
- await wait();
1029
+ scope.$watch($parse(":: foo() | count", interceptor));
1030
+ scope.$digest();
1036
1031
  expect(countFilter.calls.count()).toBe(1);
1037
1032
  });
1038
1033
  });
@@ -1051,34 +1046,38 @@ describe("parser", () => {
1051
1046
  logs = [];
1052
1047
  });
1053
1048
 
1054
- fit("should only become stable when all the properties of an object have defined values", async () => {
1055
- $rootScope.$watch("::{foo: foo, bar: bar}", (value) => {
1056
- logs.push(value);
1057
- });
1049
+ it("should only become stable when all the properties of an object have defined values", () => {
1050
+ const fn = $parse("::{foo: foo, bar: bar}");
1051
+ $rootScope.$watch(
1052
+ fn,
1053
+ (value) => {
1054
+ logs.push(value);
1055
+ },
1056
+ isDeep,
1057
+ );
1058
1058
 
1059
1059
  expect(logs).toEqual([]);
1060
- expect($rootScope.$$watchersCount).toBe(1);
1061
-
1062
- // $rootScope.$digest();
1063
- // expect($rootScope.$$watchersCount).toBe(1);
1064
- // expect(logs[0]).toEqual({ foo: undefined, bar: undefined });
1065
-
1066
- // $rootScope.foo = "foo";
1067
- // await wait();
1068
- // $rootScope.$digest();
1069
- // expect($rootScope.$$watchersCount).toBe(1);
1070
- //expect(logs[0]).toEqual({ foo: undefined, bar: undefined });
1071
-
1072
- // $rootScope.foo = "foobar";
1073
- // $rootScope.bar = "bar";
1074
- // $rootScope.$digest();
1075
- // expect($rootScope.$$watchersCount).toBe(0);
1076
- // expect(logs[2]).toEqual({ foo: "foobar", bar: "bar" });
1077
-
1078
- // $rootScope.foo = "baz";
1079
- // $rootScope.$digest();
1080
- // expect($rootScope.$$watchersCount).toBe(0);
1081
- // expect(logs[3]).toBeUndefined();
1060
+ expect($rootScope.$$watchers.length).toBe(1);
1061
+
1062
+ $rootScope.$digest();
1063
+ expect($rootScope.$$watchers.length).toBe(1);
1064
+ expect(logs[0]).toEqual({ foo: undefined, bar: undefined });
1065
+
1066
+ $rootScope.foo = "foo";
1067
+ $rootScope.$digest();
1068
+ expect($rootScope.$$watchers.length).toBe(1);
1069
+ expect(logs[0]).toEqual({ foo: undefined, bar: undefined });
1070
+
1071
+ $rootScope.foo = "foobar";
1072
+ $rootScope.bar = "bar";
1073
+ $rootScope.$digest();
1074
+ expect($rootScope.$$watchers.length).toBe(0);
1075
+ expect(logs[2]).toEqual({ foo: "foobar", bar: "bar" });
1076
+
1077
+ $rootScope.foo = "baz";
1078
+ $rootScope.$digest();
1079
+ expect($rootScope.$$watchers.length).toBe(0);
1080
+ expect(logs[3]).toBeUndefined();
1082
1081
  });
1083
1082
 
1084
1083
  it("should only become stable when all the elements of an array have defined values", () => {
@@ -1092,26 +1091,26 @@ describe("parser", () => {
1092
1091
  );
1093
1092
 
1094
1093
  expect(logs.length).toEqual(0);
1095
- expect($rootScope.$$watchersCount).toBe(1);
1094
+ expect($rootScope.$$watchers.length).toBe(1);
1096
1095
 
1097
1096
  $rootScope.$digest();
1098
- expect($rootScope.$$watchersCount).toBe(1);
1097
+ expect($rootScope.$$watchers.length).toBe(1);
1099
1098
  expect(logs[0]).toEqual([undefined, undefined]);
1100
1099
 
1101
1100
  $rootScope.foo = "foo";
1102
1101
  $rootScope.$digest();
1103
- expect($rootScope.$$watchersCount).toBe(1);
1102
+ expect($rootScope.$$watchers.length).toBe(1);
1104
1103
  expect(logs[1]).toEqual(["foo", undefined]);
1105
1104
 
1106
1105
  $rootScope.foo = "foobar";
1107
1106
  $rootScope.bar = "bar";
1108
1107
  $rootScope.$digest();
1109
- expect($rootScope.$$watchersCount).toBe(0);
1108
+ expect($rootScope.$$watchers.length).toBe(0);
1110
1109
  expect(logs[2]).toEqual(["foobar", "bar"]);
1111
1110
 
1112
1111
  $rootScope.foo = "baz";
1113
1112
  $rootScope.$digest();
1114
- expect($rootScope.$$watchersCount).toBe(0);
1113
+ expect($rootScope.$$watchers.length).toBe(0);
1115
1114
  expect(logs[3]).toBeUndefined();
1116
1115
  });
1117
1116
 
@@ -1132,18 +1131,18 @@ describe("parser", () => {
1132
1131
 
1133
1132
  $rootScope.foo = "bar";
1134
1133
  $rootScope.$digest();
1135
- expect($rootScope.$$watchersCount).toBe(2);
1134
+ expect($rootScope.$$watchers.length).toBe(2);
1136
1135
  expect(logs[0]).toEqual(["bar"]);
1137
1136
  expect(logs[1]).toEqual([undefined]);
1138
1137
 
1139
1138
  $rootScope.foo = "baz";
1140
1139
  $rootScope.$digest();
1141
- expect($rootScope.$$watchersCount).toBe(1);
1140
+ expect($rootScope.$$watchers.length).toBe(1);
1142
1141
  expect(logs[2]).toEqual(["baz"]);
1143
1142
 
1144
1143
  $rootScope.bar = "qux";
1145
1144
  $rootScope.$digest();
1146
- expect($rootScope.$$watchersCount).toBe(1);
1145
+ expect($rootScope.$$watchers.length).toBe(1);
1147
1146
  expect(logs[3]).toBeUndefined();
1148
1147
  });
1149
1148
  });
@@ -1495,7 +1494,7 @@ describe("parser", () => {
1495
1494
  expect(watcherCalls).toBe(1);
1496
1495
  });
1497
1496
 
1498
- it("should not be reevaluated in literals", async () => {
1497
+ it("should not be reevaluated in literals", () => {
1499
1498
  let filterCalls = 0;
1500
1499
  filterProvider.register(
1501
1500
  "foo",
@@ -1505,21 +1504,18 @@ describe("parser", () => {
1505
1504
  }),
1506
1505
  );
1507
1506
 
1507
+ scope.date = new Date(1234567890123);
1508
+
1508
1509
  let watcherCalls = 0;
1509
1510
  scope.$watch("[(date | foo)]", (input) => {
1510
1511
  watcherCalls++;
1511
1512
  });
1512
1513
 
1513
- scope.date = new Date(1234567890123);
1514
-
1515
- await wait();
1516
-
1514
+ scope.$digest();
1517
1515
  expect(filterCalls).toBe(1);
1518
1516
  expect(watcherCalls).toBe(1);
1519
1517
 
1520
- scope.date = new Date(1234567890124);
1521
-
1522
- await wait();
1518
+ scope.$digest();
1523
1519
  expect(filterCalls).toBe(1);
1524
1520
  expect(watcherCalls).toBe(1);
1525
1521
  });
@@ -34,10 +34,13 @@ fdescribe("ngProp*", () => {
34
34
  const element = $compile(
35
35
  '<button ng-prop-disabled="isDisabled">Button</button>',
36
36
  )($rootScope);
37
+ $rootScope.$digest();
37
38
  expect(element[0].disabled).toBe(false);
38
39
  $rootScope.isDisabled = true;
40
+ $rootScope.$digest();
39
41
  expect(element[0].disabled).toBe(true);
40
42
  $rootScope.isDisabled = false;
43
+ $rootScope.$digest();
41
44
  expect(element[0].disabled).toBe(false);
42
45
  });
43
46
 
@@ -47,26 +50,33 @@ fdescribe("ngProp*", () => {
47
50
  )($rootScope);
48
51
  expect(element[0].checked).toBe(false);
49
52
  $rootScope.isChecked = true;
53
+ $rootScope.$digest();
50
54
  expect(element[0].checked).toBe(true);
51
55
  $rootScope.isChecked = false;
56
+ $rootScope.$digest();
52
57
  expect(element[0].checked).toBe(false);
53
58
  });
54
59
 
55
60
  it("should bind string properties (title)", () => {
56
61
  const element = $compile('<span ng-prop-title="title" />')($rootScope);
57
62
  $rootScope.title = 123;
63
+ $rootScope.$digest();
58
64
  expect(element[0].title).toBe("123");
59
65
  $rootScope.title = "foobar";
66
+ $rootScope.$digest();
60
67
  expect(element[0].title).toBe("foobar");
61
68
  });
62
69
 
63
70
  it("should bind variable type properties", () => {
64
71
  const element = $compile('<span ng-prop-asdf="asdf" />')($rootScope);
65
72
  $rootScope.asdf = 123;
73
+ $rootScope.$digest();
66
74
  expect(element[0].asdf).toBe(123);
67
75
  $rootScope.asdf = "foobar";
76
+ $rootScope.$digest();
68
77
  expect(element[0].asdf).toBe("foobar");
69
78
  $rootScope.asdf = true;
79
+ $rootScope.$digest();
70
80
  expect(element[0].asdf).toBe(true);
71
81
  });
72
82
 
@@ -75,24 +85,31 @@ fdescribe("ngProp*", () => {
75
85
  const element = $compile('<span ng-prop-text="myText" />')($rootScope);
76
86
  // Initialize to truthy value
77
87
  $rootScope.myText = "abc";
88
+ $rootScope.$digest();
78
89
  expect(element[0].text).toBe("abc");
79
90
 
80
91
  // Assert various falsey values get assigned to the property
81
92
  $rootScope.myText = "";
93
+ $rootScope.$digest();
82
94
  expect(element[0].text).toBe("");
83
95
  $rootScope.myText = 0;
96
+ $rootScope.$digest();
84
97
  expect(element[0].text).toBe(0);
85
98
  $rootScope.myText = false;
99
+ $rootScope.$digest();
86
100
  expect(element[0].text).toBe(false);
87
101
  $rootScope.myText = undefined;
102
+ $rootScope.$digest();
88
103
  expect(element[0].text).toBeUndefined();
89
104
  $rootScope.myText = null;
105
+ $rootScope.$digest();
90
106
  expect(element[0].text).toBe(null);
91
107
  });
92
108
 
93
109
  it("should directly map special properties (class)", () => {
94
110
  const element = $compile('<span ng-prop-class="myText" />')($rootScope);
95
111
  $rootScope.myText = "abc";
112
+ $rootScope.$digest();
96
113
  expect(element[0].class).toBe("abc");
97
114
  expect(element[0]).not.toHaveClass("abc");
98
115
  });
@@ -100,6 +117,7 @@ fdescribe("ngProp*", () => {
100
117
  it("should support mixed case using underscore-separated names", () => {
101
118
  const element = $compile('<span ng-prop-a_bcd_e="value" />')($rootScope);
102
119
  $rootScope.value = 123;
120
+ $rootScope.$digest();
103
121
  expect(element[0].aBcdE).toBe(123);
104
122
  });
105
123
 
@@ -118,6 +136,7 @@ fdescribe("ngProp*", () => {
118
136
  const element = $compile("<a ng-prop-href=\"'test/' + value\"></a>")(
119
137
  $rootScope,
120
138
  );
139
+ $rootScope.$digest();
121
140
  expect(element[0].href).toMatch(/\/test\/test$/);
122
141
  });
123
142
 
@@ -139,6 +158,7 @@ fdescribe("ngProp*", () => {
139
158
  $rootScope,
140
159
  );
141
160
  $rootScope.asdf = 123;
161
+ $rootScope.$digest();
142
162
  expect(element[0].asdf).toBe(123);
143
163
  expect(element.attr("asdf")).toBe("foo");
144
164
  });
@@ -148,6 +168,7 @@ fdescribe("ngProp*", () => {
148
168
  $rootScope,
149
169
  );
150
170
  $rootScope.asdf = 123;
171
+ $rootScope.$digest();
151
172
  expect(element[0].asdf).toBe(123);
152
173
  expect(element.attr("asdf")).toBe("foo");
153
174
  });
@@ -257,6 +278,7 @@ fdescribe("ngProp*", () => {
257
278
  // Some browsers complain if you try to write `javascript:` into an `img[src]`
258
279
  // So for the test use something different
259
280
  $rootScope.testUrl = $sce.trustAsMediaUrl("someuntrustedthing:foo();");
281
+ $rootScope.$digest();
260
282
  expect(element[0].src).toEqual("someuntrustedthing:foo();");
261
283
  });
262
284
 
@@ -308,27 +330,33 @@ fdescribe("ngProp*", () => {
308
330
  it("should NOT require trusted values for trusted URI values", () => {
309
331
  $rootScope.testUrl = "http://example.com/image.png"; // `http` is trusted
310
332
  let element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
333
+ $rootScope.$digest();
311
334
  expect(element[0].href).toEqual("http://example.com/image.png");
312
335
 
313
336
  element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
337
+ $rootScope.$digest();
314
338
  expect(element[0].href).toEqual("http://example.com/image.png");
315
339
  });
316
340
 
317
341
  it("should accept trusted values for non-trusted URI values", () => {
318
342
  $rootScope.testUrl = $sce.trustAsUrl("javascript:foo()"); // `javascript` is not trusted
319
343
  let element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
344
+ $rootScope.$digest();
320
345
  expect(element[0].href).toEqual("javascript:foo()");
321
346
 
322
347
  element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
348
+ $rootScope.$digest();
323
349
  expect(element[0].href).toEqual("javascript:foo()");
324
350
  });
325
351
 
326
352
  it("should sanitize non-trusted values", () => {
327
353
  $rootScope.testUrl = "javascript:foo()"; // `javascript` is not trusted
328
354
  let element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
355
+ $rootScope.$digest();
329
356
  expect(element[0].href).toEqual("unsafe:javascript:foo()");
330
357
 
331
358
  element = $compile('<a ng-prop-href="testUrl"></a>')($rootScope);
359
+ $rootScope.$digest();
332
360
  expect(element[0].href).toEqual("unsafe:javascript:foo()");
333
361
  });
334
362
 
@@ -383,9 +411,16 @@ fdescribe("ngProp*", () => {
383
411
  "<foo ng-prop-href=\"'http://example.com/' + testUrl\"></foo><foo ng-prop-href=\"::'http://example.com/' + testUrl\"></foo>",
384
412
  )($rootScope);
385
413
  $rootScope.testUrl = [1];
414
+ $rootScope.$digest();
415
+
386
416
  $rootScope.testUrl = [];
417
+ $rootScope.$digest();
418
+
387
419
  $rootScope.testUrl = { a: "b" };
420
+ $rootScope.$digest();
421
+
388
422
  $rootScope.testUrl = {};
423
+ $rootScope.$digest();
389
424
  });
390
425
  });
391
426
 
@@ -603,6 +638,7 @@ fdescribe("ngProp*", () => {
603
638
  $rootScope,
604
639
  );
605
640
  $rootScope.html = '<div onclick="">hello</div>';
641
+ $rootScope.$digest();
606
642
  expect(element.html()).toEqual('<div onclick="">hello</div>');
607
643
  });
608
644
 
@@ -611,8 +647,10 @@ fdescribe("ngProp*", () => {
611
647
  $rootScope,
612
648
  );
613
649
  $rootScope.html = "hello";
650
+ $rootScope.$digest();
614
651
  expect(element.html()).toEqual("hello");
615
652
  $rootScope.html = "goodbye";
653
+ $rootScope.$digest();
616
654
  expect(element.html()).toEqual("goodbye");
617
655
  });
618
656
 
@@ -622,9 +660,11 @@ fdescribe("ngProp*", () => {
622
660
  );
623
661
  $rootScope.html = '<div onclick="">hello</div>';
624
662
  expect($rootScope.$$watchers.length).toEqual(1);
663
+ $rootScope.$digest();
625
664
  expect(element.text()).toEqual("hello");
626
665
  expect($rootScope.$$watchers.length).toEqual(0);
627
666
  $rootScope.html = '<div onclick="">hello</div>';
667
+ $rootScope.$digest();
628
668
  expect(element.text()).toEqual("hello");
629
669
  });
630
670
  });
@@ -648,7 +688,9 @@ fdescribe("ngProp*", () => {
648
688
  $rootScope,
649
689
  );
650
690
  $rootScope.html = '<div onclick="">hello</div>';
651
- expect(() => {}).toThrowError(/unsafe/);
691
+ expect(() => {
692
+ $rootScope.$digest();
693
+ }).toThrowError(/unsafe/);
652
694
  });
653
695
 
654
696
  it("should NOT set html for wrongly typed values", () => {
@@ -656,7 +698,9 @@ fdescribe("ngProp*", () => {
656
698
  $rootScope,
657
699
  );
658
700
  $rootScope.html = $sce.trustAsCss('<div onclick="">hello</div>');
659
- expect(() => {}).toThrowError(/unsafe/);
701
+ expect(() => {
702
+ $rootScope.$digest();
703
+ }).toThrowError(/unsafe/);
660
704
  });
661
705
 
662
706
  it("should set html for trusted values", () => {
@@ -664,6 +708,7 @@ fdescribe("ngProp*", () => {
664
708
  $rootScope,
665
709
  );
666
710
  $rootScope.html = $sce.trustAsHtml('<div onclick="">hello</div>');
711
+ $rootScope.$digest();
667
712
  expect(element.html()).toEqual('<div onclick="">hello</div>');
668
713
  });
669
714
 
@@ -672,8 +717,10 @@ fdescribe("ngProp*", () => {
672
717
  $rootScope,
673
718
  );
674
719
  $rootScope.html = $sce.trustAsHtml("hello");
720
+ $rootScope.$digest();
675
721
  expect(element.html()).toEqual("hello");
676
722
  $rootScope.html = $sce.trustAsHtml("goodbye");
723
+ $rootScope.$digest();
677
724
  expect(element.html()).toEqual("goodbye");
678
725
  });
679
726
 
@@ -687,6 +734,7 @@ fdescribe("ngProp*", () => {
687
734
  $rootScope.getHtml = function () {
688
735
  return $sce.trustAsHtml('<div onclick="">hello</div>');
689
736
  };
737
+ $rootScope.$digest();
690
738
  expect(element.html()).toEqual('<div onclick="">hello</div>');
691
739
  });
692
740
 
@@ -727,8 +775,10 @@ fdescribe("ngProp*", () => {
727
775
  $rootScope.getHtml = function () {
728
776
  return $sce.trustAsHtml(html);
729
777
  };
778
+ $rootScope.$digest();
730
779
  expect(element.html()).toEqual("hello");
731
780
  html = "goodbye";
781
+ $rootScope.$digest();
732
782
  expect(element.html()).toEqual("goodbye");
733
783
  });
734
784
  });
@@ -738,18 +788,24 @@ fdescribe("ngProp*", () => {
738
788
  it("should NOT set style for untrusted values", () => {
739
789
  const element = $compile('<div ng-prop-style="style"></div>')($rootScope);
740
790
  $rootScope.style = "margin-left: 10px";
741
- expect(() => {}).toThrowError(/unsafe/);
791
+ expect(() => {
792
+ $rootScope.$digest();
793
+ }).toThrowError(/unsafe/);
742
794
  });
743
795
 
744
796
  it("should NOT set style for wrongly typed values", () => {
745
797
  const element = $compile('<div ng-prop-style="style"></div>')($rootScope);
746
798
  $rootScope.style = $sce.trustAsHtml("margin-left: 10px");
747
- expect(() => {}).toThrowError(/unsafe/);
799
+ expect(() => {
800
+ $rootScope.$digest();
801
+ }).toThrowError(/unsafe/);
748
802
  });
749
803
 
750
804
  it("should set style for trusted values", () => {
751
805
  const element = $compile('<div ng-prop-style="style"></div>')($rootScope);
752
806
  $rootScope.style = $sce.trustAsCss("margin-left: 10px");
807
+ $rootScope.$digest();
808
+
753
809
  expect(element[0].style["margin-left"]).toEqual("10px");
754
810
  });
755
811
  });
@@ -0,0 +1,18 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>AngularTS Test Runner</title>
6
+
7
+ <link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
8
+ <link rel="stylesheet" href="/jasmine/jasmine-5.1.2/jasmine.css" />
9
+ <script src="/jasmine/jasmine-5.1.2/jasmine.js"></script>
10
+ <script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
11
+ <script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
12
+ <script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
13
+ <script type="module" src="/src/core/q/q.spec.js"></script>
14
+ </head>
15
+ <body>
16
+ <div id="dummy"></div>
17
+ </body>
18
+ </html>