@angular-wave/angular.ts 0.4.4 → 0.4.5
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 -12
- package/index.html +3 -74
- package/package.json +1 -1
- package/src/angular.spec.js +5 -0
- package/src/animations/animate-css.js +13 -5
- package/src/animations/animate-queue.js +21 -22
- package/src/animations/animate-runner.js +8 -4
- package/src/animations/animate.md +1 -1
- package/src/animations/animate.spec.js +21 -0
- package/src/animations/animation.js +1 -1
- package/src/binding.spec.js +1 -0
- package/src/core/compile/compile.js +26 -25
- package/src/core/compile/compile.spec.js +266 -17
- package/src/core/controller/controller.js +0 -2
- package/src/core/di/injector.md +1 -1
- package/src/core/di/injector.spec.js +2 -0
- package/src/core/di/internal-injector.js +1 -2
- package/src/core/interpolate/interpolate.js +3 -16
- package/src/core/interpolate/interpolate.spec.js +16 -70
- package/src/core/interval/interval-factory.js +50 -0
- package/src/core/interval/interval.html +18 -0
- package/src/core/interval/interval.js +77 -0
- package/src/core/interval/interval.md +123 -0
- package/src/core/interval/interval.spec.js +280 -0
- package/src/core/interval/interval.test.js +1 -1
- package/src/core/location/location.js +47 -39
- package/src/core/location/location.spec.js +27 -27
- package/src/core/on.spec.js +7 -0
- package/src/core/parse/interpreter.js +7 -10
- package/src/core/parse/parse.js +5 -26
- package/src/core/parse/parse.spec.js +91 -95
- package/src/core/prop.spec.js +60 -4
- package/src/core/q/q.html +18 -0
- package/src/core/q/q.js +472 -0
- package/src/core/q/q.md +211 -0
- package/src/core/q/q.spec.js +2748 -0
- package/src/core/q/q.test.js +12 -0
- package/src/core/sce/sce.spec.js +8 -0
- package/src/core/{model/model.html → scope/scope.html} +1 -1
- package/src/core/scope/scope.js +16 -15
- package/src/core/scope/scope.spec.js +1959 -24
- package/src/core/scope/scope.test.js +12 -0
- package/src/core/timeout/timeout.html +18 -0
- package/src/core/timeout/timeout.js +109 -0
- package/src/core/timeout/timeout.spec.js +354 -0
- package/src/core/timeout/timout.test.js +12 -0
- package/src/core/url-utils/url-utils.spec.js +1 -1
- package/src/directive/aria/aria.js +6 -3
- package/src/directive/aria/aria.spec.js +87 -0
- package/src/directive/attrs/attrs.spec.js +5 -0
- package/src/directive/attrs/boolean.spec.js +15 -0
- package/src/directive/attrs/element-style.spec.js +8 -0
- package/src/directive/attrs/src.spec.js +7 -0
- package/src/directive/bind/bind.spec.js +33 -0
- package/src/directive/bind/bing-html.spec.js +3 -0
- package/src/directive/class/class.js +3 -3
- package/src/directive/class/class.spec.js +75 -9
- package/src/directive/controller/controller.spec.js +13 -0
- package/src/directive/events/click.spec.js +3 -0
- package/src/directive/events/event.spec.js +6 -0
- package/src/directive/form/form.js +3 -2
- package/src/directive/form/form.spec.js +65 -0
- package/src/directive/if/if.spec.js +4 -0
- package/src/directive/include/include.spec.js +59 -8
- package/src/directive/init/init.js +2 -6
- package/src/directive/init/init.spec.js +2 -0
- package/src/directive/input/input.spec.js +136 -0
- package/src/directive/messages/messages.spec.js +35 -4
- package/src/directive/model/model.js +25 -18
- package/src/directive/model/model.spec.js +49 -2
- package/src/directive/model-options/model-options.spec.js +6 -0
- package/src/directive/non-bindable/non-bindable.spec.js +1 -0
- package/src/directive/observe/observe.js +1 -0
- package/src/directive/observe/observe.spec.js +1 -0
- package/src/directive/options/options.spec.js +34 -0
- package/src/directive/ref/href.spec.js +15 -0
- package/src/directive/repeat/repeat.spec.js +135 -8
- package/src/directive/script/script.spec.js +2 -0
- package/src/directive/select/select.js +3 -3
- package/src/directive/select/select.spec.js +96 -0
- package/src/directive/show-hide/show-hide.js +2 -2
- package/src/directive/show-hide/show-hide.spec.js +19 -8
- package/src/directive/style/style.spec.js +7 -0
- package/src/directive/switch/switch.spec.js +5 -5
- package/src/directive/validators/validators.spec.js +1 -0
- package/src/loader.js +1 -0
- package/src/public.js +10 -2
- package/src/router/common/coreservices.js +2 -0
- package/src/router/directives/state-directives.js +14 -6
- package/src/router/directives/state-directives.spec.js +83 -0
- package/src/router/directives/view-directive.js +13 -4
- package/src/router/directives/view-directive.spec.js +71 -25
- package/src/router/hooks/lazy-load.js +2 -2
- package/src/router/hooks/views.js +5 -3
- package/src/router/resolve/resolvable.js +6 -3
- package/src/router/resolve/resolve-context.js +2 -2
- package/src/router/state/state-service.js +4 -4
- package/src/router/state/state.spec.js +5 -2
- package/src/router/state/state.test.js +1 -1
- package/src/router/state/views.js +10 -7
- package/src/router/template-factory.js +6 -3
- package/src/router/template-factory.spec.js +4 -0
- package/src/router/transition/transition-hook.js +1 -1
- package/src/router/transition/transition.js +1 -1
- package/src/router/view-hook.spec.js +2 -2
- package/src/router/view-scroll.js +6 -4
- package/src/services/browser.js +5 -8
- package/src/services/http/http.js +9 -6
- package/src/services/http/http.spec.js +31 -30
- package/src/services/http/template-request.spec.js +10 -0
- package/src/services/http-backend/http-backend.spec.js +3 -3
- package/src/services/template-request.js +4 -2
- package/src/shared/common.js +2 -1
- package/types/core/location/location.d.ts +36 -31
- package/types/core/parse/parse.d.ts +0 -26
- package/types/core/scope/scope.d.ts +11 -11
- package/src/core/model/model.js +0 -944
- package/src/core/model/model.spec.js +0 -3012
- package/types/core/model/model.d.ts +0 -204
package/index.html
CHANGED
|
@@ -4,79 +4,8 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<title>AngularTS</title>
|
|
6
6
|
<link rel="shortcut icon" type="image/png" href="images/favicon.ico">
|
|
7
|
-
<script type="module" src="/src/index.js"></script>
|
|
8
|
-
<script> document.addEventListener("DOMContentLoaded", () => {
|
|
9
|
-
class Todo {
|
|
10
|
-
constructor(task) {
|
|
11
|
-
this.task = task;
|
|
12
|
-
this.done = false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
class TodoController {
|
|
16
|
-
constructor($element) {
|
|
17
|
-
this.greeting = "Todos";
|
|
18
|
-
this.counter = 123
|
|
19
|
-
this.tasks = [
|
|
20
|
-
new Todo("Learn AngularTS"),
|
|
21
|
-
new Todo("Build an AngularTS app"),
|
|
22
|
-
];
|
|
23
|
-
window.test = this
|
|
24
|
-
setInterval(() => {
|
|
25
|
-
window.test = $element.controller()
|
|
26
|
-
}, 1000);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
increase() {
|
|
30
|
-
console.log(this)
|
|
31
|
-
this.counter++
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @param {String} task
|
|
37
|
-
* @return {void}
|
|
38
|
-
*/
|
|
39
|
-
add(task) {
|
|
40
|
-
this.tasks.push(new Todo(task));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Delete all finished tasks
|
|
45
|
-
* @return {void}
|
|
46
|
-
*/
|
|
47
|
-
archive() {
|
|
48
|
-
this.tasks = this.tasks.filter((task) => !task.done);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
class Demo {
|
|
53
|
-
constructor() {
|
|
54
|
-
this.test = "DemoCtrl"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
window.angular.module("todo", [])
|
|
58
|
-
.controller("TodoCtrl", TodoController).controller("DemoCtrl", Demo);
|
|
59
|
-
});
|
|
60
|
-
</script>
|
|
61
7
|
</head>
|
|
62
|
-
<body
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
{{ counter }}
|
|
66
|
-
|
|
67
|
-
<div ng-if="test">
|
|
68
|
-
VISIBLE
|
|
69
|
-
</div>
|
|
70
|
-
<input type="checkbox" ng-model="test">
|
|
71
|
-
{{ test }}
|
|
72
|
-
|
|
73
|
-
</div>
|
|
74
|
-
<div>
|
|
75
|
-
<input ng-model="b" />
|
|
76
|
-
{{ b }}
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<input ng-model="b" />
|
|
80
|
-
|
|
81
|
-
</body>
|
|
8
|
+
<body>
|
|
9
|
+
TODO
|
|
10
|
+
</body>
|
|
82
11
|
</html>
|
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.4.
|
|
5
|
+
"version": "0.4.5",
|
|
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
|
@@ -1519,6 +1519,7 @@ describe("angular", () => {
|
|
|
1519
1519
|
'<div>{{greeting = "hello world"}}</div>',
|
|
1520
1520
|
);
|
|
1521
1521
|
element = $compile(template)($rootScope);
|
|
1522
|
+
$rootScope.$digest();
|
|
1522
1523
|
expect(template.text()).toEqual("hello world");
|
|
1523
1524
|
expect($rootScope.greeting).toEqual("hello world");
|
|
1524
1525
|
});
|
|
@@ -1528,6 +1529,7 @@ describe("angular", () => {
|
|
|
1528
1529
|
'<div>{{greeting = "hello world"}}</div>',
|
|
1529
1530
|
);
|
|
1530
1531
|
element = $compile(template)($rootScope);
|
|
1532
|
+
$rootScope.$digest();
|
|
1531
1533
|
expect(template.text()).toEqual("hello world");
|
|
1532
1534
|
});
|
|
1533
1535
|
|
|
@@ -1540,6 +1542,8 @@ describe("angular", () => {
|
|
|
1540
1542
|
element = compile($rootScope, (clone) => {
|
|
1541
1543
|
templateClone = clone;
|
|
1542
1544
|
});
|
|
1545
|
+
$rootScope.$digest();
|
|
1546
|
+
|
|
1543
1547
|
expect(template.text()).toEqual('{{greeting = "hello world"}}');
|
|
1544
1548
|
expect(element.text()).toEqual("hello world");
|
|
1545
1549
|
expect(element).toEqual(templateClone);
|
|
@@ -1549,6 +1553,7 @@ describe("angular", () => {
|
|
|
1549
1553
|
it("should link to cloned node and create scope", () => {
|
|
1550
1554
|
const template = JQLite('<div>{{greeting = "hello world"}}</div>');
|
|
1551
1555
|
element = $compile(template)($rootScope, () => {});
|
|
1556
|
+
$rootScope.$digest();
|
|
1552
1557
|
expect(template.text()).toEqual('{{greeting = "hello world"}}');
|
|
1553
1558
|
expect(element.text()).toEqual("hello world");
|
|
1554
1559
|
expect($rootScope.greeting).toEqual("hello world");
|
|
@@ -139,6 +139,7 @@ function registerRestorableStyles(backup, node, properties) {
|
|
|
139
139
|
export function AnimateCssProvider() {
|
|
140
140
|
this.$get = [
|
|
141
141
|
"$$AnimateRunner",
|
|
142
|
+
"$timeout",
|
|
142
143
|
"$$animateCache",
|
|
143
144
|
"$$rAFScheduler",
|
|
144
145
|
"$$animateQueue",
|
|
@@ -146,12 +147,19 @@ export function AnimateCssProvider() {
|
|
|
146
147
|
/**
|
|
147
148
|
*
|
|
148
149
|
* @param {*} $$AnimateRunner
|
|
150
|
+
* @param {*} $timeout
|
|
149
151
|
* @param {*} $$animateCache
|
|
150
152
|
* @param {import("./raf-scheduler").RafScheduler} $$rAFScheduler
|
|
151
153
|
* @param {*} $$animateQueue
|
|
152
154
|
* @returns
|
|
153
155
|
*/
|
|
154
|
-
function (
|
|
156
|
+
function (
|
|
157
|
+
$$AnimateRunner,
|
|
158
|
+
$timeout,
|
|
159
|
+
$$animateCache,
|
|
160
|
+
$$rAFScheduler,
|
|
161
|
+
$$animateQueue,
|
|
162
|
+
) {
|
|
155
163
|
const applyAnimationClasses = applyAnimationClassesFactory();
|
|
156
164
|
|
|
157
165
|
function computeCachedCssStyles(
|
|
@@ -627,7 +635,7 @@ export function AnimateCssProvider() {
|
|
|
627
635
|
// Cancel the fallback closing timeout and remove the timer data
|
|
628
636
|
const animationTimerData = element.data(ANIMATE_TIMER_KEY);
|
|
629
637
|
if (animationTimerData) {
|
|
630
|
-
|
|
638
|
+
$timeout.cancel(animationTimerData[0].timer);
|
|
631
639
|
element.removeData(ANIMATE_TIMER_KEY);
|
|
632
640
|
}
|
|
633
641
|
|
|
@@ -741,7 +749,7 @@ export function AnimateCssProvider() {
|
|
|
741
749
|
(timings.animationDuration && stagger.animationDuration === 0)) &&
|
|
742
750
|
Math.max(stagger.animationDelay, stagger.transitionDelay);
|
|
743
751
|
if (maxStagger) {
|
|
744
|
-
|
|
752
|
+
$timeout(
|
|
745
753
|
triggerAnimationStart,
|
|
746
754
|
Math.floor(maxStagger * itemIndex * ONE_SECOND),
|
|
747
755
|
false,
|
|
@@ -849,14 +857,14 @@ export function AnimateCssProvider() {
|
|
|
849
857
|
const currentTimerData = animationsData[0];
|
|
850
858
|
setupFallbackTimer = endTime > currentTimerData.expectedEndTime;
|
|
851
859
|
if (setupFallbackTimer) {
|
|
852
|
-
|
|
860
|
+
$timeout.cancel(currentTimerData.timer);
|
|
853
861
|
} else {
|
|
854
862
|
animationsData.push(close);
|
|
855
863
|
}
|
|
856
864
|
}
|
|
857
865
|
|
|
858
866
|
if (setupFallbackTimer) {
|
|
859
|
-
const timer =
|
|
867
|
+
const timer = $timeout(onAnimationExpired, timerTime, false);
|
|
860
868
|
animationsData[0] = {
|
|
861
869
|
timer,
|
|
862
870
|
expectedEndTime: endTime,
|
|
@@ -182,7 +182,7 @@ export function AnimateQueueProvider($animateProvider) {
|
|
|
182
182
|
if (postDigestCalled) {
|
|
183
183
|
fn();
|
|
184
184
|
} else {
|
|
185
|
-
$rootScope
|
|
185
|
+
$rootScope.$$postDigest(() => {
|
|
186
186
|
postDigestCalled = true;
|
|
187
187
|
fn();
|
|
188
188
|
});
|
|
@@ -194,30 +194,29 @@ export function AnimateQueueProvider($animateProvider) {
|
|
|
194
194
|
// compiled. The $templateRequest.totalPendingRequests variable keeps track of
|
|
195
195
|
// all of the remote templates being currently downloaded. If there are no
|
|
196
196
|
// templates currently downloading then the watcher will still fire anyway.
|
|
197
|
-
$rootScope["templateRequest"] = $templateRequest;
|
|
197
|
+
$rootScope["$templateRequest"] = $templateRequest;
|
|
198
198
|
const deregisterWatch = $rootScope.$watch(
|
|
199
199
|
"$templateRequest.totalPendingRequests",
|
|
200
200
|
(val) => {
|
|
201
|
-
if (val
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
});
|
|
201
|
+
if (val !== 0) return;
|
|
202
|
+
deregisterWatch();
|
|
203
|
+
$rootScope["$templateRequest"] = undefined;
|
|
204
|
+
// Now that all templates have been downloaded, $animate will wait until
|
|
205
|
+
// the post digest queue is empty before enabling animations. By having two
|
|
206
|
+
// calls to $postDigest calls we can ensure that the flag is enabled at the
|
|
207
|
+
// very end of the post digest queue. Since all of the animations in $animate
|
|
208
|
+
// use $postDigest, it's important that the code below executes at the end.
|
|
209
|
+
// This basically means that the page is fully downloaded and compiled before
|
|
210
|
+
// any animations are triggered.
|
|
211
|
+
$rootScope.$$postDigest(() => {
|
|
212
|
+
$rootScope.$$postDigest(() => {
|
|
213
|
+
// we check for null directly in the event that the application already called
|
|
214
|
+
// .enabled() with whatever arguments that it provided it with
|
|
215
|
+
if (animationsEnabled === null) {
|
|
216
|
+
animationsEnabled = true;
|
|
217
|
+
}
|
|
219
218
|
});
|
|
220
|
-
}
|
|
219
|
+
});
|
|
221
220
|
},
|
|
222
221
|
);
|
|
223
222
|
|
|
@@ -598,7 +597,7 @@ export function AnimateQueueProvider($animateProvider) {
|
|
|
598
597
|
|
|
599
598
|
markElementAnimationState(node, PRE_DIGEST_STATE, newAnimation);
|
|
600
599
|
|
|
601
|
-
$rootScope
|
|
600
|
+
$rootScope.$$postDigest(() => {
|
|
602
601
|
// It is possible that the DOM nodes inside `originalElement` have been replaced. This can
|
|
603
602
|
// happen if the animated element is a transcluded clone and also has a `templateUrl`
|
|
604
603
|
// directive on it. Therefore, we must recreate `element` in order to interact with the
|
|
@@ -34,13 +34,17 @@ export function AnimateAsyncRunFactoryProvider() {
|
|
|
34
34
|
const INITIAL_STATE = 0;
|
|
35
35
|
const DONE_PENDING_STATE = 1;
|
|
36
36
|
const DONE_COMPLETE_STATE = 2;
|
|
37
|
-
let $$animateAsyncRun;
|
|
37
|
+
let $q, $$animateAsyncRun, $timeout;
|
|
38
38
|
|
|
39
39
|
export function AnimateRunnerFactoryProvider() {
|
|
40
40
|
this.$get = [
|
|
41
|
+
"$q",
|
|
41
42
|
"$$animateAsyncRun",
|
|
42
|
-
|
|
43
|
+
"$timeout",
|
|
44
|
+
function (q, animateAsyncRun, timeout) {
|
|
45
|
+
$q = q;
|
|
43
46
|
$$animateAsyncRun = animateAsyncRun;
|
|
47
|
+
$timeout = timeout;
|
|
44
48
|
return AnimateRunner;
|
|
45
49
|
},
|
|
46
50
|
];
|
|
@@ -90,7 +94,7 @@ export class AnimateRunner {
|
|
|
90
94
|
|
|
91
95
|
const rafTick = $$animateAsyncRun();
|
|
92
96
|
const timeoutTick = (fn) => {
|
|
93
|
-
|
|
97
|
+
$timeout(fn, 0, false);
|
|
94
98
|
};
|
|
95
99
|
|
|
96
100
|
this._doneCallbacks = [];
|
|
@@ -121,7 +125,7 @@ export class AnimateRunner {
|
|
|
121
125
|
getPromise() {
|
|
122
126
|
if (!this.promise) {
|
|
123
127
|
const self = this;
|
|
124
|
-
this.promise =
|
|
128
|
+
this.promise = $q((resolve, reject) => {
|
|
125
129
|
self.done((status) => {
|
|
126
130
|
if (status === false) {
|
|
127
131
|
reject();
|
|
@@ -82,6 +82,7 @@ describe("$animate", () => {
|
|
|
82
82
|
$animate.enabled(false);
|
|
83
83
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
84
84
|
$animate.addClass(element, "ng-hide");
|
|
85
|
+
$rootScope.$digest();
|
|
85
86
|
expect(element[0].classList.contains("ng-hide")).toBeTrue();
|
|
86
87
|
});
|
|
87
88
|
|
|
@@ -116,8 +117,10 @@ describe("$animate", () => {
|
|
|
116
117
|
$animate.enabled(false);
|
|
117
118
|
expect(rect[0].classList.contains("ng-hide")).toBeFalse();
|
|
118
119
|
$animate.addClass(rect, "ng-hide");
|
|
120
|
+
$rootScope.$digest();
|
|
119
121
|
expect(rect[0].classList.contains("ng-hide")).toBeTrue();
|
|
120
122
|
$animate.removeClass(rect, "ng-hide");
|
|
123
|
+
$rootScope.$digest();
|
|
121
124
|
expect(rect[0].classList.contains("ng-hide")).toBeFalse();
|
|
122
125
|
});
|
|
123
126
|
|
|
@@ -168,21 +171,25 @@ describe("$animate", () => {
|
|
|
168
171
|
$animate.addClass(element, "on", {
|
|
169
172
|
to: { color: "green" },
|
|
170
173
|
});
|
|
174
|
+
$rootScope.$digest();
|
|
171
175
|
assertColor("green");
|
|
172
176
|
|
|
173
177
|
$animate.setClass(element, "off", "on", {
|
|
174
178
|
to: { color: "black" },
|
|
175
179
|
});
|
|
180
|
+
$rootScope.$digest();
|
|
176
181
|
assertColor("black");
|
|
177
182
|
|
|
178
183
|
$animate.removeClass(element, "off", {
|
|
179
184
|
to: { color: "blue" },
|
|
180
185
|
});
|
|
186
|
+
$rootScope.$digest();
|
|
181
187
|
assertColor("blue");
|
|
182
188
|
|
|
183
189
|
$animate.leave(element, {
|
|
184
190
|
to: { color: "yellow" },
|
|
185
191
|
});
|
|
192
|
+
$rootScope.$digest();
|
|
186
193
|
assertColor("yellow");
|
|
187
194
|
|
|
188
195
|
function assertColor(color) {
|
|
@@ -198,6 +205,8 @@ describe("$animate", () => {
|
|
|
198
205
|
from: { color: "green" },
|
|
199
206
|
to: { borderColor: "purple" },
|
|
200
207
|
});
|
|
208
|
+
$rootScope.$digest();
|
|
209
|
+
|
|
201
210
|
const { style } = element[0];
|
|
202
211
|
expect(style.color).toBe("green");
|
|
203
212
|
expect(style.borderColor).toBe("purple");
|
|
@@ -208,6 +217,8 @@ describe("$animate", () => {
|
|
|
208
217
|
|
|
209
218
|
$animate.addClass(element, "ng-hide");
|
|
210
219
|
$animate.removeClass(element, "ng-hide");
|
|
220
|
+
$rootScope.$digest();
|
|
221
|
+
|
|
211
222
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
212
223
|
});
|
|
213
224
|
|
|
@@ -216,6 +227,8 @@ describe("$animate", () => {
|
|
|
216
227
|
|
|
217
228
|
$animate.removeClass(element, "ng-hide");
|
|
218
229
|
$animate.addClass(element, "ng-hide");
|
|
230
|
+
$rootScope.$digest();
|
|
231
|
+
|
|
219
232
|
expect(element[0].classList.contains("ng-hide")).toBeTrue();
|
|
220
233
|
});
|
|
221
234
|
|
|
@@ -325,6 +338,7 @@ describe("$animate", () => {
|
|
|
325
338
|
|
|
326
339
|
expect(() => {
|
|
327
340
|
fn();
|
|
341
|
+
$rootScope.$digest();
|
|
328
342
|
}).not.toThrow();
|
|
329
343
|
|
|
330
344
|
const optionsArg = captureSpy.calls.mostRecent().args[2];
|
|
@@ -339,6 +353,8 @@ describe("$animate", () => {
|
|
|
339
353
|
|
|
340
354
|
$animate.enter(element1, $rootElement, null, { addClass: " " });
|
|
341
355
|
$animate.enter(element2, $rootElement, null, { addClass: "valid-name" });
|
|
356
|
+
$rootScope.$digest();
|
|
357
|
+
|
|
342
358
|
expect(element2[0].classList.contains("valid-name")).toBeTruthy();
|
|
343
359
|
});
|
|
344
360
|
|
|
@@ -359,6 +375,7 @@ describe("$animate", () => {
|
|
|
359
375
|
const runner = $animate.enter(element, parent, null, copiedOptions);
|
|
360
376
|
expect(copiedOptions).toEqual(initialOptions);
|
|
361
377
|
|
|
378
|
+
$rootScope.$digest();
|
|
362
379
|
expect(copiedOptions).toEqual(initialOptions);
|
|
363
380
|
});
|
|
364
381
|
|
|
@@ -401,6 +418,7 @@ describe("$animate", () => {
|
|
|
401
418
|
$animate.removeClass(element, "test-class1");
|
|
402
419
|
$animate.addClass(element, "test-class2");
|
|
403
420
|
$animate.setClass(element, "test-class3", "test-class4");
|
|
421
|
+
$rootScope.$digest();
|
|
404
422
|
expect(element[0].classList.contains("test-class1")).toBeFalse();
|
|
405
423
|
expect(element[0].classList.contains("test-class2")).toBeTrue();
|
|
406
424
|
expect(element[0].classList.contains("test-class3")).toBeTrue();
|
|
@@ -425,6 +443,7 @@ describe("$animate", () => {
|
|
|
425
443
|
$animate.addClass(element, "test1");
|
|
426
444
|
$animate.removeClass(element, "test2");
|
|
427
445
|
|
|
446
|
+
$rootScope.$digest();
|
|
428
447
|
element = JQLite('<p class="test4">test</p>');
|
|
429
448
|
|
|
430
449
|
$rootScope.$apply(() => {
|
|
@@ -467,6 +486,8 @@ describe("$animate", () => {
|
|
|
467
486
|
$animate.addClass(target, "test-class2");
|
|
468
487
|
$animate.setClass(target, "test-class3", "test-class4");
|
|
469
488
|
|
|
489
|
+
$rootScope.$digest();
|
|
490
|
+
|
|
470
491
|
expect(target[0].classList.contains("test-class2")).toBeTrue();
|
|
471
492
|
expect(target[0].classList.contains("test-class3")).toBeTrue();
|
|
472
493
|
});
|
|
@@ -203,7 +203,7 @@ export function AnimationProvider() {
|
|
|
203
203
|
// were apart of the same postDigest flush call.
|
|
204
204
|
if (animationQueue.length > 1) return runner;
|
|
205
205
|
|
|
206
|
-
$rootScope
|
|
206
|
+
$rootScope.$$postDigest(() => {
|
|
207
207
|
const animations = [];
|
|
208
208
|
animationQueue.forEach((entry) => {
|
|
209
209
|
// the element was destroyed early on which removed the runner
|
package/src/binding.spec.js
CHANGED
|
@@ -549,7 +549,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
549
549
|
// When changes occur, the call to trigger their hooks will be added to this queue
|
|
550
550
|
let onChangesQueue;
|
|
551
551
|
|
|
552
|
-
// This function is called in a
|
|
552
|
+
// This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest
|
|
553
553
|
function flushOnChangesQueue() {
|
|
554
554
|
try {
|
|
555
555
|
if (!--ttl) {
|
|
@@ -561,7 +561,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
561
561
|
ttl,
|
|
562
562
|
);
|
|
563
563
|
}
|
|
564
|
-
// We must run this hook in an apply since the
|
|
564
|
+
// We must run this hook in an apply since the $$postDigest runs outside apply
|
|
565
565
|
$rootScope.$apply(() => {
|
|
566
566
|
for (let i = 0, ii = onChangesQueue.length; i < ii; ++i) {
|
|
567
567
|
try {
|
|
@@ -1336,7 +1336,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1336
1336
|
const controller = elementControllers[name];
|
|
1337
1337
|
const bindings = controllerDirective.$$bindings.bindToController;
|
|
1338
1338
|
|
|
1339
|
-
controller.instance =
|
|
1339
|
+
controller.instance = controller();
|
|
1340
1340
|
$element.data(
|
|
1341
1341
|
`$${controllerDirective.name}Controller`,
|
|
1342
1342
|
controller.instance,
|
|
@@ -2457,12 +2457,15 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2457
2457
|
if (interpolateFn) {
|
|
2458
2458
|
directives.push({
|
|
2459
2459
|
priority: 0,
|
|
2460
|
-
compile:
|
|
2461
|
-
|
|
2460
|
+
compile: function textInterpolateCompileFn() {
|
|
2461
|
+
// When transcluding a template that has bindings in the root
|
|
2462
|
+
// we don't have a parent and thus need to add the class during linking fn.
|
|
2462
2463
|
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2464
|
+
return function textInterpolateLinkFn(scope, node) {
|
|
2465
|
+
scope.$watch(interpolateFn, (value) => {
|
|
2466
|
+
node[0].nodeValue = value;
|
|
2467
|
+
});
|
|
2468
|
+
};
|
|
2466
2469
|
},
|
|
2467
2470
|
});
|
|
2468
2471
|
}
|
|
@@ -2982,23 +2985,21 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2982
2985
|
destination[scopeName],
|
|
2983
2986
|
);
|
|
2984
2987
|
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
(newValue
|
|
2989
|
-
if (
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
return;
|
|
2995
|
-
}
|
|
2996
|
-
oldValue = initialValue;
|
|
2988
|
+
removeWatch = scope[
|
|
2989
|
+
definition.collection ? "$watchCollection" : "$watch"
|
|
2990
|
+
](parentGet, (newValue, oldValue) => {
|
|
2991
|
+
if (oldValue === newValue) {
|
|
2992
|
+
if (
|
|
2993
|
+
oldValue === initialValue ||
|
|
2994
|
+
(isLiteral && equals(oldValue, initialValue))
|
|
2995
|
+
) {
|
|
2996
|
+
return;
|
|
2997
2997
|
}
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
2998
|
+
oldValue = initialValue;
|
|
2999
|
+
}
|
|
3000
|
+
recordChanges(scopeName, newValue, oldValue);
|
|
3001
|
+
destination[scopeName] = newValue;
|
|
3002
|
+
});
|
|
3002
3003
|
|
|
3003
3004
|
removeWatchCollection.push(removeWatch);
|
|
3004
3005
|
break;
|
|
@@ -3033,7 +3034,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
3033
3034
|
) {
|
|
3034
3035
|
// If we have not already scheduled the top level onChangesQueue handler then do so now
|
|
3035
3036
|
if (!onChangesQueue) {
|
|
3036
|
-
scope
|
|
3037
|
+
scope.$$postDigest(flushOnChangesQueue);
|
|
3037
3038
|
onChangesQueue = [];
|
|
3038
3039
|
}
|
|
3039
3040
|
// If we have not already queued a trigger of onChanges for this controller then do so now
|