@angular-wave/angular.ts 0.0.63 → 0.0.65

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 (113) hide show
  1. package/Makefile +6 -2
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -2
  4. package/package.json +1 -1
  5. package/public/jasmine/jasmine-5.1.2/jasmine-html.js +0 -1
  6. package/src/angular.spec.js +14 -19
  7. package/src/animations/module.js +2 -2
  8. package/src/binding.spec.js +7 -4
  9. package/src/core/animate/animate.spec.js +2 -4
  10. package/src/core/cache/cache-factory.spec.js +3 -3
  11. package/src/core/compile/compile.spec.js +66 -60
  12. package/src/core/controller/controller.spec.js +3 -3
  13. package/src/core/cookie-reader.spec.js +3 -3
  14. package/src/core/di/injector.html +18 -0
  15. package/src/{injector.js → core/di/injector.js} +58 -45
  16. package/src/{injector.spec.js → core/di/injector.spec.js} +44 -34
  17. package/src/core/di/injector.test.js +12 -0
  18. package/src/core/di/ng-module.html +18 -0
  19. package/src/core/di/ng-module.js +202 -0
  20. package/src/core/di/ng-module.spec.js +269 -0
  21. package/src/core/di/ng-module.test.js +12 -0
  22. package/src/core/filter/filter.spec.js +5 -5
  23. package/src/core/interpolate/interpolate.spec.js +3 -3
  24. package/src/core/interval/interval.spec.js +11 -8
  25. package/src/core/location/location.spec.js +3 -3
  26. package/src/core/on.spec.js +3 -3
  27. package/src/core/parser/lexer.spec.js +12 -9
  28. package/src/core/parser/parse.spec.js +12 -9
  29. package/src/core/prop.spec.js +48 -36
  30. package/src/core/q/q.spec.js +7 -10
  31. package/src/core/q/q.test.js +12 -0
  32. package/src/core/root-element.spec.js +0 -2
  33. package/src/core/sce/sce.spec.js +8 -7
  34. package/src/core/scope/scope.js +0 -1
  35. package/src/core/scope/scope.spec.js +12 -9
  36. package/src/core/timeout/timeout.spec.js +11 -8
  37. package/src/directive/attrs/attrs.spec.js +6 -5
  38. package/src/directive/attrs/boolean.spec.js +3 -3
  39. package/src/directive/attrs/element-style.spec.js +5 -4
  40. package/src/directive/attrs/src.spec.js +9 -7
  41. package/src/directive/bind/bind.spec.js +12 -9
  42. package/src/directive/bind/bing-html.spec.js +3 -3
  43. package/src/directive/change/change.spec.js +3 -3
  44. package/src/directive/class/class.spec.js +3 -3
  45. package/src/directive/cloak/cloak.spec.js +3 -3
  46. package/src/directive/controller/controller.spec.js +3 -4
  47. package/src/directive/events/click.spec.js +4 -4
  48. package/src/directive/events/event.spec.js +16 -13
  49. package/src/directive/form/form.spec.js +12 -10
  50. package/src/directive/if/if.spec.js +2 -3
  51. package/src/directive/include/include.spec.js +12 -11
  52. package/src/directive/init/init.spec.js +3 -4
  53. package/src/directive/input/input.spec.js +11 -9
  54. package/src/directive/list/list.spec.js +4 -4
  55. package/src/directive/model/model.spec.js +12 -12
  56. package/src/directive/model-options/model-options.spec.js +12 -10
  57. package/src/directive/non-bindable/non-bindable.spec.js +12 -9
  58. package/src/directive/options/options.spec.js +11 -8
  59. package/src/directive/ref/href.spec.js +12 -9
  60. package/src/directive/ref/ref.spec.js +11 -8
  61. package/src/directive/repeat/repeat.spec.js +12 -11
  62. package/src/directive/script/script.spec.js +5 -4
  63. package/src/directive/select/select.spec.js +11 -8
  64. package/src/directive/show-hide/show-hide.spec.js +5 -4
  65. package/src/directive/style/style.spec.js +10 -7
  66. package/src/directive/switch/switch.spec.js +3 -3
  67. package/src/directive/validators/validators.spec.js +13 -10
  68. package/src/exts/aria/aria.js +2 -2
  69. package/src/exts/aria/aria.spec.js +3 -3
  70. package/src/exts/messages/messages.js +2 -2
  71. package/src/exts/messages/messages.spec.js +3 -3
  72. package/src/filters/filter.spec.js +5 -4
  73. package/src/filters/filters.spec.js +5 -4
  74. package/src/filters/limit-to.spec.js +5 -4
  75. package/src/filters/order-by.spec.js +8 -6
  76. package/src/index.js +2 -8
  77. package/src/loader.js +107 -539
  78. package/src/loader.md +142 -0
  79. package/src/loader.spec.js +8 -27
  80. package/src/public.js +113 -107
  81. package/src/public.spec.js +3 -5
  82. package/src/router/directives/state-directives.spec.js +0 -3
  83. package/src/router/directives/view-directive.spec.js +0 -6
  84. package/src/router/index.js +2 -2
  85. package/src/router/services.spec.js +0 -2
  86. package/src/router/state/state.spec.js +2 -4
  87. package/src/router/state-filter.spec.js +0 -2
  88. package/src/router/template-factory.spec.js +0 -2
  89. package/src/router/url/url-service.spec.js +0 -2
  90. package/src/router/view/view.spec.js +1 -2
  91. package/src/router/view-hook.spec.js +0 -2
  92. package/src/router/view-scroll.spec.js +0 -3
  93. package/src/services/http/http.spec.js +3 -3
  94. package/src/services/http/template-request.spec.js +4 -4
  95. package/src/services/http-backend/http-backend.spec.js +4 -3
  96. package/src/shared/jqlite/jqlite.js +0 -2
  97. package/src/shared/jqlite/jqlite.spec.js +4 -5
  98. package/src/shared/test-utils.js +1 -1
  99. package/src/shared/utils.js +10 -1
  100. package/src/src.html +0 -1
  101. package/types/animations/module.d.ts +1 -1
  102. package/types/core/di/injector.d.ts +12 -0
  103. package/types/core/di/ng-module.d.ts +79 -0
  104. package/types/exts/aria/aria.d.ts +1 -1
  105. package/types/exts/messages/messages.d.ts +1 -1
  106. package/types/index.d.ts +0 -3
  107. package/types/loader.d.ts +53 -179
  108. package/types/public.d.ts +6 -1
  109. package/types/router/index.d.ts +1 -1
  110. package/types/shared/test-utils.d.ts +3 -2
  111. package/types/shared/utils.d.ts +7 -1
  112. package/types/injector.d.ts +0 -12
  113. /package/src/{injector.md → core/di/injector.md} +0 -0
@@ -0,0 +1,269 @@
1
+ import {
2
+ INJECTOR_LITERAL,
3
+ NgModule,
4
+ PROVIDE_LITERAL,
5
+ COMPILE_LITERAL,
6
+ ANIMATION_LITERAL,
7
+ FILTER_LITERAL,
8
+ CONTROLLER_LITERAL,
9
+ } from "./ng-module";
10
+
11
+ describe("NgModule", () => {
12
+ /** @type {NgModule} */
13
+ let ngModule;
14
+ let a = new Object();
15
+ let b = () => {};
16
+ beforeEach(() => (ngModule = new NgModule("test", ["otherModule"])));
17
+
18
+ it("can be instantiated", () => {
19
+ expect(ngModule).toBeDefined();
20
+ expect(ngModule.name).toBeDefined();
21
+ expect(ngModule.requires).toEqual(["otherModule"]);
22
+ });
23
+
24
+ it("can't be instantiated without name or dependencies", () => {
25
+ expect(() => new NgModule()).toThrowError();
26
+ expect(() => new NgModule("test")).toThrowError();
27
+ });
28
+
29
+ it("can store info state as objects", () => {
30
+ expect(() => ngModule.info(false)).toThrowError();
31
+ ngModule.info({ a: 1 });
32
+ expect(ngModule.info().a).toBe(1);
33
+ });
34
+
35
+ it("can store constants", () => {
36
+ // when contants are registered
37
+ ngModule.constant("aConstant", 42);
38
+ expect(ngModule.invokeQueue[0]).toEqual([
39
+ PROVIDE_LITERAL,
40
+ "constant",
41
+ ["aConstant", 42],
42
+ ]);
43
+
44
+ // then they are prepended to invocation queue
45
+ ngModule.constant("bConstant", 24);
46
+ expect(ngModule.invokeQueue[0]).toEqual([
47
+ PROVIDE_LITERAL,
48
+ "constant",
49
+ ["bConstant", 24],
50
+ ]);
51
+ expect(ngModule.invokeQueue[1]).toEqual([
52
+ PROVIDE_LITERAL,
53
+ "constant",
54
+ ["aConstant", 42],
55
+ ]);
56
+ });
57
+
58
+ it("can store values", () => {
59
+ // when value are registered
60
+ ngModule.value("aValue", 42);
61
+ expect(ngModule.invokeQueue[0]).toEqual([
62
+ PROVIDE_LITERAL,
63
+ "value",
64
+ ["aValue", 42],
65
+ ]);
66
+
67
+ // then are pushed to invocation queue
68
+ ngModule.value("bValue", 24);
69
+ expect(ngModule.invokeQueue[1]).toEqual([
70
+ PROVIDE_LITERAL,
71
+ "value",
72
+ ["bValue", 24],
73
+ ]);
74
+ expect(ngModule.invokeQueue[0]).toEqual([
75
+ PROVIDE_LITERAL,
76
+ "value",
77
+ ["aValue", 42],
78
+ ]);
79
+ });
80
+
81
+ it("can store config blocks", () => {
82
+ // when config functions are registered
83
+ let fn1 = () => {};
84
+ let fn2 = () => {};
85
+ ngModule.config(fn1);
86
+ ngModule.config(fn2);
87
+
88
+ // then they are appended to config queue
89
+ expect(ngModule.configBlocks[0]).toEqual([
90
+ INJECTOR_LITERAL,
91
+ "invoke",
92
+ [fn1],
93
+ ]);
94
+ expect(ngModule.configBlocks[1]).toEqual([
95
+ INJECTOR_LITERAL,
96
+ "invoke",
97
+ [fn2],
98
+ ]);
99
+ });
100
+
101
+ it("can store components", () => {
102
+ ngModule.component("aComponent", a).component("bComponent", b);
103
+ expect(ngModule.invokeQueue[0]).toEqual([
104
+ COMPILE_LITERAL,
105
+ "component",
106
+ ["aComponent", a],
107
+ ]);
108
+
109
+ expect(ngModule.invokeQueue[1]).toEqual([
110
+ COMPILE_LITERAL,
111
+ "component",
112
+ ["bComponent", b],
113
+ ]);
114
+ // Objects do not get a name
115
+ expect(a.$$moduleName).toBeUndefined();
116
+ // Functions get a name
117
+ expect(b.$$moduleName).toBe("bComponent");
118
+ });
119
+
120
+ it("can store factories", () => {
121
+ ngModule.factory("aFactory", a).factory("bFactory", b);
122
+ expect(ngModule.invokeQueue[0]).toEqual([
123
+ PROVIDE_LITERAL,
124
+ "factory",
125
+ ["aFactory", a],
126
+ ]);
127
+
128
+ expect(ngModule.invokeQueue[1]).toEqual([
129
+ PROVIDE_LITERAL,
130
+ "factory",
131
+ ["bFactory", b],
132
+ ]);
133
+ // Objects do not get a name
134
+ expect(a.$$moduleName).toBeUndefined();
135
+ // Functions get a name
136
+ expect(b.$$moduleName).toBe("bFactory");
137
+ });
138
+
139
+ it("can store services", () => {
140
+ ngModule.service("aService", a).service("bService", b);
141
+ expect(ngModule.invokeQueue[0]).toEqual([
142
+ PROVIDE_LITERAL,
143
+ "service",
144
+ ["aService", a],
145
+ ]);
146
+
147
+ expect(ngModule.invokeQueue[1]).toEqual([
148
+ PROVIDE_LITERAL,
149
+ "service",
150
+ ["bService", b],
151
+ ]);
152
+ // Objects do not get a name
153
+ expect(a.$$moduleName).toBeUndefined();
154
+ // Functions get a name
155
+ expect(b.$$moduleName).toBe("bService");
156
+ });
157
+
158
+ it("can store providers", () => {
159
+ ngModule.provider("aProvider", a).provider("bProvider", b);
160
+ expect(ngModule.invokeQueue[0]).toEqual([
161
+ PROVIDE_LITERAL,
162
+ "provider",
163
+ ["aProvider", a],
164
+ ]);
165
+
166
+ expect(ngModule.invokeQueue[1]).toEqual([
167
+ PROVIDE_LITERAL,
168
+ "provider",
169
+ ["bProvider", b],
170
+ ]);
171
+ // Objects do not get a name
172
+ expect(a.$$moduleName).toBeUndefined();
173
+ // Functions get a name
174
+ expect(b.$$moduleName).toBe("bProvider");
175
+ });
176
+
177
+ it("can store decorators", () => {
178
+ ngModule.decorator("aDecorator", a).decorator("bDecorator", b);
179
+ expect(ngModule.configBlocks[0]).toEqual([
180
+ PROVIDE_LITERAL,
181
+ "decorator",
182
+ ["aDecorator", a],
183
+ ]);
184
+
185
+ expect(ngModule.configBlocks[1]).toEqual([
186
+ PROVIDE_LITERAL,
187
+ "decorator",
188
+ ["bDecorator", b],
189
+ ]);
190
+ // Objects do not get a name
191
+ expect(a.$$moduleName).toBeUndefined();
192
+ // Functions get a name
193
+ expect(b.$$moduleName).toBe("bDecorator");
194
+ });
195
+
196
+ it("can store directives", () => {
197
+ ngModule.directive("aDirective", a).directive("bDirective", b);
198
+ expect(ngModule.invokeQueue[0]).toEqual([
199
+ COMPILE_LITERAL,
200
+ "directive",
201
+ ["aDirective", a],
202
+ ]);
203
+
204
+ expect(ngModule.invokeQueue[1]).toEqual([
205
+ COMPILE_LITERAL,
206
+ "directive",
207
+ ["bDirective", b],
208
+ ]);
209
+ // Objects do not get a name
210
+ expect(a.$$moduleName).toBeUndefined();
211
+ // Functions get a name
212
+ expect(b.$$moduleName).toBe("bDirective");
213
+ });
214
+
215
+ it("can store animations", () => {
216
+ ngModule.animation("aAnimation", a).animation("bAnimation", b);
217
+ expect(ngModule.invokeQueue[0]).toEqual([
218
+ ANIMATION_LITERAL,
219
+ "register",
220
+ ["aAnimation", a],
221
+ ]);
222
+
223
+ expect(ngModule.invokeQueue[1]).toEqual([
224
+ ANIMATION_LITERAL,
225
+ "register",
226
+ ["bAnimation", b],
227
+ ]);
228
+ // Objects do not get a name
229
+ expect(a.$$moduleName).toBeUndefined();
230
+ // Functions get a name
231
+ expect(b.$$moduleName).toBe("bAnimation");
232
+ });
233
+
234
+ it("can store filters", () => {
235
+ ngModule.filter("aFilter", a).filter("bFilter", b);
236
+ expect(ngModule.invokeQueue[0]).toEqual([
237
+ FILTER_LITERAL,
238
+ "register",
239
+ ["aFilter", a],
240
+ ]);
241
+ expect(ngModule.invokeQueue[1]).toEqual([
242
+ FILTER_LITERAL,
243
+ "register",
244
+ ["bFilter", b],
245
+ ]);
246
+ // Objects do not get a name
247
+ expect(a.$$moduleName).toBeUndefined();
248
+ // Functions get a name
249
+ expect(b.$$moduleName).toBe("bFilter");
250
+ });
251
+
252
+ it("can store controllers", () => {
253
+ ngModule.controller("aController", a).controller("bController", b);
254
+ expect(ngModule.invokeQueue[0]).toEqual([
255
+ CONTROLLER_LITERAL,
256
+ "register",
257
+ ["aController", a],
258
+ ]);
259
+ expect(ngModule.invokeQueue[1]).toEqual([
260
+ CONTROLLER_LITERAL,
261
+ "register",
262
+ ["bController", b],
263
+ ]);
264
+ // Objects do not get a name
265
+ expect(a.$$moduleName).toBeUndefined();
266
+ // Functions get a name
267
+ expect(b.$$moduleName).toBe("bController");
268
+ });
269
+ });
@@ -0,0 +1,12 @@
1
+ import { test, expect } from "@playwright/test";
2
+
3
+ const TEST_URL = "src/core/di/ng-module.html";
4
+
5
+ test("unit tests contain no errors", async ({ page }) => {
6
+ await page.goto(TEST_URL);
7
+ await page.content();
8
+ await page.waitForTimeout(5000);
9
+ await expect(page.locator(".jasmine-overall-result")).toHaveText(
10
+ /0 failures/,
11
+ );
12
+ });
@@ -1,9 +1,9 @@
1
- import { publishExternalAPI } from "../../public";
2
- import { createInjector } from "../../injector";
1
+ import { Angular } from "../../loader";
2
+ import { createInjector } from "../../core/di/injector";
3
3
 
4
4
  describe("filter", function () {
5
5
  beforeEach(() => {
6
- publishExternalAPI();
6
+ window.angular = new Angular();
7
7
  });
8
8
  it("can be registered and obtained", () => {
9
9
  var myFilter = () => {};
@@ -83,7 +83,7 @@ describe("filter", function () {
83
83
 
84
84
  describe("filter filter", function () {
85
85
  beforeEach(function () {
86
- publishExternalAPI();
86
+ window.angular = new Angular();
87
87
  });
88
88
  it("is available", function () {
89
89
  var injector = createInjector(["ng"]);
@@ -97,7 +97,7 @@ describe("$filter", () => {
97
97
  let $filter;
98
98
 
99
99
  beforeEach(() => {
100
- publishExternalAPI();
100
+ window.angular = new Angular();
101
101
  const injector = createInjector([
102
102
  "ng",
103
103
  function (_$filterProvider_) {
@@ -1,11 +1,11 @@
1
- import { createInjector } from "../../injector";
2
- import { publishExternalAPI } from "../../public";
1
+ import { createInjector } from "../../core/di/injector";
2
+ import { Angular } from "../../loader";
3
3
 
4
4
  describe("$interpolate", () => {
5
5
  let $interpolate, $injector, $rootScope, $sce;
6
6
 
7
7
  beforeEach(() => {
8
- publishExternalAPI();
8
+ window.angular = new Angular();
9
9
  $injector = createInjector(["ng"]);
10
10
  $interpolate = $injector.get("$interpolate");
11
11
  $rootScope = $injector.get("$rootScope");
@@ -1,5 +1,5 @@
1
- import { publishExternalAPI } from "../../public";
2
- import { createInjector } from "../../injector";
1
+ import { Angular } from "../../loader";
2
+ import { createInjector } from "../../core/di/injector";
3
3
  import { wait } from "../../shared/test-utils";
4
4
 
5
5
  describe("$interval", () => {
@@ -10,12 +10,15 @@ describe("$interval", () => {
10
10
 
11
11
  beforeEach(() => {
12
12
  errors = [];
13
- publishExternalAPI().decorator("$exceptionHandler", () => {
14
- return (exception) => {
15
- errors.push(exception);
16
- };
17
- });
18
- injector = createInjector(["ng"]);
13
+ window.angular = new Angular();
14
+ window.angular
15
+ .module("myModule", ["ng"])
16
+ .decorator("$exceptionHandler", () => {
17
+ return (exception) => {
18
+ errors.push(exception);
19
+ };
20
+ });
21
+ injector = createInjector(["myModule"]);
19
22
 
20
23
  $interval = injector.get("$interval");
21
24
  $rootScope = injector.get("$rootScope");
@@ -4,13 +4,13 @@ import {
4
4
  $LocationProvider,
5
5
  LocationHashbangInHtml5Url,
6
6
  } from "./location";
7
- import { publishExternalAPI } from "../../public";
8
- import { createInjector } from "../../injector";
7
+ import { Angular } from "../../loader";
8
+ import { createInjector } from "../../core/di/injector";
9
9
 
10
10
  describe("$location", () => {
11
11
  let module;
12
12
  beforeEach(() => {
13
- publishExternalAPI();
13
+ window.angular = new Angular();
14
14
  module = window.angular.module("test1", ["ng"]);
15
15
  });
16
16
 
@@ -1,12 +1,12 @@
1
- import { publishExternalAPI } from "../public";
2
- import { createInjector } from "../injector";
1
+ import { Angular } from "../loader";
2
+ import { createInjector } from "./di/injector";
3
3
  import { valueFn } from "../shared/utils";
4
4
 
5
5
  describe("ngOn* event binding", () => {
6
6
  let $rootScope, module, injector, $compile;
7
7
 
8
8
  beforeEach(() => {
9
- publishExternalAPI();
9
+ window.angular = new Angular();
10
10
  module = window.angular.module("test1", ["ng"]);
11
11
  injector = createInjector(["ng", "test1"]);
12
12
  $rootScope = injector.get("$rootScope");
@@ -1,6 +1,6 @@
1
1
  import { Lexer } from "./lexer";
2
- import { publishExternalAPI } from "../../public";
3
- import { createInjector } from "../../injector";
2
+ import { Angular } from "../../loader";
3
+ import { createInjector } from "../../core/di/injector";
4
4
 
5
5
  describe("lexer", () => {
6
6
  let $rootScope;
@@ -8,13 +8,16 @@ describe("lexer", () => {
8
8
  let logs = [];
9
9
 
10
10
  beforeEach(() => {
11
- publishExternalAPI().decorator("$exceptionHandler", function () {
12
- return (exception, cause) => {
13
- logs.push(exception);
14
- console.error(exception, cause);
15
- };
16
- });
17
- let injector = createInjector(["ng"]);
11
+ window.angular = new Angular();
12
+ window.angular
13
+ .module("myModule", ["ng"])
14
+ .decorator("$exceptionHandler", function () {
15
+ return (exception, cause) => {
16
+ logs.push(exception);
17
+ console.error(exception, cause);
18
+ };
19
+ });
20
+ let injector = createInjector(["myModule"]);
18
21
  $parse = injector.get("$parse");
19
22
  $rootScope = injector.get("$rootScope");
20
23
  });
@@ -8,9 +8,9 @@ import {
8
8
  valueFn,
9
9
  extend,
10
10
  } from "../../shared/utils";
11
- import { publishExternalAPI } from "../../public";
12
- import { createInjector } from "../../injector";
11
+ import { createInjector } from "../../core/di/injector";
13
12
  import { ASTType } from "./ast-type";
13
+ import { Angular } from "../../loader";
14
14
 
15
15
  describe("parser", () => {
16
16
  let $rootScope;
@@ -19,13 +19,16 @@ describe("parser", () => {
19
19
  let logs = [];
20
20
 
21
21
  beforeEach(() => {
22
- publishExternalAPI().decorator("$exceptionHandler", function () {
23
- return (exception, cause) => {
24
- logs.push(exception);
25
- console.error(exception, cause);
26
- };
27
- });
28
- let injector = createInjector(["ng"]);
22
+ window.angular = new Angular();
23
+ window.angular
24
+ .module("myModule", ["ng"])
25
+ .decorator("$exceptionHandler", function () {
26
+ return (exception, cause) => {
27
+ logs.push(exception);
28
+ console.error(exception, cause);
29
+ };
30
+ });
31
+ let injector = createInjector(["myModule"]);
29
32
  $parse = injector.get("$parse");
30
33
  $rootScope = injector.get("$rootScope");
31
34
  });
@@ -1,21 +1,25 @@
1
- import { publishExternalAPI } from "../public";
2
- import { createInjector } from "../injector";
1
+ import { Angular } from "../loader";
2
+ import { createInjector } from "./di/injector";
3
3
  import { valueFn } from "../shared/utils";
4
4
 
5
- describe("ngProp*", () => {
5
+ fdescribe("ngProp*", () => {
6
6
  let $compile, $rootScope, compileProvider, $sce;
7
7
  let logs = [];
8
8
 
9
9
  beforeEach(() => {
10
10
  logs = [];
11
- publishExternalAPI().decorator("$exceptionHandler", function () {
12
- return (exception) => {
13
- logs.push(exception);
14
- throw new Error(exception);
15
- };
16
- });
11
+ window.angular = new Angular();
12
+ window.angular
13
+ .module("myModule", ["ng"])
14
+ .decorator("$exceptionHandler", function () {
15
+ return (exception) => {
16
+ logs.push(exception);
17
+ throw new Error(exception);
18
+ };
19
+ });
20
+
17
21
  let injector = createInjector([
18
- "ng",
22
+ "myModule",
19
23
  function ($compileProvider) {
20
24
  compileProvider = $compileProvider;
21
25
  },
@@ -282,7 +286,7 @@ describe("ngProp*", () => {
282
286
  .createSpy("$$sanitizeUri")
283
287
  .and.returnValue("someSanitizedUrl");
284
288
  createInjector([
285
- "ng",
289
+ "myModule",
286
290
  ($provide) => {
287
291
  $provide.value("$$sanitizeUri", $$sanitizeUri);
288
292
  },
@@ -303,7 +307,7 @@ describe("ngProp*", () => {
303
307
  .createSpy("$$sanitizeUri")
304
308
  .and.throwError("Should not have been called");
305
309
  createInjector([
306
- "ng",
310
+ "myModule",
307
311
  ($provide) => {
308
312
  $provide.value("$$sanitizeUri", $$sanitizeUri);
309
313
  },
@@ -378,7 +382,7 @@ describe("ngProp*", () => {
378
382
  .createSpy("$$sanitizeUri")
379
383
  .and.returnValue("someSanitizedUrl");
380
384
  createInjector([
381
- "ng",
385
+ "myModule",
382
386
  ($provide) => {
383
387
  $provide.value("$$sanitizeUri", $$sanitizeUri);
384
388
  },
@@ -421,11 +425,13 @@ describe("ngProp*", () => {
421
425
 
422
426
  describe("iframe[src]", () => {
423
427
  beforeEach(() => {
424
- createInjector(["ng"]).invoke((_$compile_, _$rootScope_, _$sce_) => {
425
- $compile = _$compile_;
426
- $rootScope = _$rootScope_;
427
- $sce = _$sce_;
428
- });
428
+ createInjector(["myModule"]).invoke(
429
+ (_$compile_, _$rootScope_, _$sce_) => {
430
+ $compile = _$compile_;
431
+ $rootScope = _$rootScope_;
432
+ $sce = _$sce_;
433
+ },
434
+ );
429
435
  });
430
436
 
431
437
  it("should pass through src properties for the same domain", () => {
@@ -482,11 +488,13 @@ describe("ngProp*", () => {
482
488
 
483
489
  describe("base[href]", () => {
484
490
  beforeEach(() => {
485
- createInjector(["ng"]).invoke((_$compile_, _$rootScope_, _$sce_) => {
486
- $compile = _$compile_;
487
- $rootScope = _$rootScope_;
488
- $sce = _$sce_;
489
- });
491
+ createInjector(["myModule"]).invoke(
492
+ (_$compile_, _$rootScope_, _$sce_) => {
493
+ $compile = _$compile_;
494
+ $rootScope = _$rootScope_;
495
+ $sce = _$sce_;
496
+ },
497
+ );
490
498
  });
491
499
 
492
500
  it("should be a RESOURCE_URL context", () => {
@@ -505,11 +513,13 @@ describe("ngProp*", () => {
505
513
 
506
514
  describe("form[action]", () => {
507
515
  beforeEach(() => {
508
- createInjector(["ng"]).invoke((_$compile_, _$rootScope_, _$sce_) => {
509
- $compile = _$compile_;
510
- $rootScope = _$rootScope_;
511
- $sce = _$sce_;
512
- });
516
+ createInjector(["myModule"]).invoke(
517
+ (_$compile_, _$rootScope_, _$sce_) => {
518
+ $compile = _$compile_;
519
+ $rootScope = _$rootScope_;
520
+ $sce = _$sce_;
521
+ },
522
+ );
513
523
  });
514
524
 
515
525
  it("should pass through action property for the same domain", () => {
@@ -566,11 +576,13 @@ describe("ngProp*", () => {
566
576
 
567
577
  describe("link[href]", () => {
568
578
  beforeEach(() => {
569
- createInjector(["ng"]).invoke((_$compile_, _$rootScope_, _$sce_) => {
570
- $compile = _$compile_;
571
- $rootScope = _$rootScope_;
572
- $sce = _$sce_;
573
- });
579
+ createInjector(["myModule"]).invoke(
580
+ (_$compile_, _$rootScope_, _$sce_) => {
581
+ $compile = _$compile_;
582
+ $rootScope = _$rootScope_;
583
+ $sce = _$sce_;
584
+ },
585
+ );
574
586
  });
575
587
 
576
588
  it("should reject invalid RESOURCE_URLs", () => {
@@ -606,7 +618,7 @@ describe("ngProp*", () => {
606
618
  describe("SCE disabled", () => {
607
619
  beforeEach(() => {
608
620
  createInjector([
609
- "ng",
621
+ "myModule",
610
622
  ($sceProvider) => {
611
623
  $sceProvider.enabled(false);
612
624
  },
@@ -656,7 +668,7 @@ describe("ngProp*", () => {
656
668
  describe("SCE enabled", () => {
657
669
  beforeEach(() => {
658
670
  createInjector([
659
- "ng",
671
+ "myModule",
660
672
  ($sceProvider) => {
661
673
  $sceProvider.enabled(true);
662
674
  },
@@ -728,7 +740,7 @@ describe("ngProp*", () => {
728
740
  }
729
741
 
730
742
  createInjector([
731
- "ng",
743
+ "myModule",
732
744
  ($provide) => {
733
745
  $provide.decorator("$sce", ($delegate) => {
734
746
  $delegate.trustAsHtml = function (html) {
@@ -1,6 +1,5 @@
1
- import { createInjector } from "../../injector";
2
- import { setupModuleLoader } from "../../loader";
3
- import { publishExternalAPI } from "../../public";
1
+ import { createInjector } from "../../core/di/injector";
2
+ import { Angular } from "../../loader";
4
3
 
5
4
  /**
6
5
  http://wiki.commonjs.org/wiki/Promises
@@ -36,14 +35,14 @@ describe("q", () => {
36
35
  let $q, $rootScope, $injector;
37
36
 
38
37
  beforeEach(() => {
39
- publishExternalAPI();
38
+ window.angular = new Angular();
40
39
  $injector = createInjector(["ng"]);
41
40
  $q = $injector.get("$q");
42
41
  $rootScope = $injector.get("$rootScope");
43
42
  });
44
43
 
45
44
  it("sets up $q", function () {
46
- publishExternalAPI();
45
+ window.angular = new Angular();
47
46
  var injector = createInjector(["ng"]);
48
47
  expect(injector.has("$q")).toBe(true);
49
48
  });
@@ -645,7 +644,7 @@ describe("all", function () {
645
644
  let $q, $rootScope, $injector;
646
645
 
647
646
  beforeEach(() => {
648
- publishExternalAPI();
647
+ window.angular = new Angular();
649
648
  $injector = createInjector(["ng"]);
650
649
  $q = $injector.get("$q");
651
650
  $rootScope = $injector.get("$rootScope");
@@ -705,8 +704,7 @@ describe("all", function () {
705
704
  let $q, $rootScope, $injector;
706
705
 
707
706
  beforeEach(() => {
708
- setupModuleLoader(window);
709
- publishExternalAPI();
707
+ window.angular = new Angular();
710
708
  $injector = createInjector(["ng"]);
711
709
  $q = $injector.get("$q");
712
710
  $rootScope = $injector.get("$rootScope");
@@ -740,8 +738,7 @@ describe("all", function () {
740
738
  let $q, $$q, $rootScope, $injector;
741
739
 
742
740
  beforeEach(() => {
743
- setupModuleLoader(window);
744
- publishExternalAPI();
741
+ window.angular = new Angular();
745
742
  $injector = createInjector(["ng"]);
746
743
  $q = $injector.get("$q");
747
744
  $$q = $injector.get("$$q");