@angular-wave/angular.ts 0.0.9 → 0.0.11
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/README.md +8 -15
- package/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/package.json +2 -3
- package/rollup.config.js +1 -1
- package/src/core/compile.js +6 -33
- package/src/core/root-scope.js +1 -1
- package/src/exts/messages.md +30 -30
- package/src/jqLite.js +3 -1
- package/test/ng/compile.spec.js +116 -143
- package/test/ng/directive/form.spec.js +1 -1
- package/test/ng/directive/if.spec.js +2 -1
- package/test/ng/directive/include.spec.js +3 -3
- package/test/ng/directive/init.spec.js +1 -1
- package/test/ng/directive/switch.spec.js +8 -11
|
@@ -103,10 +103,11 @@ describe("ngIf", () => {
|
|
|
103
103
|
|
|
104
104
|
it("should destroy the child scope every time the expression evaluates to false", () => {
|
|
105
105
|
$scope.value = true;
|
|
106
|
+
debugger;
|
|
106
107
|
element.append($compile('<div ng-if="value"></div>')($scope));
|
|
107
108
|
$scope.$apply();
|
|
108
109
|
|
|
109
|
-
const childScope =
|
|
110
|
+
const childScope = $scope.$$childHead;
|
|
110
111
|
let destroyed = false;
|
|
111
112
|
|
|
112
113
|
childScope.$on("$destroy", () => {
|
|
@@ -236,13 +236,13 @@ describe("ngInclude", () => {
|
|
|
236
236
|
const injector = angular.bootstrap(element, ["myModule"]);
|
|
237
237
|
$rootScope = injector.get("$rootScope");
|
|
238
238
|
$rootScope.$digest();
|
|
239
|
-
expect(
|
|
239
|
+
expect($rootScope.$$childHead).toBeFalsy();
|
|
240
240
|
|
|
241
241
|
$rootScope.url = "/mock/hello";
|
|
242
242
|
$rootScope.$digest();
|
|
243
243
|
|
|
244
244
|
setTimeout(() => {
|
|
245
|
-
expect(
|
|
245
|
+
expect($rootScope.$$childHead.$parent).toBe($rootScope);
|
|
246
246
|
expect(element.text()).toBe("Hello");
|
|
247
247
|
|
|
248
248
|
$rootScope.url = "/mock/401";
|
|
@@ -258,7 +258,7 @@ describe("ngInclude", () => {
|
|
|
258
258
|
}, 200);
|
|
259
259
|
|
|
260
260
|
setTimeout(() => {
|
|
261
|
-
expect(
|
|
261
|
+
expect($rootScope.$$childHead.$parent).toBe($rootScope);
|
|
262
262
|
|
|
263
263
|
$rootScope.url = null;
|
|
264
264
|
$rootScope.$digest();
|
|
@@ -223,32 +223,29 @@ describe("ngSwitch", () => {
|
|
|
223
223
|
|
|
224
224
|
it("should properly create and destroy child scopes", () => {
|
|
225
225
|
element = $compile(
|
|
226
|
-
'<ng
|
|
227
|
-
'<div ng-switch-when="a">{{name}}</div>' +
|
|
228
|
-
"</ng:switch>",
|
|
226
|
+
'<ng-switch on="url"><div ng-switch-when="a">{{name}}</div></ng-switch>',
|
|
229
227
|
)($scope);
|
|
230
228
|
$scope.$apply();
|
|
231
229
|
|
|
232
|
-
|
|
233
|
-
return element.find("div").scope();
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
expect(getChildScope()).toBeUndefined();
|
|
230
|
+
expect($scope.$$childHead).toBeNull();
|
|
237
231
|
|
|
238
232
|
$scope.url = "a";
|
|
239
233
|
$scope.$apply();
|
|
240
|
-
const child1 =
|
|
234
|
+
const child1 = $scope.$$childHead;
|
|
241
235
|
expect(child1).toBeDefined();
|
|
242
236
|
spyOn(child1, "$destroy");
|
|
243
237
|
|
|
244
238
|
$scope.url = "x";
|
|
245
239
|
$scope.$apply();
|
|
246
|
-
|
|
240
|
+
|
|
241
|
+
// NOTE THAT THE CHILD SCOPE IS NOT ACTUALLY DESTROYED.
|
|
242
|
+
expect(child1).toBeDefined();
|
|
247
243
|
expect(child1.$destroy).toHaveBeenCalled();
|
|
248
244
|
|
|
249
245
|
$scope.url = "a";
|
|
250
246
|
$scope.$apply();
|
|
251
|
-
|
|
247
|
+
// ... BUT A NEW CHILD SCOPE WILL BE CREATED IN A TAIL.
|
|
248
|
+
const child2 = $scope.$$childTail;
|
|
252
249
|
expect(child2).toBeDefined();
|
|
253
250
|
expect(child2).not.toBe(child1);
|
|
254
251
|
});
|