@angular-wave/angular.ts 0.0.62 → 0.0.64

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 (115) 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/src/angular.spec.js +13 -27
  6. package/src/animations/animate-css-driver.js +1 -1
  7. package/src/animations/animate-queue.js +9 -0
  8. package/src/animations/module.js +2 -2
  9. package/src/binding.spec.js +6 -3
  10. package/src/core/animate/animate.spec.js +1 -3
  11. package/src/core/cache/cache-factory.spec.js +2 -2
  12. package/src/core/compile/compile.js +0 -33
  13. package/src/core/compile/compile.spec.js +64 -104
  14. package/src/core/controller/controller.spec.js +2 -2
  15. package/src/core/cookie-reader.spec.js +2 -2
  16. package/src/core/filter/filter.spec.js +4 -4
  17. package/src/core/interpolate/interpolate.spec.js +2 -2
  18. package/src/core/interval/interval.spec.js +10 -7
  19. package/src/core/location/location.js +7 -0
  20. package/src/core/location/location.spec.js +2 -2
  21. package/src/core/ng-module.js +167 -0
  22. package/src/core/on.spec.js +2 -2
  23. package/src/core/parser/lexer.spec.js +11 -8
  24. package/src/core/parser/parse.spec.js +11 -8
  25. package/src/core/prop.spec.js +47 -35
  26. package/src/core/q/q.spec.js +6 -6
  27. package/src/core/root-element.spec.js +0 -2
  28. package/src/core/sce/sce.spec.js +7 -6
  29. package/src/core/scope/scope.spec.js +11 -8
  30. package/src/core/timeout/timeout.spec.js +10 -7
  31. package/src/directive/attrs/attrs.spec.js +4 -3
  32. package/src/directive/attrs/boolean.spec.js +2 -2
  33. package/src/directive/attrs/element-style.spec.js +4 -3
  34. package/src/directive/attrs/src.spec.js +7 -5
  35. package/src/directive/bind/bind.spec.js +10 -7
  36. package/src/directive/bind/bing-html.spec.js +2 -2
  37. package/src/directive/change/change.spec.js +2 -2
  38. package/src/directive/class/class.spec.js +2 -2
  39. package/src/directive/cloak/cloak.spec.js +2 -2
  40. package/src/directive/controller/controller.spec.js +2 -3
  41. package/src/directive/events/click.spec.js +2 -2
  42. package/src/directive/events/event.spec.js +16 -13
  43. package/src/directive/form/form.spec.js +11 -9
  44. package/src/directive/if/if.spec.js +2 -3
  45. package/src/directive/include/include.spec.js +11 -10
  46. package/src/directive/init/init.spec.js +3 -4
  47. package/src/directive/input/input.spec.js +10 -7
  48. package/src/directive/list/list.spec.js +2 -2
  49. package/src/directive/model/model.spec.js +11 -11
  50. package/src/directive/model-options/model-options.spec.js +11 -9
  51. package/src/directive/non-bindable/non-bindable.spec.js +10 -7
  52. package/src/directive/options/options.spec.js +10 -7
  53. package/src/directive/ref/href.spec.js +11 -8
  54. package/src/directive/ref/ref.spec.js +10 -7
  55. package/src/directive/repeat/repeat.spec.js +11 -10
  56. package/src/directive/script/script.spec.js +4 -3
  57. package/src/directive/select/select.spec.js +10 -7
  58. package/src/directive/show-hide/show-hide.spec.js +4 -3
  59. package/src/directive/style/style.spec.js +9 -6
  60. package/src/directive/switch/switch.spec.js +2 -2
  61. package/src/directive/validators/validators.spec.js +12 -9
  62. package/src/exts/aria/aria.js +2 -2
  63. package/src/exts/aria/aria.spec.js +2 -2
  64. package/src/exts/messages/messages.js +2 -2
  65. package/src/exts/messages/messages.spec.js +2 -2
  66. package/src/filters/filter.spec.js +4 -3
  67. package/src/filters/filters.spec.js +4 -3
  68. package/src/filters/limit-to.spec.js +4 -3
  69. package/src/filters/order-by.spec.js +7 -5
  70. package/src/index.js +2 -8
  71. package/src/injector.js +7 -0
  72. package/src/injector.spec.js +26 -29
  73. package/src/loader.js +133 -1126
  74. package/src/loader.md +142 -0
  75. package/src/loader.spec.js +5 -9
  76. package/src/public.js +113 -107
  77. package/src/public.spec.js +2 -4
  78. package/src/router/directives/state-directives.spec.js +0 -3
  79. package/src/router/directives/view-directive.spec.js +0 -6
  80. package/src/router/index.js +2 -2
  81. package/src/router/services.spec.js +0 -2
  82. package/src/router/state/state.spec.js +2 -4
  83. package/src/router/state-filter.spec.js +0 -2
  84. package/src/router/template-factory.spec.js +0 -2
  85. package/src/router/url/url-service.spec.js +0 -2
  86. package/src/router/view/view.spec.js +1 -2
  87. package/src/router/view-hook.spec.js +0 -2
  88. package/src/router/view-scroll.spec.js +0 -3
  89. package/src/services/http/http.spec.js +2 -2
  90. package/src/services/http/template-request.spec.js +3 -3
  91. package/src/services/http-backend/http-backend.spec.js +3 -2
  92. package/src/shared/jqlite/jqlite.js +20 -29
  93. package/src/shared/jqlite/jqlite.md +62 -0
  94. package/src/shared/jqlite/jqlite.spec.js +3 -4
  95. package/src/shared/min-err.spec.js +1 -2
  96. package/src/shared/test-utils.js +1 -1
  97. package/src/shared/utils.js +36 -2
  98. package/src/types.js +3 -4
  99. package/types/animations/animate-css-driver.d.ts +2 -1
  100. package/types/animations/animate-queue.d.ts +2 -1
  101. package/types/animations/module.d.ts +1 -1
  102. package/types/core/compile/compile.d.ts +0 -1
  103. package/types/core/location/location.d.ts +2 -1
  104. package/types/core/ng-module.d.ts +57 -0
  105. package/types/exts/aria/aria.d.ts +1 -1
  106. package/types/exts/messages/messages.d.ts +1 -1
  107. package/types/index.d.ts +0 -3
  108. package/types/injector.d.ts +7 -7
  109. package/types/loader.d.ts +69 -267
  110. package/types/public.d.ts +6 -1
  111. package/types/router/index.d.ts +1 -1
  112. package/types/shared/jqlite/jqlite.d.ts +5 -5
  113. package/types/shared/test-utils.d.ts +3 -2
  114. package/types/shared/utils.d.ts +20 -1
  115. package/types/types.d.ts +3 -3
@@ -0,0 +1,167 @@
1
+ import { isFunction, isDefined, isObject, minErr } from "../shared/utils";
2
+
3
+ const ngMinErr = minErr("ng");
4
+
5
+ export class NgModule {
6
+ /**
7
+ *
8
+ * @param {String} name - Name of the module
9
+ * @param {Array<String>} requires - List of modules which the injector will load before the current module
10
+ * @param {Function} [configFn]
11
+ */
12
+ constructor(name, requires, configFn) {
13
+ /**
14
+ * @type {string}
15
+ * Name of the module.
16
+ */
17
+ this.name = name;
18
+ /**
19
+ * Holds the list of modules which the injector will load before the current module is
20
+ * loaded.
21
+ */
22
+ this.requires = requires;
23
+
24
+ this.configFn = configFn;
25
+
26
+ /** @type {!Array.<Array.<*>>} */
27
+ this._invokeQueue = [];
28
+
29
+ /** @type {!Array.<any>} */
30
+ this._configBlocks = [];
31
+
32
+ /** @type {!Array.<Function>} */
33
+ this._runBlocks = [];
34
+
35
+ /** @type {Object} */
36
+ this.infoState = {};
37
+
38
+ if (configFn) {
39
+ this.config(configFn);
40
+ }
41
+ }
42
+
43
+ /**
44
+ *
45
+ * @param {Object} value
46
+ * @returns
47
+ */
48
+ info(value) {
49
+ if (isDefined(value)) {
50
+ if (!isObject(value))
51
+ throw ngMinErr("aobj", "Argument '{0}' must be an object", "value");
52
+ this.infoState = value;
53
+ return this;
54
+ }
55
+ return this.infoState;
56
+ }
57
+
58
+ /**
59
+ * @param {String} name
60
+ * @param {any} object
61
+ * @returns {NgModule}
62
+ */
63
+ value(name, object) {
64
+ this._invokeQueue.push(["$provide", "value", [name, object]]);
65
+ return this;
66
+ }
67
+
68
+ /**
69
+ * @param {String} name
70
+ * @param {any} object
71
+ * @returns {NgModule}
72
+ */
73
+ constant(name, object) {
74
+ this._invokeQueue.unshift(["$provide", "constant", [name, object]]);
75
+ return this;
76
+ }
77
+
78
+ config(configFn) {
79
+ this._configBlocks.push(["$injector", "invoke", [configFn]]);
80
+ return this;
81
+ }
82
+
83
+ run(block) {
84
+ this._runBlocks.push(block);
85
+ return this;
86
+ }
87
+
88
+ component(name, options) {
89
+ if (options && isFunction(options)) {
90
+ options.$$moduleName = name;
91
+ }
92
+ this._invokeQueue.push(["$compileProvider", "component", [name, options]]);
93
+ return this;
94
+ }
95
+
96
+ factory(name, providerFunction) {
97
+ if (providerFunction && isFunction(providerFunction)) {
98
+ providerFunction.$$moduleName = name;
99
+ }
100
+ this._invokeQueue.push(["$provide", "factory", [name, providerFunction]]);
101
+ return this;
102
+ }
103
+
104
+ service(name, serviceFunction) {
105
+ if (serviceFunction && isFunction(serviceFunction)) {
106
+ serviceFunction.$$moduleName = name;
107
+ }
108
+ this._invokeQueue.push(["$provide", "service", [name, serviceFunction]]);
109
+ return this;
110
+ }
111
+
112
+ provider(name, providerType) {
113
+ if (providerType && isFunction(providerType)) {
114
+ providerType.$$moduleName = name;
115
+ }
116
+ this._invokeQueue.push(["$provide", "provider", [name, providerType]]);
117
+ return this;
118
+ }
119
+
120
+ decorator(name, decorFn) {
121
+ if (decorFn && isFunction(decorFn)) {
122
+ decorFn.$$moduleName = name;
123
+ }
124
+ this._configBlocks.push(["$provide", "decorator", [name, decorFn]]);
125
+ return this;
126
+ }
127
+
128
+ directive(name, directiveFactory) {
129
+ if (directiveFactory && isFunction(directiveFactory)) {
130
+ directiveFactory.$$moduleName = name;
131
+ }
132
+ this._invokeQueue.push([
133
+ "$compileProvider",
134
+ "directive",
135
+ [name, directiveFactory],
136
+ ]);
137
+ return this;
138
+ }
139
+
140
+ animation(name, animationFactory) {
141
+ if (animationFactory && isFunction(animationFactory)) {
142
+ animationFactory.$$moduleName = name;
143
+ }
144
+ this._invokeQueue.push([
145
+ "$animateProvider",
146
+ "register",
147
+ [name, animationFactory],
148
+ ]);
149
+ return this;
150
+ }
151
+
152
+ filter(name, filterFn) {
153
+ if (filterFn && isFunction(filterFn)) {
154
+ filterFn.$$moduleName = name;
155
+ }
156
+ this._invokeQueue.push(["$filterProvider", "register", [name, filterFn]]);
157
+ return this;
158
+ }
159
+
160
+ controller(name, ctlFn) {
161
+ if (ctlFn && isFunction(ctlFn)) {
162
+ ctlFn.$$moduleName = name;
163
+ }
164
+ this._invokeQueue.push(["$controllerProvider", "register", [name, ctlFn]]);
165
+ return this;
166
+ }
167
+ }
@@ -1,4 +1,4 @@
1
- import { publishExternalAPI } from "../public";
1
+ import { Angular } from "../loader";
2
2
  import { createInjector } from "../injector";
3
3
  import { valueFn } from "../shared/utils";
4
4
 
@@ -6,7 +6,7 @@ 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,5 +1,5 @@
1
1
  import { Lexer } from "./lexer";
2
- import { publishExternalAPI } from "../../public";
2
+ import { Angular } from "../../loader";
3
3
  import { createInjector } from "../../injector";
4
4
 
5
5
  describe("lexer", () => {
@@ -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
11
  import { createInjector } from "../../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";
1
+ import { Angular } from "../loader";
2
2
  import { createInjector } from "../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,6 @@
1
1
  import { createInjector } from "../../injector";
2
2
  import { setupModuleLoader } from "../../loader";
3
- import { publishExternalAPI } from "../../public";
3
+ import { Angular } from "../../loader";
4
4
 
5
5
  /**
6
6
  http://wiki.commonjs.org/wiki/Promises
@@ -36,14 +36,14 @@ describe("q", () => {
36
36
  let $q, $rootScope, $injector;
37
37
 
38
38
  beforeEach(() => {
39
- publishExternalAPI();
39
+ window.angular = new Angular();
40
40
  $injector = createInjector(["ng"]);
41
41
  $q = $injector.get("$q");
42
42
  $rootScope = $injector.get("$rootScope");
43
43
  });
44
44
 
45
45
  it("sets up $q", function () {
46
- publishExternalAPI();
46
+ window.angular = new Angular();
47
47
  var injector = createInjector(["ng"]);
48
48
  expect(injector.has("$q")).toBe(true);
49
49
  });
@@ -645,7 +645,7 @@ describe("all", function () {
645
645
  let $q, $rootScope, $injector;
646
646
 
647
647
  beforeEach(() => {
648
- publishExternalAPI();
648
+ window.angular = new Angular();
649
649
  $injector = createInjector(["ng"]);
650
650
  $q = $injector.get("$q");
651
651
  $rootScope = $injector.get("$rootScope");
@@ -706,7 +706,7 @@ describe("all", function () {
706
706
 
707
707
  beforeEach(() => {
708
708
  setupModuleLoader(window);
709
- publishExternalAPI();
709
+ window.angular = new Angular();
710
710
  $injector = createInjector(["ng"]);
711
711
  $q = $injector.get("$q");
712
712
  $rootScope = $injector.get("$rootScope");
@@ -741,7 +741,7 @@ describe("all", function () {
741
741
 
742
742
  beforeEach(() => {
743
743
  setupModuleLoader(window);
744
- publishExternalAPI();
744
+ window.angular = new Angular();
745
745
  $injector = createInjector(["ng"]);
746
746
  $q = $injector.get("$q");
747
747
  $$q = $injector.get("$$q");
@@ -1,10 +1,8 @@
1
1
  import { JQLite, dealoc } from "../shared/jqlite/jqlite";
2
2
  import { Angular } from "../loader";
3
- import { publishExternalAPI } from "../public";
4
3
 
5
4
  describe("$rootElement", () => {
6
5
  let angular = new Angular();
7
- publishExternalAPI();
8
6
 
9
7
  it("should publish the bootstrap element into $rootElement", () => {
10
8
  const element = JQLite("<div></div>");
@@ -1,6 +1,6 @@
1
1
  import { createInjector } from "../../injector";
2
2
 
3
- import { publishExternalAPI } from "../../public";
3
+ import { Angular } from "../../loader";
4
4
  import { adjustMatcher } from "./sce";
5
5
 
6
6
  describe("SCE", () => {
@@ -10,9 +10,10 @@ describe("SCE", () => {
10
10
 
11
11
  describe("when disabled", () => {
12
12
  beforeEach(function () {
13
- publishExternalAPI();
13
+ window.angular = new Angular();
14
+ window.angular.module("myModule", ["ng"]);
14
15
  createInjector([
15
- "ng",
16
+ "myModule",
16
17
  function ($sceProvider) {
17
18
  $sceProvider.enabled(false);
18
19
  },
@@ -34,7 +35,7 @@ describe("SCE", () => {
34
35
 
35
36
  describe("when enabled", () => {
36
37
  beforeEach(function () {
37
- publishExternalAPI();
38
+ window.angular = new Angular();
38
39
  createInjector([
39
40
  "ng",
40
41
  function ($sceProvider) {
@@ -145,7 +146,7 @@ describe("SCE", () => {
145
146
 
146
147
  describe("replace $sceDelegate", () => {
147
148
  it("should override the default $sce.trustAs/valueOf/etc.", () => {
148
- publishExternalAPI();
149
+ window.angular = new Angular();
149
150
  createInjector([
150
151
  "ng",
151
152
  function ($provide) {
@@ -175,7 +176,7 @@ describe("SCE", () => {
175
176
  });
176
177
 
177
178
  describe("$sce.parseAs", () => {
178
- publishExternalAPI();
179
+ window.angular = new Angular();
179
180
  beforeEach(function () {
180
181
  createInjector(["ng"]).invoke((_$sce_, _$rootScope_) => {
181
182
  $sce = _$sce_;
@@ -1,6 +1,6 @@
1
1
  import { $$asyncQueue } from "./scope";
2
2
  import { extend, sliceArgs } from "../../shared/utils";
3
- import { publishExternalAPI } from "../../public";
3
+ import { Angular } from "../../loader";
4
4
  import { createInjector } from "../../injector";
5
5
 
6
6
  describe("Scope", function () {
@@ -12,14 +12,17 @@ describe("Scope", function () {
12
12
  beforeEach(() => {
13
13
  logs = [];
14
14
  delete window.angular;
15
- publishExternalAPI().decorator("$exceptionHandler", function () {
16
- return (exception, cause) => {
17
- logs.push(exception);
18
- console.error(exception, cause);
19
- };
20
- });
15
+ window.angular = new Angular();
16
+ window.angular
17
+ .module("myModule", ["ng"])
18
+ .decorator("$exceptionHandler", function () {
19
+ return (exception, cause) => {
20
+ logs.push(exception);
21
+ console.error(exception, cause);
22
+ };
23
+ });
21
24
 
22
- let injector = createInjector(["ng"]);
25
+ let injector = createInjector(["myModule"]);
23
26
  $parse = injector.get("$parse");
24
27
  $browser = injector.get("$browser");
25
28
 
@@ -1,4 +1,4 @@
1
- import { publishExternalAPI } from "../../public";
1
+ import { Angular } from "../../loader";
2
2
  import { createInjector } from "../../injector";
3
3
  import { wait } from "../../shared/test-utils";
4
4
 
@@ -14,12 +14,15 @@ describe("$timeout", () => {
14
14
  beforeEach(() => {
15
15
  errors = [];
16
16
  log = [];
17
- publishExternalAPI().decorator("$exceptionHandler", function () {
18
- return (exception) => {
19
- errors.push(exception);
20
- };
21
- });
22
- injector = createInjector(["ng"]);
17
+ window.angular = new Angular();
18
+ window.angular
19
+ .module("myModule", ["ng"])
20
+ .decorator("$exceptionHandler", function () {
21
+ return (exception) => {
22
+ errors.push(exception);
23
+ };
24
+ });
25
+ injector = createInjector(["myModule"]);
23
26
 
24
27
  $interval = injector.get("$interval");
25
28
  $rootScope = injector.get("$rootScope");
@@ -1,4 +1,4 @@
1
- import { publishExternalAPI } from "../../public";
1
+ import { Angular } from "../../loader";
2
2
  import { createInjector } from "../../injector";
3
3
  import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
4
4
 
@@ -8,8 +8,9 @@ describe("ngSrcset", () => {
8
8
  let element;
9
9
 
10
10
  beforeEach(() => {
11
- publishExternalAPI();
12
- createInjector(["ng"]).invoke(($rootScope, _$compile_) => {
11
+ window.angular = new Angular();
12
+ window.angular.module("myModule", ["ng"]);
13
+ createInjector(["myModule"]).invoke(($rootScope, _$compile_) => {
13
14
  $scope = $rootScope.$new();
14
15
  $compile = _$compile_;
15
16
  });
@@ -1,4 +1,4 @@
1
- import { publishExternalAPI } from "../../public";
1
+ import { Angular } from "../../loader";
2
2
  import { createInjector } from "../../injector";
3
3
  import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
4
4
 
@@ -6,7 +6,7 @@ describe("boolean attr directives", () => {
6
6
  let element, $rootScope, $compile, $rootElement;
7
7
 
8
8
  beforeEach(() => {
9
- publishExternalAPI();
9
+ window.angular = new Angular();
10
10
  createInjector([
11
11
  "ng",
12
12
  ($provide) => {
@@ -1,4 +1,4 @@
1
- import { publishExternalAPI } from "../../public";
1
+ import { Angular } from "../../loader";
2
2
  import { createInjector } from "../../injector";
3
3
  import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
4
4
 
@@ -8,8 +8,9 @@ describe("style", () => {
8
8
  let element;
9
9
 
10
10
  beforeEach(() => {
11
- publishExternalAPI();
12
- createInjector(["ng"]).invoke((_$rootScope_, _$compile_) => {
11
+ window.angular = new Angular();
12
+ window.angular.module("myModule", ["ng"]);
13
+ createInjector(["myModule"]).invoke((_$rootScope_, _$compile_) => {
13
14
  $rootScope = _$rootScope_;
14
15
  $compile = _$compile_;
15
16
  });
@@ -1,4 +1,4 @@
1
- import { publishExternalAPI } from "../../public";
1
+ import { Angular } from "../../loader";
2
2
  import { createInjector } from "../../injector";
3
3
  import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
4
4
 
@@ -8,8 +8,9 @@ describe("ngSrc", () => {
8
8
  let element;
9
9
 
10
10
  beforeEach(() => {
11
- publishExternalAPI();
12
- createInjector(["ng"]).invoke(($rootScope, _$compile_) => {
11
+ window.angular = new Angular();
12
+ window.angular.module("myModule", ["ng"]);
13
+ createInjector(["myModule"]).invoke(($rootScope, _$compile_) => {
13
14
  $scope = $rootScope.$new();
14
15
  $compile = _$compile_;
15
16
  });
@@ -84,8 +85,9 @@ describe("ngSrc", () => {
84
85
  let $sce;
85
86
 
86
87
  beforeEach(() => {
87
- publishExternalAPI();
88
- createInjector(["ng"]).invoke(($rootScope, _$compile_, _$sce_) => {
88
+ window.angular = new Angular();
89
+ window.angular.module("myModule", ["ng"]);
90
+ createInjector(["myModule"]).invoke(($rootScope, _$compile_, _$sce_) => {
89
91
  $scope = $rootScope.$new();
90
92
  $compile = _$compile_;
91
93
  $sce = _$sce_;