@angular-wave/angular.ts 0.3.0 → 0.4.0
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/.github/workflows/ci.yml +57 -0
- package/README.md +1 -1
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/animations/animate-cache.js +1 -1
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +1 -1
- package/src/animations/animate-js-driver.js +2 -2
- package/src/animations/animate-js.js +2 -2
- package/src/animations/animate-queue.js +2 -2
- package/src/animations/animation.js +1 -1
- package/src/core/cache/cache-factory.js +18 -2
- package/src/core/compile/attributes.js +1 -1
- package/src/core/compile/compile.js +10 -12
- package/src/core/compile/compile.spec.js +0 -1
- package/src/core/compile/compile.test.js +1 -1
- package/src/core/controller/controller.js +1 -1
- package/src/core/exception-handler.js +2 -6
- package/src/core/filter/filter.js +2 -2
- package/src/core/interpolate/interpolate.js +3 -3
- package/src/core/interval/interval-factory.js +7 -23
- package/src/core/interval/interval.js +1 -1
- package/src/core/interval/interval.spec.js +0 -25
- package/src/core/location/location.js +1 -1
- package/src/core/location/location.spec.js +3 -3
- package/src/core/parser/parse.js +2 -2
- package/src/core/q/q.js +0 -27
- package/src/core/q/q.spec.js +0 -44
- package/src/core/sce/sce.js +2 -2
- package/src/core/scope/scope.js +35 -41
- package/src/core/scope/scope.spec.js +71 -13
- package/src/core/task-tracker-factory.js +1 -1
- package/src/core/timeout/timeout.js +4 -8
- package/src/directive/attrs/attrs.js +1 -1
- package/src/directive/if/if.js +5 -5
- package/src/directive/input/input.spec.js +0 -1
- package/src/directive/observe/observe.html +18 -0
- package/src/directive/observe/observe.js +37 -0
- package/src/directive/observe/observe.spec.js +92 -0
- package/src/directive/observe/observe.test.js +9 -0
- package/src/directive/observe/test.html +197 -0
- package/src/directive/script/script.js +11 -9
- package/src/directive/validators/validators.js +70 -42
- package/src/public.js +63 -66
- package/src/router/params/param.js +1 -2
- package/src/router/path/path-node.js +5 -5
- package/src/router/path/path-utils.js +19 -21
- package/src/router/state/state-builder.js +17 -11
- package/src/router/state/state-queue-manager.js +16 -7
- package/src/router/state/state-registry.js +9 -5
- package/src/router/state/state-service.js +7 -11
- package/src/router/template-factory.js +2 -2
- package/src/router/transition/transition-service.js +1 -1
- package/src/router/transition/transition.js +13 -11
- package/src/router/url/url-matcher.js +2 -2
- package/src/router/url/url-service.js +1 -1
- package/src/router/view/view.js +3 -3
- package/src/router/view-scroll.js +13 -8
- package/src/services/http/http.js +2 -82
- package/src/services/http/http.spec.js +0 -118
- package/src/services/http/template-request.spec.js +10 -12
- package/src/services/http-backend/http-backend.js +1 -1
- package/src/services/log.js +1 -7
- package/src/services/template-request.js +3 -3
- package/src/shared/common.js +3 -9
- package/src/shared/hof.js +6 -8
- package/src/types.js +0 -14
- package/types/animations/animate-cache.d.ts +2 -2
- package/types/animations/animate-css-driver.d.ts +3 -3
- package/types/animations/animate-css.d.ts +2 -2
- package/types/animations/animate-js-driver.d.ts +3 -3
- package/types/animations/animate-js.d.ts +3 -3
- package/types/animations/animate-queue.d.ts +3 -3
- package/types/animations/animation.d.ts +2 -2
- package/types/core/cache/cache-factory.d.ts +20 -2
- package/types/core/compile/attributes.d.ts +3 -3
- package/types/core/compile/compile.d.ts +12 -12
- package/types/core/controller/controller.d.ts +1 -1
- package/types/core/exception-handler.d.ts +3 -4
- package/types/core/filter/filter.d.ts +3 -3
- package/types/core/interpolate/interpolate.d.ts +6 -6
- package/types/core/interval/interval-factory.d.ts +3 -3
- package/types/core/interval/interval.d.ts +2 -2
- package/types/core/location/location.d.ts +2 -2
- package/types/core/parser/parse.d.ts +4 -4
- package/types/core/q/q.d.ts +0 -5
- package/types/core/sce/sce.d.ts +4 -4
- package/types/core/scope/scope.d.ts +12 -3
- package/types/core/task-tracker-factory.d.ts +1 -1
- package/types/core/timeout/timeout.d.ts +3 -4
- package/types/directive/observe/observe.d.ts +4 -0
- package/types/directive/script/script.d.ts +8 -5
- package/types/directive/validators/validators.d.ts +3 -15
- package/types/router/path/path-node.d.ts +0 -7
- package/types/router/path/path-utils.d.ts +7 -2
- package/types/router/state/state-queue-manager.d.ts +13 -3
- package/types/router/state/state-registry.d.ts +5 -2
- package/types/router/state/state-service.d.ts +2 -2
- package/types/router/template-factory.d.ts +3 -3
- package/types/router/transition/transition-service.d.ts +1 -1
- package/types/router/transition/transition.d.ts +3 -3
- package/types/router/url/url-service.d.ts +3 -3
- package/types/router/view-scroll.d.ts +3 -3
- package/types/services/http/http.d.ts +4 -48
- package/types/services/http-backend/http-backend.d.ts +2 -2
- package/types/services/log.d.ts +2 -8
- package/types/services/template-request.d.ts +1 -1
- package/types/shared/common.d.ts +0 -5
- package/types/shared/hof.d.ts +0 -1
- package/types/types.d.ts +1 -1
- package/.github/workflows/lint.yml +0 -19
- package/.github/workflows/playwright.yml +0 -27
- package/.github/workflows/types.yml +0 -19
- package/src/directive/csp.md +0 -63
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.
|
|
5
|
+
"version": "0.4.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/angular-ts.esm.js",
|
|
8
8
|
"browser": "dist/angular-ts.umd.js",
|
|
@@ -8,8 +8,8 @@ const NG_ANIMATE_ANCHOR_CLASS_NAME = "ng-anchor";
|
|
|
8
8
|
const NG_OUT_ANCHOR_CLASS_NAME = "ng-anchor-out";
|
|
9
9
|
const NG_IN_ANCHOR_CLASS_NAME = "ng-anchor-in";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
export function
|
|
11
|
+
AnimateCssDriverProvider.$inject = ["$$animationProvider"];
|
|
12
|
+
export function AnimateCssDriverProvider($$animationProvider) {
|
|
13
13
|
$$animationProvider.drivers.push("$$animateCssDriver");
|
|
14
14
|
|
|
15
15
|
function isDocumentFragment(node) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forEach } from "../shared/utils";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
export function
|
|
3
|
+
AnimateJsDriverProvider.$inject = ["$$animationProvider"];
|
|
4
|
+
export function AnimateJsDriverProvider($$animationProvider) {
|
|
5
5
|
$$animationProvider.drivers.push("$$animateJsDriver");
|
|
6
6
|
this.$get = [
|
|
7
7
|
"$$animateJs",
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
// TODO: use caching here to speed things up for detection
|
|
9
9
|
// TODO: add documentation
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
export function
|
|
11
|
+
AnimateJsProvider.$inject = ["$animateProvider"];
|
|
12
|
+
export function AnimateJsProvider($animateProvider) {
|
|
13
13
|
this.$get = [
|
|
14
14
|
"$injector",
|
|
15
15
|
"$$AnimateRunner",
|
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
|
|
25
25
|
const NG_ANIMATE_ATTR_NAME = "data-ng-animate";
|
|
26
26
|
const NG_ANIMATE_PIN_DATA = "$ngAnimatePin";
|
|
27
|
-
|
|
28
|
-
export function
|
|
27
|
+
AnimateQueueProvider.$inject = ["$animateProvider"];
|
|
28
|
+
export function AnimateQueueProvider($animateProvider) {
|
|
29
29
|
const PRE_DIGEST_STATE = 1;
|
|
30
30
|
const RUNNING_STATE = 2;
|
|
31
31
|
const ONE_SPACE = " ";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
const RUNNER_STORAGE_KEY = "$$animationRunner";
|
|
13
13
|
const PREPARE_CLASSES_KEY = "$$animatePrepareClasses";
|
|
14
14
|
|
|
15
|
-
export function
|
|
15
|
+
export function AnimationProvider() {
|
|
16
16
|
const NG_ANIMATE_REF_ATTR = "ng-animate-ref";
|
|
17
17
|
|
|
18
18
|
const drivers = (this.drivers = []);
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A cache for maping template names to their respective content.
|
|
3
|
+
*
|
|
4
|
+
* @typedef {Map<string, string>} TemplateCache
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Service responsible for providing a cache for templates.
|
|
9
|
+
*
|
|
10
|
+
* @class TemplateCacheProvider
|
|
11
|
+
* @description Provides an instance of a template cache that can be used to store and retrieve template content.
|
|
12
|
+
*/
|
|
13
|
+
export class TemplateCacheProvider {
|
|
14
|
+
/**
|
|
15
|
+
* @description Returns a new instance of a `TemplateCache`, which is a Map used to store templates.
|
|
16
|
+
* @returns {TemplateCache} A new instance of the template cache (Map object).
|
|
17
|
+
*/
|
|
18
|
+
$get = () => new Map();
|
|
3
19
|
}
|
|
@@ -27,7 +27,7 @@ export class Attributes {
|
|
|
27
27
|
/**
|
|
28
28
|
* @param {import('../scope/scope').Scope} $rootScope
|
|
29
29
|
* @param {*} $animate
|
|
30
|
-
* @param {import("../exception-handler").
|
|
30
|
+
* @param {import("../exception-handler").ErrorHandler} $exceptionHandler
|
|
31
31
|
* @param {*} $sce
|
|
32
32
|
* @param {import('../../shared/jqlite/jqlite').JQLite} [element]
|
|
33
33
|
* @param {*} [attributesToCopy]
|
|
@@ -51,8 +51,8 @@ const $compileMinErr = minErr("$compile");
|
|
|
51
51
|
const UNINITALIZED_VALIED = new Object();
|
|
52
52
|
const EXCLUDED_DIRECTIVES = ["ngIf", "ngRepeat"];
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
export function
|
|
54
|
+
CompileProvider.$inject = ["$provide", "$$sanitizeUriProvider"];
|
|
55
|
+
export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
56
56
|
const hasDirectives = {};
|
|
57
57
|
const Suffix = "Directive";
|
|
58
58
|
const ALL_OR_NOTHING_ATTRS = {
|
|
@@ -186,7 +186,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
186
186
|
* are the factories.
|
|
187
187
|
* @param {Function|Array} directiveFactory An injectable directive factory function. See the
|
|
188
188
|
* {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
|
|
189
|
-
* @returns {
|
|
189
|
+
* @returns {CompileProvider} Self for chaining.
|
|
190
190
|
*/
|
|
191
191
|
this.directive = function registerDirective(name, directiveFactory) {
|
|
192
192
|
assertArg(name, "name");
|
|
@@ -282,7 +282,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
282
282
|
* - `$...` – additional properties to attach to the directive factory function and the controller
|
|
283
283
|
* constructor function. (This is used by the component router to annotate)
|
|
284
284
|
*
|
|
285
|
-
* @returns {
|
|
285
|
+
* @returns {CompileProvider} the compile provider itself, for chaining of function calls.
|
|
286
286
|
*/
|
|
287
287
|
this.component = function (name, options) {
|
|
288
288
|
if (!isString(name)) {
|
|
@@ -362,7 +362,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
362
362
|
* the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
|
|
363
363
|
*
|
|
364
364
|
* @param {RegExp=} regexp New regexp to trust urls with.
|
|
365
|
-
* @returns {RegExp
|
|
365
|
+
* @returns {RegExp|CompileProvider} Current RegExp if called without value or self for
|
|
366
366
|
* chaining otherwise.
|
|
367
367
|
*/
|
|
368
368
|
this.aHrefSanitizationTrustedUrlList = function (regexp) {
|
|
@@ -385,7 +385,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
385
385
|
* the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
|
|
386
386
|
*
|
|
387
387
|
* @param {RegExp=} regexp New regexp to trust urls with.
|
|
388
|
-
* @returns {RegExp
|
|
388
|
+
* @returns {RegExp|CompileProvider} Current RegExp if called without value or self for
|
|
389
389
|
* chaining otherwise.
|
|
390
390
|
*/
|
|
391
391
|
this.imgSrcSanitizationTrustedUrlList = function (regexp) {
|
|
@@ -526,7 +526,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
526
526
|
/**
|
|
527
527
|
* @param {import("../../core/di/internal-injector").InjectorService} $injector
|
|
528
528
|
* @param {*} $interpolate
|
|
529
|
-
* @param {import("../exception-handler").
|
|
529
|
+
* @param {import("../exception-handler").ErrorHandler} $exceptionHandler
|
|
530
530
|
* @param {*} $templateRequest
|
|
531
531
|
* @param {import("../parser/parse").ParseService} $parse
|
|
532
532
|
* @param {*} $controller
|
|
@@ -581,14 +581,12 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
581
581
|
|
|
582
582
|
const startSymbol = $interpolate.startSymbol();
|
|
583
583
|
const endSymbol = $interpolate.endSymbol();
|
|
584
|
+
/** @type {(string) => string} */
|
|
584
585
|
const denormalizeTemplate =
|
|
585
586
|
startSymbol === "{{" && endSymbol === "}}"
|
|
586
587
|
? (x) => x
|
|
587
|
-
:
|
|
588
|
-
|
|
589
|
-
.replace(/\{\{/g, startSymbol)
|
|
590
|
-
.replace(/}}/g, endSymbol);
|
|
591
|
-
};
|
|
588
|
+
: (x) => x.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
|
|
589
|
+
|
|
592
590
|
const NG_PREFIX_BINDING = /^ng(Attr|Prop|On)([A-Z].*)$/;
|
|
593
591
|
const MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
|
|
594
592
|
return compile;
|
|
@@ -15166,7 +15166,6 @@ describe("$compile", () => {
|
|
|
15166
15166
|
);
|
|
15167
15167
|
initInjector("test1");
|
|
15168
15168
|
$templateCache.set("baz.html", "<div>Baz</div>");
|
|
15169
|
-
debugger;
|
|
15170
15169
|
element = $compile("<trans><inner></inner></trans>")($rootScope);
|
|
15171
15170
|
$rootScope.$digest();
|
|
15172
15171
|
|
|
@@ -25,7 +25,7 @@ export function identifierForController(controller, ident) {
|
|
|
25
25
|
* This provider allows controller registration via the
|
|
26
26
|
* {@link ng.$controllerProvider#register register} method.
|
|
27
27
|
*/
|
|
28
|
-
export class
|
|
28
|
+
export class ControllerProvider {
|
|
29
29
|
constructor() {
|
|
30
30
|
/**
|
|
31
31
|
* @type {Map<string, Function|Object>}
|
|
@@ -31,10 +31,6 @@
|
|
|
31
31
|
*
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* @typedef {import('../types').ServiceProvider} ExceptionHandlerProvider
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
34
|
/** @type {import('../services/log').LogService} */
|
|
39
35
|
let log;
|
|
40
36
|
|
|
@@ -50,9 +46,9 @@ export const errorHandler = (exception, cause) => {
|
|
|
50
46
|
|
|
51
47
|
/**
|
|
52
48
|
* @constructor
|
|
53
|
-
* @this {
|
|
49
|
+
* @this {import('../types').ServiceProvider}
|
|
54
50
|
*/
|
|
55
|
-
export function
|
|
51
|
+
export function ExceptionHandlerProvider() {
|
|
56
52
|
this.$get = [
|
|
57
53
|
"$log",
|
|
58
54
|
/**
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
$IsStateFilter,
|
|
9
9
|
} from "../../router/state-filters";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
export function
|
|
11
|
+
FilterProvider.$inject = ["$provide"];
|
|
12
|
+
export function FilterProvider($provide) {
|
|
13
13
|
const suffix = "Filter";
|
|
14
14
|
|
|
15
15
|
function register(name, factory) {
|
|
@@ -40,7 +40,7 @@ function interr(text, err) {
|
|
|
40
40
|
* security bugs!
|
|
41
41
|
* </div>
|
|
42
42
|
*/
|
|
43
|
-
export function
|
|
43
|
+
export function InterpolateProvider() {
|
|
44
44
|
let startSymbol = "{{";
|
|
45
45
|
let endSymbol = "}}";
|
|
46
46
|
|
|
@@ -48,7 +48,7 @@ export function $InterpolateProvider() {
|
|
|
48
48
|
* Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
|
|
49
49
|
*
|
|
50
50
|
* @param {string=} value new value to set the starting symbol to.
|
|
51
|
-
* @returns {string
|
|
51
|
+
* @returns {string|InterpolateProvider} Returns the symbol when used as getter and self if used as setter.
|
|
52
52
|
*/
|
|
53
53
|
this.startSymbol = function (value) {
|
|
54
54
|
if (value) {
|
|
@@ -62,7 +62,7 @@ export function $InterpolateProvider() {
|
|
|
62
62
|
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
|
|
63
63
|
*
|
|
64
64
|
* @param {string=} value new value to set the ending symbol to.
|
|
65
|
-
* @returns {string
|
|
65
|
+
* @returns {string|InterpolateProvider} Returns the symbol when used as getter and self if used as setter.
|
|
66
66
|
*/
|
|
67
67
|
this.endSymbol = function (value) {
|
|
68
68
|
if (value) {
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import { isDefined, sliceArgs } from "../../shared/utils";
|
|
2
2
|
|
|
3
|
-
export function
|
|
3
|
+
export function $IntervalFactoryProvider() {
|
|
4
4
|
this.$get = [
|
|
5
|
-
"$browser",
|
|
6
5
|
"$q",
|
|
7
|
-
"$$q",
|
|
8
6
|
"$rootScope",
|
|
9
7
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param {import('../../services/browser').Browser} $browser
|
|
12
8
|
* @param {*} $q
|
|
13
|
-
* @param {*} $$q
|
|
14
9
|
* @param {import('../scope/scope').Scope} $rootScope
|
|
15
10
|
* @returns
|
|
16
11
|
*/
|
|
17
|
-
function ($
|
|
12
|
+
function ($q, $rootScope) {
|
|
18
13
|
return function intervalFactory(setIntervalFn, clearIntervalFn) {
|
|
19
|
-
return function intervalFn(fn, delay, count
|
|
14
|
+
return function intervalFn(fn, delay, count) {
|
|
20
15
|
const hasParams = arguments.length > 4;
|
|
21
16
|
const args = hasParams ? sliceArgs(arguments, 4) : [];
|
|
22
17
|
let iteration = 0;
|
|
23
|
-
const
|
|
24
|
-
const deferred = (skipApply ? $$q : $q).defer();
|
|
18
|
+
const deferred = $q.defer();
|
|
25
19
|
const { promise } = deferred;
|
|
26
20
|
|
|
27
21
|
count = isDefined(count) ? count : 0;
|
|
@@ -35,11 +29,7 @@ export function $$IntervalFactoryProvider() {
|
|
|
35
29
|
}
|
|
36
30
|
|
|
37
31
|
function tick() {
|
|
38
|
-
|
|
39
|
-
$browser.defer(callback);
|
|
40
|
-
} else {
|
|
41
|
-
$rootScope.$evalAsync(callback);
|
|
42
|
-
}
|
|
32
|
+
$rootScope.$evalAsync(callback);
|
|
43
33
|
|
|
44
34
|
iteration++;
|
|
45
35
|
|
|
@@ -47,16 +37,10 @@ export function $$IntervalFactoryProvider() {
|
|
|
47
37
|
deferred.resolve(iteration);
|
|
48
38
|
clearIntervalFn(promise.$$intervalId);
|
|
49
39
|
}
|
|
50
|
-
|
|
51
|
-
if (!skipApply) $rootScope.$apply();
|
|
40
|
+
$rootScope.$apply();
|
|
52
41
|
}
|
|
53
42
|
|
|
54
|
-
promise.$$intervalId = setIntervalFn(
|
|
55
|
-
tick,
|
|
56
|
-
delay,
|
|
57
|
-
deferred,
|
|
58
|
-
skipApply,
|
|
59
|
-
);
|
|
43
|
+
promise.$$intervalId = setIntervalFn(tick, delay, deferred);
|
|
60
44
|
|
|
61
45
|
return promise;
|
|
62
46
|
};
|
|
@@ -55,31 +55,6 @@ describe("$interval", () => {
|
|
|
55
55
|
}, 1);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
it("should NOT call $apply if invokeApply is set to false", (done) => {
|
|
59
|
-
const applySpy = spyOn($rootScope, "$apply").and.callThrough();
|
|
60
|
-
|
|
61
|
-
$interval(() => {}, 1, 0, false);
|
|
62
|
-
expect(applySpy).not.toHaveBeenCalled();
|
|
63
|
-
|
|
64
|
-
setTimeout(() => {
|
|
65
|
-
expect(applySpy).not.toHaveBeenCalled();
|
|
66
|
-
done();
|
|
67
|
-
}, 2);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it("should NOT call $evalAsync or $digest if invokeApply is set to false", async () => {
|
|
71
|
-
const evalAsyncSpy = spyOn($rootScope, "$evalAsync").and.callThrough();
|
|
72
|
-
const digestSpy = spyOn($rootScope, "$digest").and.callThrough();
|
|
73
|
-
const notifySpy = jasmine.createSpy("notify");
|
|
74
|
-
|
|
75
|
-
$interval(notifySpy, 1, 1, false);
|
|
76
|
-
|
|
77
|
-
await wait(100);
|
|
78
|
-
expect(notifySpy).toHaveBeenCalled();
|
|
79
|
-
expect(evalAsyncSpy).not.toHaveBeenCalled();
|
|
80
|
-
expect(digestSpy).not.toHaveBeenCalled();
|
|
81
|
-
});
|
|
82
|
-
|
|
83
58
|
it("should allow you to specify a number of iterations", async () => {
|
|
84
59
|
let counter = 0;
|
|
85
60
|
$interval(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocationHtml5Url,
|
|
3
3
|
LocationHashbangUrl,
|
|
4
|
-
|
|
4
|
+
LocationProvider,
|
|
5
5
|
} from "./location";
|
|
6
6
|
import { Angular } from "../../loader";
|
|
7
7
|
import { createInjector } from "../di/injector";
|
|
@@ -23,12 +23,12 @@ describe("$location", () => {
|
|
|
23
23
|
|
|
24
24
|
describe("defaults", () => {
|
|
25
25
|
it('should have hashPrefix of "!"', () => {
|
|
26
|
-
let provider = new
|
|
26
|
+
let provider = new LocationProvider();
|
|
27
27
|
expect(provider.hashPrefix()).toBe("!");
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
it("should not be html5 mode", () => {
|
|
31
|
-
let provider = new
|
|
31
|
+
let provider = new LocationProvider();
|
|
32
32
|
expect(provider.html5Mode().enabled).toBeFalse();
|
|
33
33
|
});
|
|
34
34
|
});
|
package/src/core/parser/parse.js
CHANGED
|
@@ -33,7 +33,7 @@ import { Parser } from "./parser";
|
|
|
33
33
|
* @typedef {function(CompiledExpression|string|function(import('../scope/scope').Scope):any, function(any, import('../scope/scope').Scope, any):any=, boolean=): CompiledExpression} ParseService
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
-
export function
|
|
36
|
+
export function ParseProvider() {
|
|
37
37
|
const cache = Object.create(null);
|
|
38
38
|
|
|
39
39
|
/** @type {function(any):boolean?} */
|
|
@@ -60,7 +60,7 @@ export function $ParseProvider() {
|
|
|
60
60
|
* a valid identifier start character.
|
|
61
61
|
* @param {function(any):boolean} [identifierContinue] The function that will decide whether the given character is
|
|
62
62
|
* a valid identifier continue character.
|
|
63
|
-
* @returns {
|
|
63
|
+
* @returns {ParseProvider}
|
|
64
64
|
*/
|
|
65
65
|
this.setIdentifierFns = function (identifierStart, identifierContinue) {
|
|
66
66
|
identStart = identifierStart;
|
package/src/core/q/q.js
CHANGED
|
@@ -98,33 +98,6 @@ export class $QProvider {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export class $$QProvider {
|
|
102
|
-
constructor() {
|
|
103
|
-
this.errorOn = true;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
$get = [
|
|
107
|
-
"$exceptionHandler",
|
|
108
|
-
function ($exceptionHandler) {
|
|
109
|
-
return qFactory(
|
|
110
|
-
(callback) => {
|
|
111
|
-
window.setTimeout(callback);
|
|
112
|
-
},
|
|
113
|
-
$exceptionHandler,
|
|
114
|
-
this.errorOn,
|
|
115
|
-
);
|
|
116
|
-
},
|
|
117
|
-
];
|
|
118
|
-
|
|
119
|
-
errorOnUnhandledRejections(value) {
|
|
120
|
-
if (isDefined(value)) {
|
|
121
|
-
this.errorOn = value;
|
|
122
|
-
return this;
|
|
123
|
-
}
|
|
124
|
-
return this.errorOn;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
101
|
/**
|
|
129
102
|
* Constructs a promise manager.
|
|
130
103
|
*
|
package/src/core/q/q.spec.js
CHANGED
|
@@ -626,50 +626,6 @@ describe("all", function () {
|
|
|
626
626
|
});
|
|
627
627
|
});
|
|
628
628
|
|
|
629
|
-
describe("$qq", function () {
|
|
630
|
-
let $q, $$q, $rootScope, $injector;
|
|
631
|
-
|
|
632
|
-
beforeEach(() => {
|
|
633
|
-
window.angular = new Angular();
|
|
634
|
-
$injector = createInjector(["ng"]);
|
|
635
|
-
$q = $injector.get("$q");
|
|
636
|
-
$$q = $injector.get("$$q");
|
|
637
|
-
$rootScope = $injector.get("$rootScope");
|
|
638
|
-
});
|
|
639
|
-
|
|
640
|
-
afterEach(function () {});
|
|
641
|
-
|
|
642
|
-
it("uses deferreds that do not resolve at digest", function () {
|
|
643
|
-
var d = $$q.defer();
|
|
644
|
-
var fulfilledSpy = jasmine.createSpy();
|
|
645
|
-
d.promise.then(fulfilledSpy);
|
|
646
|
-
d.resolve("ok");
|
|
647
|
-
$rootScope.$apply();
|
|
648
|
-
expect(fulfilledSpy).not.toHaveBeenCalled();
|
|
649
|
-
});
|
|
650
|
-
|
|
651
|
-
it("uses deferreds that resolve later", (done) => {
|
|
652
|
-
var d = $$q.defer();
|
|
653
|
-
d.promise.then((val) => {
|
|
654
|
-
expect(val).toBe("ok");
|
|
655
|
-
done();
|
|
656
|
-
});
|
|
657
|
-
d.resolve("ok");
|
|
658
|
-
});
|
|
659
|
-
|
|
660
|
-
it("does not invoke digest", (done) => {
|
|
661
|
-
var d = $$q.defer();
|
|
662
|
-
var watchSpy = jasmine.createSpy();
|
|
663
|
-
d.promise.then(() => {
|
|
664
|
-
watchSpy();
|
|
665
|
-
done();
|
|
666
|
-
});
|
|
667
|
-
d.resolve("ok");
|
|
668
|
-
$rootScope.$watch(watchSpy);
|
|
669
|
-
expect(watchSpy).not.toHaveBeenCalled();
|
|
670
|
-
});
|
|
671
|
-
});
|
|
672
|
-
|
|
673
629
|
describe("$Q", () => {
|
|
674
630
|
let resolve;
|
|
675
631
|
let reject;
|
package/src/core/sce/sce.js
CHANGED
|
@@ -162,7 +162,7 @@ export function adjustMatcher(matcher) {
|
|
|
162
162
|
* of issues, like for instance attacker-controlled `ng-includes`.
|
|
163
163
|
*/
|
|
164
164
|
|
|
165
|
-
export function
|
|
165
|
+
export function SceDelegateProvider() {
|
|
166
166
|
this.SCE_CONTEXTS = SCE_CONTEXTS;
|
|
167
167
|
|
|
168
168
|
// Resource URLs can also be trusted by policy.
|
|
@@ -473,7 +473,7 @@ export function $SceDelegateProvider() {
|
|
|
473
473
|
];
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
-
export function
|
|
476
|
+
export function SceProvider() {
|
|
477
477
|
let enabled = true;
|
|
478
478
|
|
|
479
479
|
/**
|