@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.
@@ -987,7 +987,7 @@ describe("form", () => {
987
987
  });
988
988
 
989
989
  const { parent } = scope;
990
- const { child } = doc.find("input").scope();
990
+ const child = parent.child;
991
991
  const input = child.text;
992
992
 
993
993
  expect(parent).toBeDefined();
@@ -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 = element.children().scope();
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(element.children().scope()).toBeFalsy();
239
+ expect($rootScope.$$childHead).toBeFalsy();
240
240
 
241
241
  $rootScope.url = "/mock/hello";
242
242
  $rootScope.$digest();
243
243
 
244
244
  setTimeout(() => {
245
- expect(element.children().scope().$parent).toBe($rootScope);
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(element.children().scope().$parent).toBe($rootScope);
261
+ expect($rootScope.$$childHead.$parent).toBe($rootScope);
262
262
 
263
263
  $rootScope.url = null;
264
264
  $rootScope.$digest();
@@ -62,7 +62,7 @@ describe("ngInit", () => {
62
62
  )($rootScope);
63
63
  $rootScope.$digest();
64
64
  expect($rootScope.test).toBeUndefined();
65
- expect(element.children("div").scope().test).toEqual(123);
65
+ expect($rootScope.$$childHead.test).toEqual(123);
66
66
  });
67
67
  });
68
68
  });
@@ -223,32 +223,29 @@ describe("ngSwitch", () => {
223
223
 
224
224
  it("should properly create and destroy child scopes", () => {
225
225
  element = $compile(
226
- '<ng:switch on="url">' +
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
- const getChildScope = function () {
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 = getChildScope();
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
- expect(getChildScope()).toBeUndefined();
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
- const child2 = getChildScope();
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
  });