@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.
- 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 -27
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-queue.js +9 -0
- 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.js +0 -33
- package/src/core/compile/compile.spec.js +64 -104
- 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.js +7 -0
- 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 +3 -4
- 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.js +7 -0
- package/src/injector.spec.js +26 -29
- package/src/loader.js +133 -1126
- 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.js +20 -29
- package/src/shared/jqlite/jqlite.md +62 -0
- package/src/shared/jqlite/jqlite.spec.js +3 -4
- package/src/shared/min-err.spec.js +1 -2
- package/src/shared/test-utils.js +1 -1
- package/src/shared/utils.js +36 -2
- package/src/types.js +3 -4
- package/types/animations/animate-css-driver.d.ts +2 -1
- package/types/animations/animate-queue.d.ts +2 -1
- package/types/animations/module.d.ts +1 -1
- package/types/core/compile/compile.d.ts +0 -1
- package/types/core/location/location.d.ts +2 -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/injector.d.ts +7 -7
- package/types/loader.d.ts +69 -267
- package/types/public.d.ts +6 -1
- package/types/router/index.d.ts +1 -1
- package/types/shared/jqlite/jqlite.d.ts +5 -5
- package/types/shared/test-utils.d.ts +3 -2
- package/types/shared/utils.d.ts +20 -1
- package/types/types.d.ts +3 -3
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
|
});
|
|
@@ -1923,15 +1918,6 @@ describe("angular", () => {
|
|
|
1923
1918
|
expect(injector).toBeDefined();
|
|
1924
1919
|
});
|
|
1925
1920
|
|
|
1926
|
-
it("should resume deferred bootstrap, if defined", () => {
|
|
1927
|
-
window.name = "NG_DEFER_BOOTSTRAP!";
|
|
1928
|
-
|
|
1929
|
-
angular.resumeDeferredBootstrap = () => {};
|
|
1930
|
-
const spy = spyOn(angular, "resumeDeferredBootstrap");
|
|
1931
|
-
injector = angular.bootstrap(element);
|
|
1932
|
-
expect(spy).toHaveBeenCalled();
|
|
1933
|
-
});
|
|
1934
|
-
|
|
1935
1921
|
it("should wait for extra modules", () => {
|
|
1936
1922
|
window.name = "NG_DEFER_BOOTSTRAP!";
|
|
1937
1923
|
angular.bootstrap(element);
|
|
@@ -27,7 +27,7 @@ export function $$AnimateCssDriverProvider($$animationProvider) {
|
|
|
27
27
|
*
|
|
28
28
|
* @param {*} $animateCss
|
|
29
29
|
* @param {typeof import('../core/animate/animate-runner').AnimateRunner} $$AnimateRunner
|
|
30
|
-
* @param {
|
|
30
|
+
* @param {JQLite} $rootElement
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
33
33
|
function ($animateCss, $$AnimateRunner, $rootElement) {
|
|
@@ -149,6 +149,15 @@ export function $$AnimateQueueProvider($animateProvider) {
|
|
|
149
149
|
"$$animation",
|
|
150
150
|
"$$AnimateRunner",
|
|
151
151
|
"$templateRequest",
|
|
152
|
+
/**
|
|
153
|
+
*
|
|
154
|
+
* @param {*} $rootScope
|
|
155
|
+
* @param {JQLite} $rootElement
|
|
156
|
+
* @param {*} $$animation
|
|
157
|
+
* @param {*} $$AnimateRunner
|
|
158
|
+
* @param {*} $templateRequest
|
|
159
|
+
* @returns
|
|
160
|
+
*/
|
|
152
161
|
function (
|
|
153
162
|
$rootScope,
|
|
154
163
|
$rootElement,
|
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
|
});
|
|
@@ -481,39 +481,6 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
481
481
|
return $$sanitizeUriProvider.imgSrcSanitizationTrustedUrlList();
|
|
482
482
|
};
|
|
483
483
|
|
|
484
|
-
/**
|
|
485
|
-
* @ngdoc method
|
|
486
|
-
* @name $compileProvider#debugInfoEnabled
|
|
487
|
-
*
|
|
488
|
-
* @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the
|
|
489
|
-
* current debugInfoEnabled state
|
|
490
|
-
* @returns {*} current value if used as getter or itself (chaining) if used as setter
|
|
491
|
-
*
|
|
492
|
-
* @kind function
|
|
493
|
-
*
|
|
494
|
-
* @description
|
|
495
|
-
* Call this method to enable/disable various debug runtime information in the compiler such as adding
|
|
496
|
-
* binding information and a reference to the current scope on to DOM elements.
|
|
497
|
-
* If enabled, the compiler will add the following to DOM elements that have been bound to the scope
|
|
498
|
-
* * Data properties used by the {@link angular.element#methods `scope()`/`isolateScope()` methods} to return
|
|
499
|
-
* the element's scope.
|
|
500
|
-
* * Placeholder comments will contain information about what directive and binding caused the placeholder.
|
|
501
|
-
* E.g. `<!-- ngIf: shouldShow() -->`.
|
|
502
|
-
*
|
|
503
|
-
* You may want to disable this in production for a significant performance boost. See
|
|
504
|
-
* {@link guide/production#disabling-debug-data Disabling Debug Data} for more.
|
|
505
|
-
*
|
|
506
|
-
* The default value is true.
|
|
507
|
-
*/
|
|
508
|
-
let debugInfoEnabled = true;
|
|
509
|
-
this.debugInfoEnabled = function (enabled) {
|
|
510
|
-
if (isDefined(enabled)) {
|
|
511
|
-
debugInfoEnabled = enabled;
|
|
512
|
-
return this;
|
|
513
|
-
}
|
|
514
|
-
return debugInfoEnabled;
|
|
515
|
-
};
|
|
516
|
-
|
|
517
484
|
/**
|
|
518
485
|
* @ngdoc method
|
|
519
486
|
* @name $compileProvider#strictComponentBindingsEnabled
|
|
@@ -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"]);
|
|
@@ -4585,17 +4585,6 @@ describe("$compile", () => {
|
|
|
4585
4585
|
]);
|
|
4586
4586
|
});
|
|
4587
4587
|
|
|
4588
|
-
it("should allow debugInfoEnabled to be configured", () => {
|
|
4589
|
-
createInjector([
|
|
4590
|
-
"ng",
|
|
4591
|
-
($compileProvider) => {
|
|
4592
|
-
expect($compileProvider.debugInfoEnabled()).toBe(true); // the default
|
|
4593
|
-
$compileProvider.debugInfoEnabled(false);
|
|
4594
|
-
expect($compileProvider.debugInfoEnabled()).toBe(false);
|
|
4595
|
-
},
|
|
4596
|
-
]);
|
|
4597
|
-
});
|
|
4598
|
-
|
|
4599
4588
|
it("should allow strictComponentBindingsEnabled to be configured", () => {
|
|
4600
4589
|
createInjector([
|
|
4601
4590
|
"ng",
|
|
@@ -6414,12 +6403,14 @@ describe("$compile", () => {
|
|
|
6414
6403
|
|
|
6415
6404
|
describe("replace and not exactly one root element", () => {
|
|
6416
6405
|
beforeEach(() => {
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
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
|
+
});
|
|
6423
6414
|
module.directive("template", () => ({
|
|
6424
6415
|
replace: true,
|
|
6425
6416
|
templateUrl: "template.html",
|
|
@@ -6767,61 +6758,66 @@ describe("$compile", () => {
|
|
|
6767
6758
|
|
|
6768
6759
|
beforeEach(() => {
|
|
6769
6760
|
log = [];
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
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
|
+
|
|
6776
6771
|
["", "a", "b"].forEach((name) => {
|
|
6777
|
-
module
|
|
6778
|
-
scope
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
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;
|
|
6783
6790
|
log.push(scope.$id);
|
|
6784
|
-
}
|
|
6785
|
-
}
|
|
6786
|
-
}
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
}
|
|
6796
|
-
}
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
}
|
|
6806
|
-
}
|
|
6807
|
-
}));
|
|
6808
|
-
module.directive(`stscope${name.toUpperCase()}`, () => ({
|
|
6809
|
-
scope: true,
|
|
6810
|
-
restrict: "A",
|
|
6811
|
-
template: "<span></span>",
|
|
6812
|
-
compile() {
|
|
6813
|
-
return function (scope, element) {
|
|
6814
|
-
log.push(scope.$id);
|
|
6815
|
-
};
|
|
6816
|
-
},
|
|
6817
|
-
}));
|
|
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
|
+
}));
|
|
6818
6814
|
module.directive(`trscope${name.toUpperCase()}`, () => ({
|
|
6819
6815
|
scope: true,
|
|
6820
6816
|
replace: true,
|
|
6821
6817
|
restrict: "A",
|
|
6822
6818
|
templateUrl: "trscope.html",
|
|
6823
6819
|
compile() {
|
|
6824
|
-
return function (scope
|
|
6820
|
+
return function (scope) {
|
|
6825
6821
|
log.push(scope.$id);
|
|
6826
6822
|
};
|
|
6827
6823
|
},
|
|
@@ -6831,7 +6827,7 @@ describe("$compile", () => {
|
|
|
6831
6827
|
restrict: "A",
|
|
6832
6828
|
templateUrl: "tiscope.html",
|
|
6833
6829
|
compile() {
|
|
6834
|
-
return function (scope
|
|
6830
|
+
return function (scope) {
|
|
6835
6831
|
iscope = scope;
|
|
6836
6832
|
log.push(scope.$id);
|
|
6837
6833
|
};
|
|
@@ -6842,7 +6838,7 @@ describe("$compile", () => {
|
|
|
6842
6838
|
restrict: "A",
|
|
6843
6839
|
template: "<span></span>",
|
|
6844
6840
|
compile() {
|
|
6845
|
-
return function (scope
|
|
6841
|
+
return function (scope) {
|
|
6846
6842
|
iscope = scope;
|
|
6847
6843
|
log.push(scope.$id);
|
|
6848
6844
|
};
|
|
@@ -7645,42 +7641,6 @@ describe("$compile", () => {
|
|
|
7645
7641
|
});
|
|
7646
7642
|
});
|
|
7647
7643
|
|
|
7648
|
-
describe("decorating with binding info", () => {
|
|
7649
|
-
it("should not occur if `debugInfoEnabled` is false", () => {
|
|
7650
|
-
createInjector([
|
|
7651
|
-
"test1",
|
|
7652
|
-
($compileProvider) => {
|
|
7653
|
-
$compileProvider.debugInfoEnabled(false);
|
|
7654
|
-
},
|
|
7655
|
-
]).invoke((_$compile_, _$rootScope_, _$templateCache_) => {
|
|
7656
|
-
$compile = _$compile_;
|
|
7657
|
-
$rootScope = _$rootScope_;
|
|
7658
|
-
$templateCache = _$templateCache_;
|
|
7659
|
-
});
|
|
7660
|
-
element = $compile("<div>{{1+2}}</div>")($rootScope);
|
|
7661
|
-
expect(element[0].classList.contains("ng-binding")).toBe(false);
|
|
7662
|
-
expect(element.data("$binding")).toBeUndefined();
|
|
7663
|
-
});
|
|
7664
|
-
|
|
7665
|
-
// TODO figure out debug strat
|
|
7666
|
-
// it("should occur if `debugInfoEnabled` is true", () => {
|
|
7667
|
-
// createInjector([
|
|
7668
|
-
// "test1",
|
|
7669
|
-
// ($compileProvider) => {
|
|
7670
|
-
// $compileProvider.debugInfoEnabled(true);
|
|
7671
|
-
// },
|
|
7672
|
-
// ]).invoke((_$compile_, _$rootScope_, _$templateCache_) => {
|
|
7673
|
-
// $compile = _$compile_;
|
|
7674
|
-
// $rootScope = _$rootScope_;
|
|
7675
|
-
// $templateCache = _$templateCache_;
|
|
7676
|
-
// });
|
|
7677
|
-
|
|
7678
|
-
// element = $compile("<div>{{1+2}}</div>")($rootScope);
|
|
7679
|
-
// expect(element[0].classList.contains("ng-binding")).toBe(true);
|
|
7680
|
-
// expect(element.data("$binding")).toEqual(["1+2"]);
|
|
7681
|
-
// });
|
|
7682
|
-
});
|
|
7683
|
-
|
|
7684
7644
|
it("should observe interpolated attrs", () => {
|
|
7685
7645
|
$compile('<div some-attr="{{value}}" observer></div>')($rootScope);
|
|
7686
7646
|
|
|
@@ -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");
|
|
@@ -859,6 +859,13 @@ export function $LocationProvider() {
|
|
|
859
859
|
"$rootScope",
|
|
860
860
|
"$browser",
|
|
861
861
|
"$rootElement",
|
|
862
|
+
/**
|
|
863
|
+
*
|
|
864
|
+
* @param {*} $rootScope
|
|
865
|
+
* @param {*} $browser
|
|
866
|
+
* @param {JQLite} $rootElement
|
|
867
|
+
* @returns
|
|
868
|
+
*/
|
|
862
869
|
function ($rootScope, $browser, $rootElement) {
|
|
863
870
|
let $location;
|
|
864
871
|
let LocationMode;
|
|
@@ -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
|
|