@angular-wave/angular.ts 0.0.71 → 0.0.73
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 +1 -1
- package/src/animations/animate-children-directive.md +1 -1
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-css.html +2 -2
- package/src/animations/animate-js.html +5 -2
- package/src/animations/animate-queue.js +5 -5
- package/src/animations/animate-swap.md +1 -1
- package/src/{core/animate → animations}/animate.html +1 -1
- package/src/{core/animate → animations}/animate.js +4 -138
- package/src/animations/raf-scheduler.js +7 -3
- package/src/animations/raf-scheduler.spec.js +3 -3
- package/src/animations/shared.js +2 -2
- package/src/binding.spec.js +4 -3
- package/src/core/compile/attributes.js +8 -1
- package/src/core/compile/compile.spec.js +44 -28
- package/src/core/controller/controller.js +9 -3
- package/src/core/di/injector.md +1 -1
- package/src/core/di/ng-module.js +46 -3
- package/src/core/prop.spec.js +15 -11
- package/src/core/q/q.js +2 -1
- package/src/directive/bind/bind.spec.js +80 -44
- package/src/directive/change/change.js +3 -1
- package/src/directive/class/class.js +43 -14
- package/src/directive/class/class.spec.js +7 -4
- package/src/directive/form/form.js +5 -4
- package/src/directive/form/form.spec.js +3 -4
- package/src/directive/if/if-animate-css.html +5 -7
- package/src/directive/if/if.js +1 -1
- package/src/directive/if/if.spec.js +3 -2
- package/src/directive/include/include.js +1 -1
- package/src/directive/input/input.spec.js +6 -4
- package/src/directive/list/list.js +3 -3
- package/src/directive/list/list.spec.js +4 -2
- package/src/directive/messages/messages.js +177 -172
- package/src/directive/messages/messages.spec.js +4 -4
- package/src/directive/model/model.js +261 -471
- package/src/directive/model/model.spec.js +4 -3
- package/src/directive/model-options/model-options.spec.js +3 -1
- package/src/directive/repeat/repeat.md +1 -1
- package/src/directive/repeat/repeat.spec.js +1 -1
- package/src/directive/select/select.spec.js +3 -3
- package/src/directive/show-hide/show-hide.js +36 -6
- package/src/directive/switch/switch.js +4 -4
- package/src/directive/switch/switch.spec.js +5 -2
- package/src/directive/validators/validators.spec.js +6 -4
- package/src/loader.js +1 -2
- package/src/public.js +22 -10
- package/src/router/directives/state-directives.js +2 -9
- package/src/router/hooks/core-resolvables.js +5 -3
- package/src/router/path/path-utils.js +1 -2
- package/src/router/resolve/resolve-context.js +14 -29
- package/src/router/state/state-queue-manager.js +1 -2
- package/src/router/state/state-service.js +2 -3
- package/src/router/transition/transition.js +2 -2
- package/src/router/view/view.js +2 -8
- package/src/services/anchor-scroll.html +1 -1
- package/src/shared/common.js +3 -8
- package/src/shared/common.spec.js +1 -19
- package/src/shared/hof.js +1 -8
- package/src/shared/jqlite/jqlite.js +2 -2
- package/src/shared/predicates.js +3 -2
- package/src/types.js +2 -3
- package/types/animations/animate-css-driver.d.ts +1 -1
- package/types/animations/animate-queue.d.ts +1 -2
- package/types/{core/animate → animations}/animate.d.ts +2 -12
- package/types/animations/raf-scheduler.d.ts +7 -2
- package/types/core/compile/attributes.d.ts +10 -1
- package/types/core/di/ng-module.d.ts +55 -12
- package/types/core/q/q.d.ts +4 -2
- package/types/directive/form/form.d.ts +3 -1
- package/types/directive/messages/messages.d.ts +76 -0
- package/types/directive/model/model.d.ts +101 -239
- package/types/router/resolve/resolve-context.d.ts +0 -2
- package/types/router/transition/transition.d.ts +0 -1
- package/types/shared/common.d.ts +0 -3
- package/types/shared/hof.d.ts +0 -1
- package/types/shared/jqlite/jqlite.d.ts +4 -4
- package/types/types.d.ts +4 -2
- package/src/animations/module.js +0 -25
- package/src/core/animate/animate-css.js +0 -88
- package/src/core/animate/anomate.md +0 -13
- package/types/animations/module.d.ts +0 -1
- package/types/core/animate/animate-css.d.ts +0 -19
- /package/src/{core/animate → animations}/animate-runner.js +0 -0
- /package/src/{core/animate → animations}/animate.spec.js +0 -0
- /package/src/{core/animate → animations}/helpers.js +0 -0
- /package/types/{core/animate → animations}/animate-runner.d.ts +0 -0
- /package/types/{core/animate → animations}/helpers.d.ts +0 -0
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.73",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/angular-ts.esm.js",
|
|
8
8
|
"browser": "dist/angular-ts.umd.js",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
</file>
|
|
72
72
|
<file name="script.js">
|
|
73
|
-
angular.module('ngAnimateChildren', [
|
|
73
|
+
angular.module('ngAnimateChildren', [])
|
|
74
74
|
.controller('MainController', function MainController() {
|
|
75
75
|
this.animateChildren = false;
|
|
76
76
|
this.enterElement = false;
|
|
@@ -26,7 +26,7 @@ export function $$AnimateCssDriverProvider($$animationProvider) {
|
|
|
26
26
|
/**
|
|
27
27
|
*
|
|
28
28
|
* @param {*} $animateCss
|
|
29
|
-
* @param {typeof import('
|
|
29
|
+
* @param {typeof import('./animate-runner').AnimateRunner} $$AnimateRunner
|
|
30
30
|
* @param {JQLite} $rootElement
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
<!--
|
|
10
10
|
<script src="https://cdn.jsdelivr.net/npm/angular@1.8.3/angular.js"></script>
|
|
11
11
|
<script src="https://cdn.jsdelivr.net/npm/angular-animate@1.8.3/angular-animate.js"></script>
|
|
12
|
-
<script>window.angular.module("test", [
|
|
12
|
+
<script>window.angular.module("test", [])</script> -->
|
|
13
13
|
|
|
14
14
|
<script type="module" src="/src/index.js"></script>
|
|
15
15
|
<script>
|
|
16
16
|
document.addEventListener("DOMContentLoaded", () => {
|
|
17
|
-
window.angular.module("test", [
|
|
17
|
+
window.angular.module("test", []);
|
|
18
18
|
});
|
|
19
19
|
</script>
|
|
20
20
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<script src="https://cdn.jsdelivr.net/npm/animejs@3.2.2/lib/anime.min.js"></script>
|
|
10
10
|
<script>
|
|
11
11
|
document.addEventListener("DOMContentLoaded", () => {
|
|
12
|
-
window.angular.module("test", [
|
|
12
|
+
window.angular.module("test", []).animation(".movable", [
|
|
13
13
|
function () {
|
|
14
14
|
return {
|
|
15
15
|
addClass: function (element, className, doneFn) {
|
|
@@ -34,7 +34,10 @@
|
|
|
34
34
|
<style></style>
|
|
35
35
|
</head>
|
|
36
36
|
<body ng-app="test">
|
|
37
|
-
<div ng-class="location" class="
|
|
37
|
+
<div ng-class="location" class="movable" animate="true">
|
|
38
|
+
this box is moody {{ location }}
|
|
39
|
+
</div>
|
|
40
|
+
<div ng-class="location" class="movable" data-animate="true">
|
|
38
41
|
this box is moody {{ location }}
|
|
39
42
|
</div>
|
|
40
43
|
<button ng-click="location='0'">Change to red</button>
|
|
@@ -145,14 +145,14 @@ export function $$AnimateQueueProvider($animateProvider) {
|
|
|
145
145
|
|
|
146
146
|
this.$get = [
|
|
147
147
|
"$rootScope",
|
|
148
|
-
"$
|
|
148
|
+
"$injector",
|
|
149
149
|
"$$animation",
|
|
150
150
|
"$$AnimateRunner",
|
|
151
151
|
"$templateRequest",
|
|
152
152
|
/**
|
|
153
153
|
*
|
|
154
|
-
* @param {
|
|
155
|
-
* @param {
|
|
154
|
+
* @param {import('../core/scope/scope').Scope} $rootScope
|
|
155
|
+
* @param {*} $injector
|
|
156
156
|
* @param {*} $$animation
|
|
157
157
|
* @param {*} $$AnimateRunner
|
|
158
158
|
* @param {*} $templateRequest
|
|
@@ -160,7 +160,7 @@ export function $$AnimateQueueProvider($animateProvider) {
|
|
|
160
160
|
*/
|
|
161
161
|
function (
|
|
162
162
|
$rootScope,
|
|
163
|
-
$
|
|
163
|
+
$injector,
|
|
164
164
|
$$animation,
|
|
165
165
|
$$AnimateRunner,
|
|
166
166
|
$templateRequest,
|
|
@@ -747,7 +747,7 @@ export function $$AnimateQueueProvider($animateProvider) {
|
|
|
747
747
|
*/
|
|
748
748
|
function areAnimationsAllowed(node, parentNode) {
|
|
749
749
|
const bodyNode = document.body;
|
|
750
|
-
const rootNode = getDomNode($rootElement);
|
|
750
|
+
const rootNode = getDomNode($injector.get("$rootElement"));
|
|
751
751
|
|
|
752
752
|
let bodyNodeDetected = node === bodyNode || node.nodeName === "HTML";
|
|
753
753
|
let rootNodeDetected = node === rootNode;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
- </div>
|
|
33
33
|
- </file>
|
|
34
34
|
- <file name="script.js">
|
|
35
|
-
- angular.module('ngAnimateSwapExample', [
|
|
35
|
+
- angular.module('ngAnimateSwapExample', [])
|
|
36
36
|
- .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) {
|
|
37
37
|
- $scope.number = 0;
|
|
38
38
|
- $interval(function() {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
|
|
11
11
|
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
12
|
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
|
-
<script type="module" src="/src/
|
|
13
|
+
<script type="module" src="/src/animations/animate.spec.js"></script>
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="dummy"></div>
|
|
@@ -5,10 +5,9 @@ import {
|
|
|
5
5
|
isString,
|
|
6
6
|
minErr,
|
|
7
7
|
extend,
|
|
8
|
-
} from "
|
|
9
|
-
import { JQLite } from "
|
|
10
|
-
import { NG_ANIMATE_CLASSNAME } from "
|
|
11
|
-
import { addInlineStyles } from "./helpers";
|
|
8
|
+
} from "../shared/utils";
|
|
9
|
+
import { JQLite } from "../shared/jqlite/jqlite";
|
|
10
|
+
import { NG_ANIMATE_CLASSNAME } from "./shared";
|
|
12
11
|
|
|
13
12
|
/** @typedef {"enter"|"leave"|"move"|"addClass"|"setClass"|"removeClass"} AnimationMethod */
|
|
14
13
|
|
|
@@ -41,24 +40,6 @@ function extractElementNode(element) {
|
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
function splitClasses(classes) {
|
|
45
|
-
if (isString(classes)) {
|
|
46
|
-
classes = classes.split(" ");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Use Object.create(null) to prevent class assumptions involving property names in
|
|
50
|
-
// Object.prototype
|
|
51
|
-
const obj = Object.create(null);
|
|
52
|
-
forEach(classes, (klass) => {
|
|
53
|
-
// sometimes the split leaves empty string values
|
|
54
|
-
// incase extra spaces were applied to the options
|
|
55
|
-
if (klass.length) {
|
|
56
|
-
obj[klass] = true;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
return obj;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
43
|
// if any other type of options value besides an Object value is
|
|
63
44
|
// passed into the $animate.method() animation then this helper code
|
|
64
45
|
// will be run which will ignore it. While this patch is not the
|
|
@@ -70,121 +51,6 @@ function prepareAnimateOptions(options) {
|
|
|
70
51
|
return isObject(options) ? options : {};
|
|
71
52
|
}
|
|
72
53
|
|
|
73
|
-
// this is prefixed with Core since it conflicts with
|
|
74
|
-
// the animateQueueProvider defined in ngAnimate/animateQueue.js
|
|
75
|
-
export function CoreAnimateQueueProvider() {
|
|
76
|
-
const postDigestQueue = new Map();
|
|
77
|
-
const postDigestElements = [];
|
|
78
|
-
|
|
79
|
-
this.$get = [
|
|
80
|
-
"$$AnimateRunner",
|
|
81
|
-
"$rootScope",
|
|
82
|
-
function ($$AnimateRunner, $rootScope) {
|
|
83
|
-
return {
|
|
84
|
-
enabled: () => {},
|
|
85
|
-
on: () => {},
|
|
86
|
-
off: () => {},
|
|
87
|
-
pin: () => {},
|
|
88
|
-
|
|
89
|
-
push(element, event, options, domOperation) {
|
|
90
|
-
if (domOperation) {
|
|
91
|
-
domOperation();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
options = options || {};
|
|
95
|
-
if (options.from) {
|
|
96
|
-
addInlineStyles(element[0], options.from);
|
|
97
|
-
}
|
|
98
|
-
if (options.to) {
|
|
99
|
-
addInlineStyles(element[0], options.to);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (options.addClass || options.removeClass) {
|
|
103
|
-
addRemoveClassesPostDigest(
|
|
104
|
-
element,
|
|
105
|
-
options.addClass,
|
|
106
|
-
options.removeClass,
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const runner = new $$AnimateRunner();
|
|
111
|
-
|
|
112
|
-
// since there are no animations to run the runner needs to be
|
|
113
|
-
// notified that the animation call is complete.
|
|
114
|
-
runner.complete();
|
|
115
|
-
return runner;
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
function updateData(data, classes, value) {
|
|
120
|
-
let changed = false;
|
|
121
|
-
if (classes) {
|
|
122
|
-
classes = isString(classes)
|
|
123
|
-
? classes.split(" ")
|
|
124
|
-
: Array.isArray(classes)
|
|
125
|
-
? classes
|
|
126
|
-
: [];
|
|
127
|
-
forEach(classes, (className) => {
|
|
128
|
-
if (className) {
|
|
129
|
-
changed = true;
|
|
130
|
-
data[className] = value;
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
return changed;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function handleCSSClassChanges() {
|
|
138
|
-
forEach(postDigestElements, function (element) {
|
|
139
|
-
const data = postDigestQueue.get(element);
|
|
140
|
-
if (data) {
|
|
141
|
-
const existing = splitClasses(element.attr("class"));
|
|
142
|
-
let toAdd = "";
|
|
143
|
-
let toRemove = "";
|
|
144
|
-
forEach(data, function (status, className) {
|
|
145
|
-
const hasClass = !!existing[className];
|
|
146
|
-
if (status !== hasClass) {
|
|
147
|
-
if (status) {
|
|
148
|
-
toAdd += (toAdd.length ? " " : "") + className;
|
|
149
|
-
} else {
|
|
150
|
-
toRemove += (toRemove.length ? " " : "") + className;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
forEach(element, function (elm) {
|
|
156
|
-
if (toRemove) {
|
|
157
|
-
toRemove.split(" ").forEach((css) => elm.classList.remove(css));
|
|
158
|
-
}
|
|
159
|
-
if (toAdd) {
|
|
160
|
-
toAdd.split(" ").forEach((css) => elm.classList.add(css));
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
postDigestQueue.delete(element);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
postDigestElements.length = 0;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function addRemoveClassesPostDigest(element, add, remove) {
|
|
170
|
-
const data = postDigestQueue.get(element) || {};
|
|
171
|
-
|
|
172
|
-
const classesAdded = updateData(data, add, true);
|
|
173
|
-
const classesRemoved = updateData(data, remove, false);
|
|
174
|
-
|
|
175
|
-
if (classesAdded || classesRemoved) {
|
|
176
|
-
postDigestQueue.set(element, data);
|
|
177
|
-
postDigestElements.push(element);
|
|
178
|
-
|
|
179
|
-
if (postDigestElements.length === 1) {
|
|
180
|
-
$rootScope.$$postDigest(handleCSSClassChanges);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
54
|
export function domInsert(element, parentElement, afterElement) {
|
|
189
55
|
// if for some reason the previous element was removed
|
|
190
56
|
// from the dom sometime before this code runs then let's
|
|
@@ -502,7 +368,7 @@ export function AnimateProvider($provide) {
|
|
|
502
368
|
* @example
|
|
503
369
|
<example module="animationExample" deps="angular-animate.js" animations="true" name="animate-cancel">
|
|
504
370
|
<file name="app.js">
|
|
505
|
-
angular.module('animationExample', [
|
|
371
|
+
angular.module('animationExample', []).component('cancelExample', {
|
|
506
372
|
templateUrl: 'template.html',
|
|
507
373
|
controller: function($element, $animate) {
|
|
508
374
|
this.runner = null;
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Creates a requestAnimationFrame scheduler.
|
|
10
|
-
* @returns {RafScheduler} The scheduler object.
|
|
11
10
|
*/
|
|
12
|
-
export function
|
|
11
|
+
export function RafSchedulerProvider() {
|
|
13
12
|
/**
|
|
14
13
|
* @type {Array<Array<Function>>}
|
|
15
14
|
*/
|
|
@@ -68,5 +67,10 @@ export function $$rAFSchedulerFactory() {
|
|
|
68
67
|
});
|
|
69
68
|
};
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* @returns {RafScheduler} The scheduler object.
|
|
72
|
+
*/
|
|
73
|
+
this.$get = function () {
|
|
74
|
+
return scheduler;
|
|
75
|
+
};
|
|
72
76
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RafSchedulerProvider } from "./raf-scheduler";
|
|
2
2
|
|
|
3
|
-
describe("
|
|
3
|
+
describe("RafSchedulerProvider", function () {
|
|
4
4
|
let scheduler;
|
|
5
5
|
let rAFCallbacks;
|
|
6
6
|
let originalRequestAnimationFrame;
|
|
@@ -8,7 +8,7 @@ describe("$$rAFSchedulerFactory", function () {
|
|
|
8
8
|
|
|
9
9
|
beforeEach(function () {
|
|
10
10
|
rAFCallbacks = [];
|
|
11
|
-
scheduler =
|
|
11
|
+
scheduler = new RafSchedulerProvider().$get();
|
|
12
12
|
|
|
13
13
|
originalRequestAnimationFrame = window.requestAnimationFrame;
|
|
14
14
|
originalCancelAnimationFrame = window.cancelAnimationFrame;
|
package/src/animations/shared.js
CHANGED
|
@@ -166,11 +166,11 @@ export function extractElementNode(element) {
|
|
|
166
166
|
export function applyAnimationClassesFactory() {
|
|
167
167
|
return function (element, options) {
|
|
168
168
|
if (options.addClass) {
|
|
169
|
-
element[0].classList.add(options.addClass);
|
|
169
|
+
element[0].classList.add(...options.addClass.trim().split(" "));
|
|
170
170
|
options.addClass = null;
|
|
171
171
|
}
|
|
172
172
|
if (options.removeClass) {
|
|
173
|
-
element[0].classList.remove(options.removeClass);
|
|
173
|
+
element[0].classList.remove(...options.removeClass.trim().split(" "));
|
|
174
174
|
options.removeClass = null;
|
|
175
175
|
}
|
|
176
176
|
};
|
package/src/binding.spec.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { JQLite, dealoc } from "./shared/jqlite/jqlite";
|
|
2
2
|
import { Angular } from "./loader";
|
|
3
|
-
import { createInjector } from "./core/di/injector";
|
|
4
3
|
import { browserTrigger } from "./shared/test-utils";
|
|
5
4
|
|
|
6
5
|
describe("binding", () => {
|
|
@@ -21,11 +20,13 @@ describe("binding", () => {
|
|
|
21
20
|
window.angular = new Angular();
|
|
22
21
|
myModule = window.angular.module("myModule", ["ng"]);
|
|
23
22
|
myModule.decorator("$exceptionHandler", function () {
|
|
24
|
-
return (exception
|
|
23
|
+
return (exception) => {
|
|
25
24
|
errors.push(exception.message);
|
|
26
25
|
};
|
|
27
26
|
});
|
|
28
|
-
$injector =
|
|
27
|
+
$injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
28
|
+
"myModule",
|
|
29
|
+
]);
|
|
29
30
|
$rootScope = $injector.get("$rootScope");
|
|
30
31
|
$compile = $injector.get("$compile");
|
|
31
32
|
$exceptionHandler = $injector.get("$exceptionHandler");
|
|
@@ -15,9 +15,16 @@ const $compileMinErr = minErr("$compile");
|
|
|
15
15
|
const SIMPLE_ATTR_NAME = /^\w/;
|
|
16
16
|
const specialAttrHolder = window.document.createElement("div");
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} AnyStringKeyObject
|
|
20
|
+
* @property {Record<string, any>} [key]
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @extends {AnyStringKeyObject}
|
|
25
|
+
*/
|
|
18
26
|
export class Attributes {
|
|
19
27
|
/**
|
|
20
|
-
*
|
|
21
28
|
* @param {import('../scope/scope').Scope} $rootScope
|
|
22
29
|
* @param {*} $animate
|
|
23
30
|
* @param {import("../exception-handler").ExceptionHandlerProvider} $exceptionHandler
|
|
@@ -58,12 +58,15 @@ describe("$compile", () => {
|
|
|
58
58
|
$sce;
|
|
59
59
|
|
|
60
60
|
beforeEach(() => {
|
|
61
|
+
dealoc(document.getElementById("dummy"));
|
|
61
62
|
log = [];
|
|
62
63
|
window.angular = new Angular();
|
|
63
64
|
module = window.angular.module("test1", ["ng"]);
|
|
64
65
|
defaultModule = window.angular.module("defaultModule", ["ng"]);
|
|
65
66
|
myModule = window.angular.module("myModule", ["ng"]);
|
|
66
|
-
injector =
|
|
67
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
68
|
+
"defaultModule",
|
|
69
|
+
]);
|
|
67
70
|
$rootScope = injector.get("$rootScope");
|
|
68
71
|
$compile = injector.get("$compile");
|
|
69
72
|
$templateCache = injector.get("$templateCache");
|
|
@@ -177,7 +180,10 @@ describe("$compile", () => {
|
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
function initInjector(name) {
|
|
180
|
-
|
|
183
|
+
dealoc(document.getElementById("dummy"));
|
|
184
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
185
|
+
name,
|
|
186
|
+
]);
|
|
181
187
|
reloadInjector();
|
|
182
188
|
}
|
|
183
189
|
|
|
@@ -7496,15 +7502,15 @@ describe("$compile", () => {
|
|
|
7496
7502
|
},
|
|
7497
7503
|
}),
|
|
7498
7504
|
);
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
(
|
|
7505
|
+
dealoc(document.getElementById("dummy"));
|
|
7506
|
+
window.angular
|
|
7507
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
7508
|
+
.invoke((_$compile_, _$rootScope_, _$templateCache_, _$sce_) => {
|
|
7502
7509
|
$compile = _$compile_;
|
|
7503
7510
|
$rootScope = _$rootScope_;
|
|
7504
7511
|
$templateCache = _$templateCache_;
|
|
7505
7512
|
$sce = _$sce_;
|
|
7506
|
-
}
|
|
7507
|
-
);
|
|
7513
|
+
});
|
|
7508
7514
|
});
|
|
7509
7515
|
|
|
7510
7516
|
it("should compile and link both attribute and text bindings", () => {
|
|
@@ -9730,10 +9736,13 @@ describe("$compile", () => {
|
|
|
9730
9736
|
template: "1:{{param1}};2:{{param2}};3:{{::param1}};4:{{::param2}}",
|
|
9731
9737
|
}));
|
|
9732
9738
|
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9739
|
+
dealoc(document.getElementById("dummy"));
|
|
9740
|
+
window.angular
|
|
9741
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9742
|
+
.invoke((_$compile_, _$rootScope_) => {
|
|
9743
|
+
$compile = _$compile_;
|
|
9744
|
+
$rootScope = _$rootScope_;
|
|
9745
|
+
});
|
|
9737
9746
|
|
|
9738
9747
|
element = $compile(
|
|
9739
9748
|
'<div other-tpl-dir param1="::foo" param2="bar"></div>',
|
|
@@ -9765,10 +9774,13 @@ describe("$compile", () => {
|
|
|
9765
9774
|
template: "1:{{param1}};2:{{param2}};3:{{::param1}};4:{{::param2}}",
|
|
9766
9775
|
}));
|
|
9767
9776
|
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9777
|
+
dealoc(document.getElementById("dummy"));
|
|
9778
|
+
window.angular
|
|
9779
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9780
|
+
.invoke((_$compile_, _$rootScope_) => {
|
|
9781
|
+
$compile = _$compile_;
|
|
9782
|
+
$rootScope = _$rootScope_;
|
|
9783
|
+
});
|
|
9772
9784
|
|
|
9773
9785
|
element = $compile(
|
|
9774
9786
|
'<div other-tpl-dir param1="{{::foo}}" param2="{{bar}}"></div>',
|
|
@@ -9800,13 +9812,14 @@ describe("$compile", () => {
|
|
|
9800
9812
|
templateUrl: "other.html",
|
|
9801
9813
|
}));
|
|
9802
9814
|
|
|
9803
|
-
|
|
9804
|
-
|
|
9815
|
+
dealoc(document.getElementById("dummy"));
|
|
9816
|
+
window.angular
|
|
9817
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9818
|
+
.invoke((_$compile_, _$rootScope_, _$templateCache_) => {
|
|
9805
9819
|
$compile = _$compile_;
|
|
9806
9820
|
$rootScope = _$rootScope_;
|
|
9807
9821
|
$templateCache = _$templateCache_;
|
|
9808
|
-
}
|
|
9809
|
-
);
|
|
9822
|
+
});
|
|
9810
9823
|
|
|
9811
9824
|
$templateCache.put(
|
|
9812
9825
|
"other.html",
|
|
@@ -9841,13 +9854,14 @@ describe("$compile", () => {
|
|
|
9841
9854
|
templateUrl: "other.html",
|
|
9842
9855
|
}));
|
|
9843
9856
|
|
|
9844
|
-
|
|
9845
|
-
|
|
9857
|
+
dealoc(document.getElementById("dummy"));
|
|
9858
|
+
window.angular
|
|
9859
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9860
|
+
.invoke((_$compile_, _$rootScope_, _$templateCache_) => {
|
|
9846
9861
|
$compile = _$compile_;
|
|
9847
9862
|
$rootScope = _$rootScope_;
|
|
9848
9863
|
$templateCache = _$templateCache_;
|
|
9849
|
-
}
|
|
9850
|
-
);
|
|
9864
|
+
});
|
|
9851
9865
|
|
|
9852
9866
|
$templateCache.put(
|
|
9853
9867
|
"other.html",
|
|
@@ -16810,15 +16824,16 @@ describe("$compile", () => {
|
|
|
16810
16824
|
});
|
|
16811
16825
|
|
|
16812
16826
|
describe("multi-element directive", () => {
|
|
16813
|
-
it("should group on link function", () => {
|
|
16827
|
+
it("should group on link function", async () => {
|
|
16814
16828
|
$rootScope.show = false;
|
|
16815
16829
|
element = $compile(
|
|
16816
16830
|
"<div>" +
|
|
16817
16831
|
'<span ng-show-start="show"></span>' +
|
|
16818
|
-
"<span ng-show-end></span>" +
|
|
16832
|
+
"<span ng-show-end='show'></span>" +
|
|
16819
16833
|
"</div>",
|
|
16820
16834
|
)($rootScope);
|
|
16821
16835
|
$rootScope.$digest();
|
|
16836
|
+
await wait(100);
|
|
16822
16837
|
const spans = element.find("span");
|
|
16823
16838
|
expect(spans.eq(0)[0].classList.contains("ng-hide")).toBeTrue();
|
|
16824
16839
|
expect(spans.eq(1)[0].classList.contains("ng-hide")).toBeTrue();
|
|
@@ -17121,7 +17136,7 @@ describe("$compile", () => {
|
|
|
17121
17136
|
}).toThrowError(/uterdir/);
|
|
17122
17137
|
});
|
|
17123
17138
|
|
|
17124
|
-
it("should support data- prefix", () => {
|
|
17139
|
+
it("should support data- prefix", async () => {
|
|
17125
17140
|
$rootScope.show = false;
|
|
17126
17141
|
element = $compile(
|
|
17127
17142
|
"<div>" +
|
|
@@ -17132,11 +17147,12 @@ describe("$compile", () => {
|
|
|
17132
17147
|
"</div>",
|
|
17133
17148
|
)($rootScope);
|
|
17134
17149
|
$rootScope.$digest();
|
|
17150
|
+
await wait(100);
|
|
17135
17151
|
const spans = element.find("span");
|
|
17136
17152
|
expect(spans.eq(0)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17137
|
-
expect(spans.eq(1)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17153
|
+
//expect(spans.eq(1)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17138
17154
|
expect(spans.eq(2)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17139
|
-
expect(spans.eq(3)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17155
|
+
// expect(spans.eq(3)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17140
17156
|
});
|
|
17141
17157
|
});
|
|
17142
17158
|
|
|
@@ -162,7 +162,9 @@ export function $ControllerProvider() {
|
|
|
162
162
|
locals,
|
|
163
163
|
identifier,
|
|
164
164
|
instance,
|
|
165
|
-
constructor ||
|
|
165
|
+
constructor ||
|
|
166
|
+
/** @type {import("../../types").Controller} */ (expression)
|
|
167
|
+
.name,
|
|
166
168
|
);
|
|
167
169
|
}
|
|
168
170
|
|
|
@@ -185,7 +187,10 @@ export function $ControllerProvider() {
|
|
|
185
187
|
locals,
|
|
186
188
|
identifier,
|
|
187
189
|
instance,
|
|
188
|
-
constructor ||
|
|
190
|
+
constructor ||
|
|
191
|
+
/** @type {import("../../types").Controller} */ (
|
|
192
|
+
expression
|
|
193
|
+
).name,
|
|
189
194
|
);
|
|
190
195
|
}
|
|
191
196
|
}
|
|
@@ -209,7 +214,8 @@ export function $ControllerProvider() {
|
|
|
209
214
|
locals,
|
|
210
215
|
identifier,
|
|
211
216
|
instance,
|
|
212
|
-
constructor ||
|
|
217
|
+
constructor ||
|
|
218
|
+
/** @type {import("../../types").Controller} */ (expression).name,
|
|
213
219
|
);
|
|
214
220
|
}
|
|
215
221
|
|