@angular-wave/angular.ts 0.4.1 → 0.4.3
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/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +7 -7
- package/src/angular.spec.js +1 -264
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +7 -8
- package/src/animations/animate-js-driver.js +1 -3
- package/src/animations/animate-js.js +4 -4
- package/src/animations/animate-queue.js +6 -6
- package/src/animations/animation.js +3 -3
- package/src/animations/shared.js +16 -14
- package/src/core/compile/attributes.js +2 -3
- package/src/core/compile/compile.js +248 -232
- package/src/core/compile/compile.spec.js +46 -51
- package/src/core/compile/compile.test.js +1 -1
- package/src/core/interpolate/interpolate.js +2 -2
- package/src/core/interval/interval.test.js +1 -1
- package/src/core/{parser/lexer.html → parse/ast/ast.html} +1 -1
- package/src/core/{parser → parse/ast}/ast.js +43 -29
- package/src/core/parse/ast/ast.spec.js +1462 -0
- package/src/core/parse/ast/ast.test.js +10 -0
- package/src/core/{parser → parse}/interpreter.js +10 -10
- package/src/core/parse/lexer/lexer.html +18 -0
- package/src/core/{parser → parse/lexer}/lexer.js +1 -1
- package/src/core/{parser → parse/lexer}/lexer.spec.js +2 -2
- package/src/core/parse/lexer/lexer.test.js +10 -0
- package/src/core/{parser → parse}/parse.html +1 -1
- package/src/core/{parser → parse}/parse.js +6 -6
- package/src/core/{parser → parse}/parse.spec.js +6 -1725
- package/src/core/parse/parse.test.js +10 -0
- package/src/core/parse/parser/parser.html +18 -0
- package/src/core/{parser → parse/parser}/parser.js +6 -6
- package/src/core/parse/parser/parser.spec.js +8 -0
- package/src/core/parse/parser/parser.test.js +10 -0
- package/src/core/sce/sce.js +1 -2
- package/src/core/scope/scope.js +4 -5
- package/src/directive/attrs/attrs.test.js +11 -0
- package/src/directive/attrs/boolean.html +18 -0
- package/src/directive/attrs/boolean.test.js +11 -0
- package/src/directive/attrs/element-style.html +21 -0
- package/src/directive/attrs/element-style.test.js +11 -0
- package/src/directive/bind/bing-html.spec.js +1 -1
- package/src/directive/class/class.js +1 -1
- package/src/directive/form/form.js +12 -19
- package/src/directive/if/if.spec.js +2 -3
- package/src/directive/if/if.test.js +1 -2
- package/src/directive/include/include.js +2 -2
- package/src/directive/input/input.js +1 -2
- package/src/directive/input/input.spec.js +187 -191
- package/src/directive/list/list.js +2 -2
- package/src/directive/model/model.js +14 -19
- package/src/directive/model-options/model-options.js +22 -26
- package/src/directive/options/options.js +1 -3
- package/src/directive/options/options.spec.js +3 -4
- package/src/directive/repeat/repeat.js +2 -2
- package/src/directive/repeat/repeat.spec.js +48 -57
- package/src/directive/select/select.spec.js +9 -10
- package/src/directive/switch/switch.js +1 -2
- package/src/directive/validators/validators.js +3 -3
- package/src/public.js +1 -1
- package/src/router/directives/state-directives.js +18 -16
- package/src/router/directives/view-directive.js +2 -2
- package/src/router/state/views.js +2 -2
- package/src/router/url/url-service.js +2 -8
- package/src/router/url/url-service.spec.js +3 -4
- package/src/services/http/http.js +5 -6
- package/src/services/http-backend/http-backend.js +19 -17
- package/src/shared/common.js +5 -8
- package/src/shared/jqlite/jqlite.js +14 -12
- package/src/shared/jqlite/jqlite.spec.js +2 -2
- package/src/shared/utils.js +15 -92
- package/types/animations/shared.d.ts +1 -1
- package/types/core/compile/compile.d.ts +1 -1
- package/types/core/interpolate/interpolate.d.ts +1 -1
- package/types/core/{parser → parse/ast}/ast.d.ts +17 -17
- package/types/core/{parser → parse}/interpreter.d.ts +7 -7
- package/types/core/{parser → parse/parser}/parser.d.ts +8 -8
- package/types/core/scope/scope.d.ts +3 -3
- package/types/directive/class/class.d.ts +3 -3
- package/types/directive/form/form.d.ts +1 -0
- package/types/directive/model/model.d.ts +6 -6
- package/types/directive/validators/validators.d.ts +3 -3
- package/types/shared/common.d.ts +0 -1
- package/types/shared/utils.d.ts +0 -35
- package/src/core/parser/parser.test.js +0 -19
- /package/src/core/{parser → parse}/ast-type.js +0 -0
- /package/src/core/{parser → parse}/parse.md +0 -0
- /package/types/core/{parser → parse}/ast-type.d.ts +0 -0
- /package/types/core/{parser → parse/lexer}/lexer.d.ts +0 -0
- /package/types/core/{parser → parse}/parse.d.ts +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { test, expect } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
test("parser unit tests contain no errors", async ({ page }) => {
|
|
4
|
+
await page.goto("src/core/parse/parse.html");
|
|
5
|
+
await page.content();
|
|
6
|
+
await page.waitForTimeout(100);
|
|
7
|
+
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
8
|
+
/0 failures/,
|
|
9
|
+
);
|
|
10
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>AngularTS Test Runner</title>
|
|
6
|
+
|
|
7
|
+
<link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
|
|
8
|
+
<link rel="stylesheet" href="/jasmine/jasmine-5.1.2/jasmine.css" />
|
|
9
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine.js"></script>
|
|
10
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
|
|
11
|
+
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
|
+
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
|
+
<script type="module" src="/src/core/parse/parser/parser.spec.js"></script>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div id="dummy"></div>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AST } from "
|
|
2
|
-
import { ASTType } from "
|
|
3
|
-
import { ASTInterpreter } from "
|
|
1
|
+
import { AST } from "../ast/ast.js";
|
|
2
|
+
import { ASTType } from "../ast-type.js";
|
|
3
|
+
import { ASTInterpreter } from "../interpreter.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} ParsedAST
|
|
7
|
-
* @property {import("
|
|
7
|
+
* @property {import("../ast/ast.js").ASTNode} ast - AST representation of expression
|
|
8
8
|
* @property {boolean} oneTime - True if expression should be evaluated only once
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ import { ASTInterpreter } from "./interpreter";
|
|
|
14
14
|
export class Parser {
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
|
-
* @param {import('
|
|
17
|
+
* @param {import('../lexer/lexer.js').Lexer} lexer
|
|
18
18
|
* @param {function(any):any} $filter
|
|
19
19
|
*/
|
|
20
20
|
constructor(lexer, $filter) {
|
|
@@ -28,7 +28,7 @@ export class Parser {
|
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
30
30
|
* @param {string} exp - Expression to be parsed
|
|
31
|
-
* @returns {import("
|
|
31
|
+
* @returns {import("../parse.js").CompiledExpression}
|
|
32
32
|
*/
|
|
33
33
|
parse(exp) {
|
|
34
34
|
const { ast, oneTime } = this.getAst(exp);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { test, expect } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
test("parser unit tests contain no errors", async ({ page }) => {
|
|
4
|
+
await page.goto("src/core/parse/parser/parser.html");
|
|
5
|
+
await page.content();
|
|
6
|
+
await page.waitForTimeout(100);
|
|
7
|
+
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
8
|
+
/0 failures/,
|
|
9
|
+
);
|
|
10
|
+
});
|
package/src/core/sce/sce.js
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
urlResolve,
|
|
5
5
|
} from "./../url-utils/url-utils";
|
|
6
6
|
import {
|
|
7
|
-
forEach,
|
|
8
7
|
isFunction,
|
|
9
8
|
isRegExp,
|
|
10
9
|
isString,
|
|
@@ -731,7 +730,7 @@ export function SceProvider() {
|
|
|
731
730
|
const { getTrusted } = sce;
|
|
732
731
|
const { trustAs } = sce;
|
|
733
732
|
|
|
734
|
-
forEach(
|
|
733
|
+
Object.entries(SCE_CONTEXTS).forEach(([name, enumValue]) => {
|
|
735
734
|
const lName = lowercase(name);
|
|
736
735
|
sce[snakeToCamel(`parse_as_${lName}`)] = function (expr) {
|
|
737
736
|
return parse(enumValue, expr);
|
package/src/core/scope/scope.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
concat,
|
|
3
|
-
forEach,
|
|
4
3
|
minErr,
|
|
5
4
|
nextUid,
|
|
6
5
|
isFunction,
|
|
@@ -69,7 +68,7 @@ let lastDirtyWatch = null;
|
|
|
69
68
|
let applyAsyncId = null;
|
|
70
69
|
|
|
71
70
|
/** Services required by each scope instance */
|
|
72
|
-
/** @type {import('../
|
|
71
|
+
/** @type {import('../parse/parse').ParseService} */
|
|
73
72
|
let $parse;
|
|
74
73
|
/** @type {import('../../services/browser').Browser} */
|
|
75
74
|
let $browser;
|
|
@@ -98,7 +97,7 @@ export class RootScopeProvider {
|
|
|
98
97
|
"$browser",
|
|
99
98
|
/**
|
|
100
99
|
* @param {import('../exception-handler').ErrorHandler} exceptionHandler
|
|
101
|
-
* @param {import('../
|
|
100
|
+
* @param {import('../parse/parse').ParseService} parse
|
|
102
101
|
* @param {import('../../services/browser').Browser} browser
|
|
103
102
|
* @returns {Scope} root scope
|
|
104
103
|
*/
|
|
@@ -375,7 +374,7 @@ export class Scope {
|
|
|
375
374
|
*
|
|
376
375
|
*
|
|
377
376
|
*
|
|
378
|
-
* @param {string | ((scope: Scope) => any) | import("../
|
|
377
|
+
* @param {string | ((scope: Scope) => any) | import("../parse/parse.js").CompiledExpression} watchExp Expression that is evaluated on each
|
|
379
378
|
* {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers
|
|
380
379
|
* a call to the `listener`.
|
|
381
380
|
*
|
|
@@ -473,7 +472,7 @@ export class Scope {
|
|
|
473
472
|
});
|
|
474
473
|
}
|
|
475
474
|
|
|
476
|
-
forEach(
|
|
475
|
+
Object.entries(watchExpressions).forEach(([i, expr]) => {
|
|
477
476
|
const unwatchFn = self.$watch(expr, (value) => {
|
|
478
477
|
newValues[i] = value;
|
|
479
478
|
if (!changeReactionScheduled) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { test, expect } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
const TEST_URL = "src/directive/attrs/attrs.html";
|
|
4
|
+
|
|
5
|
+
test("unit tests contain no errors", async ({ page }) => {
|
|
6
|
+
await page.goto(TEST_URL);
|
|
7
|
+
await page.content();
|
|
8
|
+
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
|
+
/0 failures/,
|
|
10
|
+
);
|
|
11
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>AngularTS Test Runner</title>
|
|
6
|
+
|
|
7
|
+
<link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
|
|
8
|
+
<link rel="stylesheet" href="/jasmine/jasmine-5.1.2/jasmine.css" />
|
|
9
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine.js"></script>
|
|
10
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
|
|
11
|
+
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
|
+
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
|
+
<script type="module" src="/src/directive/attrs/boolean.spec.js"></script>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div id="dummy"></div>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { test, expect } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
const TEST_URL = "src/directive/attrs/boolean.html";
|
|
4
|
+
|
|
5
|
+
test("unit tests contain no errors", async ({ page }) => {
|
|
6
|
+
await page.goto(TEST_URL);
|
|
7
|
+
await page.content();
|
|
8
|
+
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
|
+
/0 failures/,
|
|
10
|
+
);
|
|
11
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>AngularTS Test Runner</title>
|
|
6
|
+
|
|
7
|
+
<link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
|
|
8
|
+
<link rel="stylesheet" href="/jasmine/jasmine-5.1.2/jasmine.css" />
|
|
9
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine.js"></script>
|
|
10
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
|
|
11
|
+
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
|
+
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
|
+
<script
|
|
14
|
+
type="module"
|
|
15
|
+
src="/src/directive/attrs/element-style.spec.js"
|
|
16
|
+
></script>
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
<div id="dummy"></div>
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { test, expect } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
const TEST_URL = "src/directive/attrs/element-style.html";
|
|
4
|
+
|
|
5
|
+
test("unit tests contain no errors", async ({ page }) => {
|
|
6
|
+
await page.goto(TEST_URL);
|
|
7
|
+
await page.content();
|
|
8
|
+
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
|
+
/0 failures/,
|
|
10
|
+
);
|
|
11
|
+
});
|
|
@@ -23,7 +23,7 @@ describe("ngBindHtml", () => {
|
|
|
23
23
|
it("should reset html when value is null or undefined", () => {
|
|
24
24
|
const element = $compile('<div ng-bind-html="html"></div>')($rootScope);
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
[null, undefined, ""].forEach((val) => {
|
|
27
27
|
$rootScope.html = "some val";
|
|
28
28
|
$rootScope.$digest();
|
|
29
29
|
expect(element.html()).toEqual("some val");
|
|
@@ -8,7 +8,7 @@ function classDirective(name, selector) {
|
|
|
8
8
|
"$parse",
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
|
-
* @param {import("../../core/
|
|
11
|
+
* @param {import("../../core/parse/parse.js").ParseService} $parse
|
|
12
12
|
* @returns {import("../../types").Directive}
|
|
13
13
|
*/
|
|
14
14
|
($parse) => ({
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
arrayRemove,
|
|
6
6
|
isBoolean,
|
|
7
7
|
snakeCase,
|
|
8
|
-
forEach,
|
|
9
8
|
extend,
|
|
10
9
|
isUndefined,
|
|
11
10
|
} from "../../shared/utils";
|
|
@@ -215,32 +214,26 @@ FormController.prototype = {
|
|
|
215
214
|
if (control.$name && this[control.$name] === control) {
|
|
216
215
|
delete this[control.$name];
|
|
217
216
|
}
|
|
218
|
-
|
|
219
|
-
this.$pending
|
|
220
|
-
function (value, name) {
|
|
217
|
+
this.$pending &&
|
|
218
|
+
Object.keys(this.$pending).forEach((name) => {
|
|
221
219
|
this.$setValidity(name, null, control);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
forEach(
|
|
226
|
-
this.$error,
|
|
227
|
-
function (value, name) {
|
|
220
|
+
});
|
|
221
|
+
this.$error &&
|
|
222
|
+
Object.keys(this.$error).forEach((name) => {
|
|
228
223
|
this.$setValidity(name, null, control);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
forEach(
|
|
233
|
-
this.$$success,
|
|
234
|
-
function (value, name) {
|
|
224
|
+
});
|
|
225
|
+
this.$$success &&
|
|
226
|
+
Object.keys(this.$$success).forEach((name) => {
|
|
235
227
|
this.$setValidity(name, null, control);
|
|
236
|
-
}
|
|
237
|
-
this,
|
|
238
|
-
);
|
|
228
|
+
});
|
|
239
229
|
|
|
240
230
|
arrayRemove(this.$$controls, control);
|
|
241
231
|
control.$$parentForm = nullFormCtrl;
|
|
242
232
|
},
|
|
243
233
|
|
|
234
|
+
// eslint-disable-next-line no-unused-vars
|
|
235
|
+
$setValidity: function (_a, _b, _c) {},
|
|
236
|
+
|
|
244
237
|
/**
|
|
245
238
|
* Sets the form to a dirty state.
|
|
246
239
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
2
|
-
import {
|
|
2
|
+
import { valueFn } from "../../shared/utils";
|
|
3
3
|
import { Angular } from "../../loader";
|
|
4
|
-
import { createInjector } from "../../core/di/injector";
|
|
5
4
|
import { wait } from "../../shared/test-utils";
|
|
6
5
|
|
|
7
6
|
describe("ngIf", () => {
|
|
@@ -37,7 +36,7 @@ describe("ngIf", () => {
|
|
|
37
36
|
});
|
|
38
37
|
|
|
39
38
|
function makeIf() {
|
|
40
|
-
|
|
39
|
+
Array.from(arguments).forEach((expr) => {
|
|
41
40
|
element.append(
|
|
42
41
|
$compile(`<div class="my-class" ng-if="${expr}"><div>Hi</div></div>`)(
|
|
43
42
|
$scope,
|
|
@@ -87,7 +87,7 @@ test.describe("animations", () => {
|
|
|
87
87
|
await expect(animated).toHaveClass(/ng-enter-active/);
|
|
88
88
|
|
|
89
89
|
// Wait for the transition to complete
|
|
90
|
-
await page.waitForTimeout(
|
|
90
|
+
await page.waitForTimeout(100);
|
|
91
91
|
await expect(animated).not.toHaveClass(/ng-enter/);
|
|
92
92
|
await expect(animated).not.toHaveClass(/ng-enter-active/);
|
|
93
93
|
|
|
@@ -106,7 +106,6 @@ test.describe("animations", () => {
|
|
|
106
106
|
await page.goto("src/directive/if/if-animate-css.html");
|
|
107
107
|
await page.content();
|
|
108
108
|
await page.click('button:has-text("Fade In!")');
|
|
109
|
-
await page.waitForTimeout(600);
|
|
110
109
|
let animated = await page.locator("#circle");
|
|
111
110
|
await expect(animated).not.toHaveClass(/ng-enter/);
|
|
112
111
|
await expect(animated).not.toHaveClass(/ng-enter-active/);
|
|
@@ -15,7 +15,7 @@ export const ngIncludeDirective = [
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
($templateRequest, $anchorScroll, $animate) => ({
|
|
18
|
-
restrict: "
|
|
18
|
+
restrict: "EA",
|
|
19
19
|
priority: 400,
|
|
20
20
|
terminal: true,
|
|
21
21
|
transclude: "element",
|
|
@@ -129,7 +129,7 @@ export const ngIncludeDirective = [
|
|
|
129
129
|
export const ngIncludeFillContentDirective = [
|
|
130
130
|
"$compile",
|
|
131
131
|
($compile) => ({
|
|
132
|
-
restrict: "
|
|
132
|
+
restrict: "EA",
|
|
133
133
|
priority: -400,
|
|
134
134
|
require: "ngInclude",
|
|
135
135
|
link(scope, $element, _$attr, ctrl) {
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
isNumber,
|
|
9
9
|
isNumberNaN,
|
|
10
10
|
isDate,
|
|
11
|
-
forEach,
|
|
12
11
|
convertTimezoneToLocal,
|
|
13
12
|
addDateMinutes,
|
|
14
13
|
timezoneToOffset,
|
|
@@ -286,7 +285,7 @@ export function createDateParser(regexp, mapping) {
|
|
|
286
285
|
map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };
|
|
287
286
|
}
|
|
288
287
|
|
|
289
|
-
forEach(
|
|
288
|
+
Object.entries(parts).forEach(([index, part]) => {
|
|
290
289
|
if (index < mapping.length) {
|
|
291
290
|
map[mapping[index]] = +part;
|
|
292
291
|
}
|