@angular-wave/angular.ts 0.0.63 → 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.
- package/Makefile +6 -2
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/angular.spec.js +13 -18
- package/src/animations/module.js +2 -2
- package/src/binding.spec.js +6 -3
- package/src/core/animate/animate.spec.js +1 -3
- package/src/core/cache/cache-factory.spec.js +2 -2
- package/src/core/compile/compile.spec.js +64 -57
- package/src/core/controller/controller.spec.js +2 -2
- package/src/core/cookie-reader.spec.js +2 -2
- package/src/core/filter/filter.spec.js +4 -4
- package/src/core/interpolate/interpolate.spec.js +2 -2
- package/src/core/interval/interval.spec.js +10 -7
- package/src/core/location/location.spec.js +2 -2
- package/src/core/ng-module.js +167 -0
- package/src/core/on.spec.js +2 -2
- package/src/core/parser/lexer.spec.js +11 -8
- package/src/core/parser/parse.spec.js +11 -8
- package/src/core/prop.spec.js +47 -35
- package/src/core/q/q.spec.js +6 -6
- package/src/core/root-element.spec.js +0 -2
- package/src/core/sce/sce.spec.js +7 -6
- package/src/core/scope/scope.spec.js +11 -8
- package/src/core/timeout/timeout.spec.js +10 -7
- package/src/directive/attrs/attrs.spec.js +4 -3
- package/src/directive/attrs/boolean.spec.js +2 -2
- package/src/directive/attrs/element-style.spec.js +4 -3
- package/src/directive/attrs/src.spec.js +7 -5
- package/src/directive/bind/bind.spec.js +10 -7
- package/src/directive/bind/bing-html.spec.js +2 -2
- package/src/directive/change/change.spec.js +2 -2
- package/src/directive/class/class.spec.js +2 -2
- package/src/directive/cloak/cloak.spec.js +2 -2
- package/src/directive/controller/controller.spec.js +2 -3
- package/src/directive/events/click.spec.js +2 -2
- package/src/directive/events/event.spec.js +16 -13
- package/src/directive/form/form.spec.js +11 -9
- package/src/directive/if/if.spec.js +2 -3
- package/src/directive/include/include.spec.js +11 -10
- package/src/directive/init/init.spec.js +2 -3
- package/src/directive/input/input.spec.js +10 -7
- package/src/directive/list/list.spec.js +2 -2
- package/src/directive/model/model.spec.js +11 -11
- package/src/directive/model-options/model-options.spec.js +11 -9
- package/src/directive/non-bindable/non-bindable.spec.js +10 -7
- package/src/directive/options/options.spec.js +10 -7
- package/src/directive/ref/href.spec.js +11 -8
- package/src/directive/ref/ref.spec.js +10 -7
- package/src/directive/repeat/repeat.spec.js +11 -10
- package/src/directive/script/script.spec.js +4 -3
- package/src/directive/select/select.spec.js +10 -7
- package/src/directive/show-hide/show-hide.spec.js +4 -3
- package/src/directive/style/style.spec.js +9 -6
- package/src/directive/switch/switch.spec.js +2 -2
- package/src/directive/validators/validators.spec.js +12 -9
- package/src/exts/aria/aria.js +2 -2
- package/src/exts/aria/aria.spec.js +2 -2
- package/src/exts/messages/messages.js +2 -2
- package/src/exts/messages/messages.spec.js +2 -2
- package/src/filters/filter.spec.js +4 -3
- package/src/filters/filters.spec.js +4 -3
- package/src/filters/limit-to.spec.js +4 -3
- package/src/filters/order-by.spec.js +7 -5
- package/src/index.js +2 -8
- package/src/injector.spec.js +26 -29
- package/src/loader.js +106 -538
- package/src/loader.md +142 -0
- package/src/loader.spec.js +5 -9
- package/src/public.js +113 -107
- package/src/public.spec.js +2 -4
- package/src/router/directives/state-directives.spec.js +0 -3
- package/src/router/directives/view-directive.spec.js +0 -6
- package/src/router/index.js +2 -2
- package/src/router/services.spec.js +0 -2
- package/src/router/state/state.spec.js +2 -4
- package/src/router/state-filter.spec.js +0 -2
- package/src/router/template-factory.spec.js +0 -2
- package/src/router/url/url-service.spec.js +0 -2
- package/src/router/view/view.spec.js +1 -2
- package/src/router/view-hook.spec.js +0 -2
- package/src/router/view-scroll.spec.js +0 -3
- package/src/services/http/http.spec.js +2 -2
- package/src/services/http/template-request.spec.js +3 -3
- package/src/services/http-backend/http-backend.spec.js +3 -2
- package/src/shared/jqlite/jqlite.spec.js +3 -4
- package/src/shared/test-utils.js +1 -1
- package/types/animations/module.d.ts +1 -1
- package/types/core/ng-module.d.ts +57 -0
- package/types/exts/aria/aria.d.ts +1 -1
- package/types/exts/messages/messages.d.ts +1 -1
- package/types/index.d.ts +0 -3
- package/types/loader.d.ts +53 -179
- package/types/public.d.ts +6 -1
- package/types/router/index.d.ts +1 -1
- package/types/shared/test-utils.d.ts +3 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@angular-wave/angular.ts",
|
|
3
3
|
"description": "A modern, optimized and typesafe version of AngularJS",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.64",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/angular-ts.esm.js",
|
|
8
8
|
"browser": "dist/angular-ts.umd.js",
|
package/src/angular.spec.js
CHANGED
|
@@ -25,8 +25,7 @@ import {
|
|
|
25
25
|
snakeCase,
|
|
26
26
|
} from "./shared/utils";
|
|
27
27
|
import { dealoc, JQLite, startingTag } from "./shared/jqlite/jqlite";
|
|
28
|
-
import { Angular
|
|
29
|
-
import { publishExternalAPI } from "./public";
|
|
28
|
+
import { Angular } from "./loader";
|
|
30
29
|
import { createInjector } from "./injector";
|
|
31
30
|
|
|
32
31
|
describe("angular", () => {
|
|
@@ -34,8 +33,6 @@ describe("angular", () => {
|
|
|
34
33
|
|
|
35
34
|
beforeEach(() => {
|
|
36
35
|
window.angular = new Angular();
|
|
37
|
-
publishExternalAPI();
|
|
38
|
-
createInjector();
|
|
39
36
|
module = window.angular.module("defaultModule", ["ng"]);
|
|
40
37
|
injector = createInjector(["ng", "defaultModule"]);
|
|
41
38
|
$rootScope = injector.get("$rootScope");
|
|
@@ -1572,7 +1569,7 @@ describe("angular", () => {
|
|
|
1572
1569
|
});
|
|
1573
1570
|
});
|
|
1574
1571
|
|
|
1575
|
-
describe("
|
|
1572
|
+
describe("angular.init", () => {
|
|
1576
1573
|
let bootstrapSpy;
|
|
1577
1574
|
let element;
|
|
1578
1575
|
|
|
@@ -1594,7 +1591,7 @@ describe("angular", () => {
|
|
|
1594
1591
|
});
|
|
1595
1592
|
|
|
1596
1593
|
it("should do nothing when not found", () => {
|
|
1597
|
-
|
|
1594
|
+
window.angular.init(element);
|
|
1598
1595
|
expect(bootstrapSpy).not.toHaveBeenCalled();
|
|
1599
1596
|
});
|
|
1600
1597
|
|
|
@@ -1602,7 +1599,7 @@ describe("angular", () => {
|
|
|
1602
1599
|
window.angular.module("ABC", []);
|
|
1603
1600
|
const appElement = JQLite('<div ng-app="ABC"></div>')[0];
|
|
1604
1601
|
|
|
1605
|
-
|
|
1602
|
+
window.angular.init(appElement);
|
|
1606
1603
|
expect(bootstrapSpy).toHaveBeenCalled();
|
|
1607
1604
|
});
|
|
1608
1605
|
|
|
@@ -1610,27 +1607,27 @@ describe("angular", () => {
|
|
|
1610
1607
|
window.angular.module("ABC", []);
|
|
1611
1608
|
const appElement = JQLite('<div ng-app="ABC"></div>')[0];
|
|
1612
1609
|
element.querySelector["[ng-app]"] = appElement;
|
|
1613
|
-
|
|
1610
|
+
window.angular.init(element);
|
|
1614
1611
|
expect(bootstrapSpy).toHaveBeenCalled();
|
|
1615
1612
|
});
|
|
1616
1613
|
|
|
1617
1614
|
it("should bootstrap anonymously", () => {
|
|
1618
1615
|
const appElement = JQLite("<div ng-app></div>")[0];
|
|
1619
1616
|
element.querySelector["[ng-app]"] = appElement;
|
|
1620
|
-
|
|
1617
|
+
window.angular.init(element);
|
|
1621
1618
|
expect(bootstrapSpy).toHaveBeenCalled();
|
|
1622
1619
|
});
|
|
1623
1620
|
|
|
1624
1621
|
it("should bootstrap if the annotation is on the root element", () => {
|
|
1625
1622
|
const appElement = JQLite('<div ng-app=""></div>')[0];
|
|
1626
|
-
|
|
1623
|
+
window.angular.init(appElement);
|
|
1627
1624
|
expect(bootstrapSpy).toHaveBeenCalled();
|
|
1628
1625
|
});
|
|
1629
1626
|
|
|
1630
1627
|
it("should complain if app module cannot be found", () => {
|
|
1631
1628
|
const appElement = JQLite('<div ng-app="doesntexist"></div>')[0];
|
|
1632
1629
|
expect(() => {
|
|
1633
|
-
|
|
1630
|
+
window.angular.init(appElement);
|
|
1634
1631
|
}).toThrowError(/modulerr/);
|
|
1635
1632
|
});
|
|
1636
1633
|
|
|
@@ -1656,7 +1653,7 @@ describe("angular", () => {
|
|
|
1656
1653
|
|
|
1657
1654
|
it("should bootstrap in strict mode when ng-strict-di attribute is specified", () => {
|
|
1658
1655
|
const appElement = JQLite('<div ng-app="" ng-strict-di></div>');
|
|
1659
|
-
|
|
1656
|
+
window.angular.init(JQLite("<div></div>").append(appElement[0])[0]);
|
|
1660
1657
|
expect(bootstrapSpy).toHaveBeenCalled();
|
|
1661
1658
|
expect(bootstrapSpy.calls.mostRecent().args[2].strictDi).toBe(true);
|
|
1662
1659
|
|
|
@@ -1868,14 +1865,12 @@ describe("angular", () => {
|
|
|
1868
1865
|
});
|
|
1869
1866
|
|
|
1870
1867
|
describe("bootstrap", () => {
|
|
1871
|
-
let module, injector, $rootScope, $compile;
|
|
1868
|
+
let module, injector, $rootScope, $compile, angular;
|
|
1872
1869
|
|
|
1873
1870
|
beforeEach(() => {
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
createInjector();
|
|
1877
|
-
module = window.angular.module("defaultModule", ["ng"]);
|
|
1878
|
-
injector = createInjector(["ng", "defaultModule"]);
|
|
1871
|
+
angular = new Angular();
|
|
1872
|
+
module = angular.module("defaultModule", ["ng"]);
|
|
1873
|
+
injector = createInjector(["defaultModule"]);
|
|
1879
1874
|
$rootScope = injector.get("$rootScope");
|
|
1880
1875
|
$compile = injector.get("$compile");
|
|
1881
1876
|
});
|
package/src/animations/module.js
CHANGED
|
@@ -9,8 +9,8 @@ import { $$AnimateCssDriverProvider } from "./animate-css-driver";
|
|
|
9
9
|
import { $$AnimateJsProvider } from "./animate-js";
|
|
10
10
|
import { $$AnimateJsDriverProvider } from "./animate-js-driver";
|
|
11
11
|
|
|
12
|
-
export function initAnimateModule() {
|
|
13
|
-
|
|
12
|
+
export function initAnimateModule(angular) {
|
|
13
|
+
angular
|
|
14
14
|
.module("ngAnimate", [])
|
|
15
15
|
.directive("ngAnimateSwap", ngAnimateSwapDirective)
|
|
16
16
|
.directive("ngAnimateChildren", $$AnimateChildrenDirective)
|
package/src/binding.spec.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { JQLite, dealoc } from "./shared/jqlite/jqlite";
|
|
2
|
-
import {
|
|
2
|
+
import { Angular } from "./loader";
|
|
3
3
|
import { createInjector } from "./injector";
|
|
4
4
|
import { browserTrigger } from "./shared/test-utils";
|
|
5
5
|
|
|
6
6
|
describe("binding", () => {
|
|
7
7
|
let element,
|
|
8
|
+
myModule,
|
|
8
9
|
$injector,
|
|
9
10
|
$rootScope,
|
|
10
11
|
$compile,
|
|
@@ -17,12 +18,14 @@ describe("binding", () => {
|
|
|
17
18
|
|
|
18
19
|
beforeEach(function () {
|
|
19
20
|
errors = [];
|
|
20
|
-
|
|
21
|
+
window.angular = new Angular();
|
|
22
|
+
myModule = window.angular.module("myModule", ["ng"]);
|
|
23
|
+
myModule.decorator("$exceptionHandler", function () {
|
|
21
24
|
return (exception, cause) => {
|
|
22
25
|
errors.push(exception.message);
|
|
23
26
|
};
|
|
24
27
|
});
|
|
25
|
-
$injector = createInjector(["
|
|
28
|
+
$injector = createInjector(["myModule"]);
|
|
26
29
|
$rootScope = $injector.get("$rootScope");
|
|
27
30
|
$compile = $injector.get("$compile");
|
|
28
31
|
$exceptionHandler = $injector.get("$exceptionHandler");
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
2
|
-
import { publishExternalAPI } from "../../public";
|
|
3
2
|
import { Angular } from "../../loader";
|
|
4
3
|
import { isObject } from "../../shared/utils";
|
|
5
4
|
import { isFunction } from "../../shared/utils";
|
|
@@ -18,7 +17,6 @@ describe("$animate", () => {
|
|
|
18
17
|
|
|
19
18
|
beforeEach(() => {
|
|
20
19
|
window.angular = new Angular();
|
|
21
|
-
publishExternalAPI();
|
|
22
20
|
defaultModule = window.angular.module("defaultModule", ["ng"]);
|
|
23
21
|
injector = window.angular.bootstrap(dummy, ["defaultModule"]);
|
|
24
22
|
injector.invoke(
|
|
@@ -268,7 +266,7 @@ describe("$animate", () => {
|
|
|
268
266
|
it("$prop() should operate using a native DOM element", () => {
|
|
269
267
|
const captureSpy = jasmine.createSpy();
|
|
270
268
|
dealoc(dummy);
|
|
271
|
-
|
|
269
|
+
window.angular = new Angular();
|
|
272
270
|
defaultModule = window.angular
|
|
273
271
|
.module("defaultModule", ["ng"])
|
|
274
272
|
.value("$$animateQueue", {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Angular } from "../../loader";
|
|
2
2
|
import { createInjector } from "../../injector";
|
|
3
3
|
|
|
4
4
|
describe("$cacheFactory", () => {
|
|
5
5
|
let $cacheFactory;
|
|
6
6
|
|
|
7
7
|
beforeEach(() => {
|
|
8
|
-
|
|
8
|
+
window.angular = new Angular();
|
|
9
9
|
createInjector(["ng"]).invoke((_$cacheFactory_) => {
|
|
10
10
|
$cacheFactory = _$cacheFactory_;
|
|
11
11
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Angular } from "../../loader";
|
|
2
2
|
import { createInjector } from "../../injector";
|
|
3
3
|
import { dealoc, JQLite, getOrSetCacheData } from "../../shared/jqlite/jqlite";
|
|
4
4
|
import {
|
|
@@ -59,7 +59,7 @@ describe("$compile", () => {
|
|
|
59
59
|
|
|
60
60
|
beforeEach(() => {
|
|
61
61
|
log = [];
|
|
62
|
-
|
|
62
|
+
window.angular = new Angular();
|
|
63
63
|
module = window.angular.module("test1", ["ng"]);
|
|
64
64
|
defaultModule = window.angular.module("defaultModule", ["ng"]);
|
|
65
65
|
myModule = window.angular.module("myModule", ["ng"]);
|
|
@@ -6403,12 +6403,14 @@ describe("$compile", () => {
|
|
|
6403
6403
|
|
|
6404
6404
|
describe("replace and not exactly one root element", () => {
|
|
6405
6405
|
beforeEach(() => {
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6406
|
+
window.angular = new Angular();
|
|
6407
|
+
module = window.angular
|
|
6408
|
+
.module("test1", ["ng"])
|
|
6409
|
+
.decorator("$exceptionHandler", () => {
|
|
6410
|
+
return (exception) => {
|
|
6411
|
+
throw new Error(exception.message);
|
|
6412
|
+
};
|
|
6413
|
+
});
|
|
6412
6414
|
module.directive("template", () => ({
|
|
6413
6415
|
replace: true,
|
|
6414
6416
|
templateUrl: "template.html",
|
|
@@ -6756,61 +6758,66 @@ describe("$compile", () => {
|
|
|
6756
6758
|
|
|
6757
6759
|
beforeEach(() => {
|
|
6758
6760
|
log = [];
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6761
|
+
|
|
6762
|
+
window.angular = new Angular();
|
|
6763
|
+
module = window.angular
|
|
6764
|
+
.module("test1", ["ng"])
|
|
6765
|
+
.decorator("$exceptionHandler", () => {
|
|
6766
|
+
return (exception) => {
|
|
6767
|
+
log.push(exception.message);
|
|
6768
|
+
};
|
|
6769
|
+
});
|
|
6770
|
+
|
|
6765
6771
|
["", "a", "b"].forEach((name) => {
|
|
6766
|
-
module
|
|
6767
|
-
scope
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
+
module
|
|
6773
|
+
.directive(`scope${name.toUpperCase()}`, () => ({
|
|
6774
|
+
scope: true,
|
|
6775
|
+
restrict: "A",
|
|
6776
|
+
compile() {
|
|
6777
|
+
return {
|
|
6778
|
+
pre(scope) {
|
|
6779
|
+
log.push(scope.$id);
|
|
6780
|
+
},
|
|
6781
|
+
};
|
|
6782
|
+
},
|
|
6783
|
+
}))
|
|
6784
|
+
.directive(`iscope${name.toUpperCase()}`, () => ({
|
|
6785
|
+
scope: {},
|
|
6786
|
+
restrict: "A",
|
|
6787
|
+
compile() {
|
|
6788
|
+
return function (scope) {
|
|
6789
|
+
iscope = scope;
|
|
6772
6790
|
log.push(scope.$id);
|
|
6773
|
-
}
|
|
6774
|
-
}
|
|
6775
|
-
}
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
}
|
|
6785
|
-
}
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
}
|
|
6795
|
-
}
|
|
6796
|
-
}));
|
|
6797
|
-
module.directive(`stscope${name.toUpperCase()}`, () => ({
|
|
6798
|
-
scope: true,
|
|
6799
|
-
restrict: "A",
|
|
6800
|
-
template: "<span></span>",
|
|
6801
|
-
compile() {
|
|
6802
|
-
return function (scope, element) {
|
|
6803
|
-
log.push(scope.$id);
|
|
6804
|
-
};
|
|
6805
|
-
},
|
|
6806
|
-
}));
|
|
6791
|
+
};
|
|
6792
|
+
},
|
|
6793
|
+
}))
|
|
6794
|
+
.directive(`tscope${name.toUpperCase()}`, () => ({
|
|
6795
|
+
scope: true,
|
|
6796
|
+
restrict: "A",
|
|
6797
|
+
templateUrl: "tscope.html",
|
|
6798
|
+
compile() {
|
|
6799
|
+
return function (scope) {
|
|
6800
|
+
log.push(scope.$id);
|
|
6801
|
+
};
|
|
6802
|
+
},
|
|
6803
|
+
}))
|
|
6804
|
+
.directive(`stscope${name.toUpperCase()}`, () => ({
|
|
6805
|
+
scope: true,
|
|
6806
|
+
restrict: "A",
|
|
6807
|
+
template: "<span></span>",
|
|
6808
|
+
compile() {
|
|
6809
|
+
return function (scope) {
|
|
6810
|
+
log.push(scope.$id);
|
|
6811
|
+
};
|
|
6812
|
+
},
|
|
6813
|
+
}));
|
|
6807
6814
|
module.directive(`trscope${name.toUpperCase()}`, () => ({
|
|
6808
6815
|
scope: true,
|
|
6809
6816
|
replace: true,
|
|
6810
6817
|
restrict: "A",
|
|
6811
6818
|
templateUrl: "trscope.html",
|
|
6812
6819
|
compile() {
|
|
6813
|
-
return function (scope
|
|
6820
|
+
return function (scope) {
|
|
6814
6821
|
log.push(scope.$id);
|
|
6815
6822
|
};
|
|
6816
6823
|
},
|
|
@@ -6820,7 +6827,7 @@ describe("$compile", () => {
|
|
|
6820
6827
|
restrict: "A",
|
|
6821
6828
|
templateUrl: "tiscope.html",
|
|
6822
6829
|
compile() {
|
|
6823
|
-
return function (scope
|
|
6830
|
+
return function (scope) {
|
|
6824
6831
|
iscope = scope;
|
|
6825
6832
|
log.push(scope.$id);
|
|
6826
6833
|
};
|
|
@@ -6831,7 +6838,7 @@ describe("$compile", () => {
|
|
|
6831
6838
|
restrict: "A",
|
|
6832
6839
|
template: "<span></span>",
|
|
6833
6840
|
compile() {
|
|
6834
|
-
return function (scope
|
|
6841
|
+
return function (scope) {
|
|
6835
6842
|
iscope = scope;
|
|
6836
6843
|
log.push(scope.$id);
|
|
6837
6844
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Angular } from "../../loader";
|
|
2
2
|
import { createInjector } from "../../injector";
|
|
3
3
|
|
|
4
4
|
describe("$controller", () => {
|
|
@@ -6,7 +6,7 @@ describe("$controller", () => {
|
|
|
6
6
|
let $controller;
|
|
7
7
|
|
|
8
8
|
beforeEach(() => {
|
|
9
|
-
|
|
9
|
+
window.angular = new Angular();
|
|
10
10
|
createInjector([
|
|
11
11
|
"ng",
|
|
12
12
|
function (_$controllerProvider_) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Angular } from "../loader";
|
|
2
2
|
import { createInjector } from "../injector";
|
|
3
3
|
|
|
4
4
|
describe("$$cookieReader", () => {
|
|
@@ -27,7 +27,7 @@ describe("$$cookieReader", () => {
|
|
|
27
27
|
deleteAllCookies();
|
|
28
28
|
expect(document.cookie).toEqual("");
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
window.angular = new Angular();
|
|
31
31
|
var injector = createInjector(["ng"]);
|
|
32
32
|
$$cookieReader = injector.get("$$cookieReader");
|
|
33
33
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Angular } from "../../loader";
|
|
2
2
|
import { createInjector } from "../../injector";
|
|
3
3
|
|
|
4
4
|
describe("filter", function () {
|
|
5
5
|
beforeEach(() => {
|
|
6
|
-
|
|
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
|
-
|
|
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
|
-
|
|
100
|
+
window.angular = new Angular();
|
|
101
101
|
const injector = createInjector([
|
|
102
102
|
"ng",
|
|
103
103
|
function (_$filterProvider_) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createInjector } from "../../injector";
|
|
2
|
-
import {
|
|
2
|
+
import { Angular } from "../../loader";
|
|
3
3
|
|
|
4
4
|
describe("$interpolate", () => {
|
|
5
5
|
let $interpolate, $injector, $rootScope, $sce;
|
|
6
6
|
|
|
7
7
|
beforeEach(() => {
|
|
8
|
-
|
|
8
|
+
window.angular = new Angular();
|
|
9
9
|
$injector = createInjector(["ng"]);
|
|
10
10
|
$interpolate = $injector.get("$interpolate");
|
|
11
11
|
$rootScope = $injector.get("$rootScope");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Angular } from "../../loader";
|
|
2
2
|
import { createInjector } from "../../injector";
|
|
3
3
|
import { wait } from "../../shared/test-utils";
|
|
4
4
|
|
|
@@ -10,12 +10,15 @@ describe("$interval", () => {
|
|
|
10
10
|
|
|
11
11
|
beforeEach(() => {
|
|
12
12
|
errors = [];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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 {
|
|
7
|
+
import { Angular } from "../../loader";
|
|
8
8
|
import { createInjector } from "../../injector";
|
|
9
9
|
|
|
10
10
|
describe("$location", () => {
|
|
11
11
|
let module;
|
|
12
12
|
beforeEach(() => {
|
|
13
|
-
|
|
13
|
+
window.angular = new Angular();
|
|
14
14
|
module = window.angular.module("test1", ["ng"]);
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -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
|
+
}
|
package/src/core/on.spec.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
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");
|