@angular-wave/angular.ts 0.0.9 → 0.0.10

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/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@angular-wave/angular.ts",
3
3
  "license": "MIT",
4
- "version": "0.0.9",
4
+ "version": "0.0.10",
5
5
  "type": "module",
6
- "main": "dist/angular-ts.cjs.js",
7
- "module": "dist/angular-ts.esm.js",
6
+ "main": "dist/angular-ts.esm.js",
8
7
  "browser": "dist/angular-ts.umd.js",
9
8
  "repository": {
10
9
  "type": "git",
package/rollup.config.js CHANGED
@@ -24,7 +24,7 @@ export default [
24
24
  {
25
25
  input: 'src/index.js',
26
26
  external: ['ms'],
27
- output: { file: pkg.module, format: 'es' },
27
+ output: { file: pkg.main, format: 'es' },
28
28
  plugins: [terser()],
29
29
  },
30
30
  ];
@@ -910,7 +910,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
910
910
  }
911
911
  }
912
912
 
913
- /**
913
+ /**
914
914
  * @ngdoc method
915
915
  * @name $compile.directive.Attributes#$observe
916
916
  * @kind function
@@ -1047,9 +1047,11 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1047
1047
  }
1048
1048
 
1049
1049
  options = options || {};
1050
- let { parentBoundTranscludeFn } = options;
1051
- const { transcludeControllers } = options;
1052
- const { futureParentElement } = options;
1050
+ let {
1051
+ transcludeControllers,
1052
+ parentBoundTranscludeFn,
1053
+ futureParentElement,
1054
+ } = options;
1053
1055
 
1054
1056
  // When `parentBoundTranscludeFn` is passed, it is a
1055
1057
  // `controllersBoundTransclude` function (it was previously passed
@@ -1096,9 +1098,6 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1096
1098
  );
1097
1099
  }
1098
1100
  }
1099
-
1100
- compile.$$addScopeInfo($linkNode, scope);
1101
-
1102
1101
  if (cloneConnectFn) cloneConnectFn($linkNode, scope);
1103
1102
  if (compositeLinkFn)
1104
1103
  compositeLinkFn(
@@ -1044,7 +1044,7 @@ class Scope {
1044
1044
  * Application code can register a `$destroy` event handler that will give it a chance to
1045
1045
  * perform any necessary cleanup.
1046
1046
  *
1047
- * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
1047
+ * Note that, in AngularJS, there is also a `$destroy` event, which can be used to
1048
1048
  * clean up DOM bindings before an element is removed from the DOM.
1049
1049
  */
1050
1050
  $destroy() {
@@ -518,33 +518,33 @@ _ {@link module:ngMessages Click here} to learn more about`ngMessages`and`ngMess
518
518
  _ @param {string} ngMessageExp|whenExp an expression value corresponding to the message key.
519
519
  _/
520
520
 
521
- /**
522
- * @ngdoc directive
523
- * @name ngMessageDefault
524
- * @restrict AE
525
- * @scope
526
- *
527
- * @description
528
- * `ngMessageDefault` is a directive with the purpose to show and hide a default message for
529
- * {@link directive:ngMessages}, when none of provided messages matches.
530
- *
531
- * More information about using `ngMessageDefault` can be found in the
532
- * {@link module:ngMessages `ngMessages` module documentation}.
533
- *
534
- * @usage
535
- * ```html
536
- * <!-- using attribute directives -->
537
- * <ANY ng-messages="expression" role="alert">
538
- * <ANY ng-message="stringValue">...</ANY>
539
- * <ANY ng-message="stringValue1, stringValue2, ...">...</ANY>
540
- * <ANY ng-message-default>...</ANY>
541
- * </ANY>
542
- *
543
- * <!-- or by using element directives -->
544
- * <ng-messages for="expression" role="alert">
545
- * <ng-message when="stringValue">...</ng-message>
546
- * <ng-message when="stringValue1, stringValue2, ...">...</ng-message>
547
- * <ng-message-default>...</ng-message-default>
548
- * </ng-messages>
549
- *
550
- */
521
+ /**
522
+ * @ngdoc directive
523
+ * @name ngMessageDefault
524
+ * @restrict AE
525
+ * @scope
526
+ *
527
+ * @description
528
+ * `ngMessageDefault` is a directive with the purpose to show and hide a default message for
529
+ * {@link directive:ngMessages}, when none of provided messages matches.
530
+ *
531
+ * More information about using `ngMessageDefault` can be found in the
532
+ * {@link module:ngMessages `ngMessages` module documentation}.
533
+ *
534
+ * @usage
535
+ * ```html
536
+ * <!-- using attribute directives -->
537
+ * <ANY ng-messages="expression" role="alert">
538
+ * <ANY ng-message="stringValue">...</ANY>
539
+ * <ANY ng-message="stringValue1, stringValue2, ...">...</ANY>
540
+ * <ANY ng-message-default>...</ANY>
541
+ * </ANY>
542
+ *
543
+ * <!-- or by using element directives -->
544
+ * <ng-messages for="expression" role="alert">
545
+ * <ng-message when="stringValue">...</ng-message>
546
+ * <ng-message when="stringValue1, stringValue2, ...">...</ng-message>
547
+ * <ng-message-default>...</ng-message-default>
548
+ * </ng-messages>
549
+ *
550
+ */
package/src/jqLite.js CHANGED
@@ -281,6 +281,8 @@ export function JQLite(element) {
281
281
  }
282
282
  export var jqLite = JQLite;
283
283
 
284
+ jqLite.CACHE = CACHE;
285
+
284
286
  /**
285
287
  * @param {Element} element
286
288
  * @param {boolean} [onlyDescendants]
@@ -827,7 +829,7 @@ function specialMouseHandlerWrapper(target, event, handler) {
827
829
  forEach(
828
830
  {
829
831
  removeData: jqLiteRemoveData,
830
- on: function jqLiteOn(element, type, fn, unsupported) {
832
+ on: (element, type, fn, unsupported) => {
831
833
  if (isDefined(unsupported))
832
834
  throw jqLiteMinErr(
833
835
  "onargs",
@@ -1112,15 +1112,16 @@ describe("$compile", () => {
1112
1112
  });
1113
1113
 
1114
1114
  describe("linking", () => {
1115
- it("takes a scope and attaches it to elements", () => {
1116
- registerDirectives("myDirective", () => {
1117
- return { compile: () => {} };
1118
- });
1119
- reloadModules();
1120
- var el = $("<div my-directive></div>");
1121
- $compile(el)($rootScope);
1122
- expect(el.data("$scope")).toBe($rootScope);
1123
- });
1115
+ // THERE IS NO SCOPE ATTACHED TO ACTUAL ELEMENTS
1116
+ // it("takes a scope and attaches it to elements", () => {
1117
+ // registerDirectives("myDirective", () => {
1118
+ // return { compile: () => {} };
1119
+ // });
1120
+ // reloadModules();
1121
+ // var el = $("<div my-directive></div>");
1122
+ // $compile(el)($rootScope);
1123
+ // expect(el.data("$scope")).toBe($rootScope);
1124
+ // });
1124
1125
 
1125
1126
  it("calls directive link function with scope", () => {
1126
1127
  var givenScope, givenElement, givenAttrs;
@@ -4969,10 +4970,11 @@ describe("$compile", () => {
4969
4970
  });
4970
4971
 
4971
4972
  describe("compile phase", () => {
4972
- it("should attach scope to the document node when it is compiled explicitly", () => {
4973
- $compile($document)($rootScope);
4974
- expect($document.scope()).toBe($rootScope);
4975
- });
4973
+ // NO ELEMENT ATTACHMENTS
4974
+ // it("should attach scope to the document node when it is compiled explicitly", () => {
4975
+ // $compile($document)($rootScope);
4976
+ // expect($document.scope()).toBe($rootScope);
4977
+ // });
4976
4978
 
4977
4979
  it("should not wrap root text nodes in spans", () => {
4978
4980
  element = JQLite("<div> <div>A</div>\n <div>B</div>C\t\n </div>");
@@ -4994,6 +4996,7 @@ describe("$compile", () => {
4994
4996
  // We compile the contents of element (i.e. not element itself)
4995
4997
  // Then delete these contents and check the cache has been reset to zero
4996
4998
  // Clear cache
4999
+ // Update: THIS TEST IS IRRELEVANT IF WE DONT POLLUTE THE CACHE
4997
5000
  CACHE.clear();
4998
5001
  window.angular.module("test1", ["ng"]);
4999
5002
  createInjector(["test1"]).invoke(($compile) => {
@@ -5001,7 +5004,7 @@ describe("$compile", () => {
5001
5004
  // First with only elements at the top level
5002
5005
  element = JQLite("<div><div></div></div>");
5003
5006
  $compile(element[0].childNodes)($rootScope);
5004
- expect(CACHE.size).toEqual(2);
5007
+ // expect(CACHE.size).toEqual(2);
5005
5008
  element.empty();
5006
5009
  expect(CACHE.size).toEqual(1);
5007
5010
 
@@ -5021,7 +5024,7 @@ describe("$compile", () => {
5021
5024
  // Finally with empty text nodes at the top level
5022
5025
  element = JQLite("<div> \n<div></div> </div>");
5023
5026
  $compile(element[0].childNodes)($rootScope);
5024
- expect(CACHE.size).toEqual(2);
5027
+ //expect(CACHE.size).toEqual(2);
5025
5028
  element.empty();
5026
5029
  expect(CACHE.size).toEqual(1);
5027
5030
  });
@@ -7075,13 +7078,6 @@ describe("$compile", () => {
7075
7078
  });
7076
7079
 
7077
7080
  describe("scope()/isolate() scope getters", () => {
7078
- describe("with no directives", () => {
7079
- it("should return the scope of the parent node", () => {
7080
- element = $compile("<div></div>")($rootScope);
7081
- expect(element.scope()).toBe($rootScope);
7082
- });
7083
- });
7084
-
7085
7081
  describe("with new scope directives", () => {
7086
7082
  it("should return the new scope at the directive element", () => {
7087
7083
  element = $compile("<div scope></div>")($rootScope);
@@ -7107,22 +7103,17 @@ describe("$compile", () => {
7107
7103
  });
7108
7104
 
7109
7105
  describe("with isolate scope directives", () => {
7110
- it("should return the root scope for directives at the root element", () => {
7111
- element = $compile("<div iscope></div>")($rootScope);
7112
- expect(element.scope()).toBe($rootScope);
7113
- });
7114
-
7115
7106
  it("should return the non-isolate scope at the directive element", () => {
7107
+ expect($rootScope.$$childHead).toBeNull();
7116
7108
  let directiveElement;
7117
7109
  element = $compile("<div><div iscope></div></div>")($rootScope);
7118
7110
  directiveElement = element.children();
7119
- expect(directiveElement.scope()).toBe($rootScope);
7120
- expect(directiveElement.isolateScope().$parent).toBe($rootScope);
7111
+ expect($rootScope.$$childHead.$parent).toBe($rootScope);
7121
7112
  });
7122
7113
 
7123
7114
  it("should return the isolate scope for children in the original template", () => {
7124
7115
  element = $compile("<div iscope><a></a></div>")($rootScope);
7125
- expect(element.find("a").scope()).toBe($rootScope); // xx
7116
+ expect($rootScope.$$childHead.$parent).toBe($rootScope); // xx
7126
7117
  });
7127
7118
 
7128
7119
  it("should return the isolate scope for children in directive template", () => {
@@ -13541,19 +13532,19 @@ describe("$compile", () => {
13541
13532
  element = $compile(
13542
13533
  '<div><div ng-repeat="x in xs" ng-if="x==1">{{x}}</div></div>',
13543
13534
  )($rootScope);
13544
- expect(CACHE.size).toEqual(cacheSize + 1);
13535
+ expect(CACHE.size).toEqual(cacheSize);
13545
13536
 
13546
13537
  $rootScope.$apply("xs = [0,1]");
13547
- expect(CACHE.size).toEqual(cacheSize + 2);
13538
+ expect(CACHE.size).toEqual(cacheSize);
13548
13539
 
13549
13540
  $rootScope.$apply("xs = [0]");
13550
- expect(CACHE.size).toEqual(cacheSize + 1);
13541
+ expect(CACHE.size).toEqual(cacheSize);
13551
13542
 
13552
13543
  $rootScope.$apply("xs = []");
13553
- expect(CACHE.size).toEqual(cacheSize + 1);
13544
+ expect(CACHE.size).toEqual(cacheSize);
13554
13545
 
13555
13546
  element.remove();
13556
- expect(CACHE.size).toEqual(cacheSize + 0);
13547
+ expect(CACHE.size).toEqual(cacheSize);
13557
13548
  });
13558
13549
 
13559
13550
  it('should not leak if two "element" transclusions are on the same element', () => {
@@ -13565,20 +13556,20 @@ describe("$compile", () => {
13565
13556
  $rootScope.$apply("xs = [0,1]");
13566
13557
  // At this point we have a bunch of comment placeholders but no real transcluded elements
13567
13558
  // So the cache only contains the root element's data
13568
- expect(CACHE.size).toEqual(cacheSize + 1);
13559
+ expect(CACHE.size).toEqual(cacheSize);
13569
13560
 
13570
13561
  $rootScope.$apply("val = true");
13571
13562
  // Now we have two concrete transcluded elements plus some comments so two more cache items
13572
- expect(CACHE.size).toEqual(cacheSize + 3);
13563
+ expect(CACHE.size).toEqual(cacheSize);
13573
13564
 
13574
13565
  $rootScope.$apply("val = false");
13575
13566
  // Once again we only have comments so no transcluded elements and the cache is back to just
13576
13567
  // the root element
13577
- expect(CACHE.size).toEqual(cacheSize + 1);
13568
+ expect(CACHE.size).toEqual(cacheSize);
13578
13569
 
13579
13570
  element.remove();
13580
13571
  // Now we've even removed the root element along with its cache
13581
- expect(CACHE.size).toEqual(cacheSize + 0);
13572
+ expect(CACHE.size).toEqual(cacheSize);
13582
13573
  });
13583
13574
 
13584
13575
  // it("should not leak when continuing the compilation of elements on a scope that was destroyed", () => {
@@ -13647,7 +13638,6 @@ describe("$compile", () => {
13647
13638
  $rootScope.$apply(`xs = [${xs}]`);
13648
13639
  firstRepeatedElem = element.children(".ng-scope").eq(0);
13649
13640
 
13650
- expect(firstRepeatedElem.data("$scope")).toBeDefined();
13651
13641
  privateData = CACHE.get(firstRepeatedElem[0][EXPANDO]);
13652
13642
  expect(privateData.events).toBeDefined();
13653
13643
 
@@ -17026,40 +17016,39 @@ describe("$compile", () => {
17026
17016
  "</div>",
17027
17017
  )($rootScope);
17028
17018
  $rootScope.$apply("val0 = true; val1 = true; val2 = true");
17029
-
17019
+ expect($rootScope.$$childHead).toBeTruthy();
17020
+ expect($rootScope.$$childHead.$$childHead).toBeTruthy();
17030
17021
  // At this point we should have something like:
17031
17022
  //
17032
17023
  // <div>
17033
17024
  //
17034
- // <!-- ngIf: val0 -->
17035
- //
17025
+ // <!---->
17036
17026
  // <div ng-if-start="val0">
17037
- // <!-- ngIf: val1 -->
17027
+ // <!---->
17038
17028
  // <span ng-if="val1"></span>
17039
- // <!-- end ngIf: val1 -->
17029
+ // <!---->
17040
17030
  // </div>
17041
17031
  //
17042
17032
  // <div ng-if-end="">
17043
- // <!-- ngIf: val2 -->
17033
+ // <!---->
17044
17034
  // <span ng-if="val2"></span>
17045
- // <!-- end ngIf: val2 -->
17035
+ // <!---->
17046
17036
  // </div>
17047
17037
  //
17048
- // <!-- end ngIf: val0 -->
17038
+ // <!---->
17049
17039
  // </div>
17050
- const ngIfStartScope = element.find("div").eq(0).scope();
17051
- const ngIfEndScope = element.find("div").eq(1).scope();
17040
+ // const ngIfStartScope = element.find("div").eq(0).scope();
17041
+ // const ngIfEndScope = element.find("div").eq(1).scope();
17052
17042
 
17053
- expect(ngIfStartScope.$id).toEqual(ngIfEndScope.$id);
17043
+ // expect(ngIfStartScope.$id).toEqual(ngIfEndScope.$id);
17054
17044
 
17055
- const ngIf1Scope = element.find("span").eq(0).scope();
17056
- const ngIf2Scope = element.find("span").eq(1).scope();
17045
+ // const ngIf1Scope = element.find("span").eq(0).scope();
17046
+ // const ngIf2Scope = element.find("span").eq(1).scope();
17057
17047
 
17058
- expect(ngIf1Scope.$id).not.toEqual(ngIf2Scope.$id);
17059
- expect(ngIf1Scope.$parent.$id).toEqual(ngIf2Scope.$parent.$id);
17048
+ // expect(ngIf1Scope.$id).not.toEqual(ngIf2Scope.$id);
17049
+ // expect(ngIf1Scope.$parent.$id).toEqual(ngIf2Scope.$parent.$id);
17060
17050
 
17061
17051
  $rootScope.$apply("val1 = false");
17062
-
17063
17052
  // Now we should have something like:
17064
17053
  //
17065
17054
  // <div>
@@ -17075,9 +17064,9 @@ describe("$compile", () => {
17075
17064
  // <!-- end ngIf: val0 -->
17076
17065
  // </div>
17077
17066
 
17078
- expect(ngIfStartScope.$$destroyed).not.toEqual(true);
17079
- expect(ngIf1Scope.$$destroyed).toEqual(true);
17080
- expect(ngIf2Scope.$$destroyed).not.toEqual(true);
17067
+ // expect(ngIfStartScope.$$destroyed).not.toEqual(true);
17068
+ // expect(ngIf1Scope.$$destroyed).toEqual(true);
17069
+ // expect(ngIf2Scope.$$destroyed).not.toEqual(true);
17081
17070
 
17082
17071
  $rootScope.$apply("val0 = false");
17083
17072
 
@@ -17086,10 +17075,11 @@ describe("$compile", () => {
17086
17075
  // <div>
17087
17076
  // <!-- ngIf: val0 -->
17088
17077
  // </div>
17089
-
17090
- expect(ngIfStartScope.$$destroyed).toEqual(true);
17091
- expect(ngIf1Scope.$$destroyed).toEqual(true);
17092
- expect(ngIf2Scope.$$destroyed).toEqual(true);
17078
+ // TODO: Until we figure out a better way of testing this
17079
+ expect($rootScope.$$childHead).toBeNull();
17080
+ // expect(ngIfStartScope.$$destroyed).toEqual(true);
17081
+ // expect(ngIf1Scope.$$destroyed).toEqual(true);
17082
+ // expect(ngIf2Scope.$$destroyed).toEqual(true);
17093
17083
  });
17094
17084
 
17095
17085
  it("should set up and destroy the transclusion scopes correctly", () => {
@@ -17105,7 +17095,7 @@ describe("$compile", () => {
17105
17095
  // <!-- ngRepeat: val in val0 -->
17106
17096
  // </div>
17107
17097
 
17108
- expect(element.scope().$id).toEqual($rootScope.$id);
17098
+ //expect(element.scope().$id).toEqual($rootScope.$id);
17109
17099
 
17110
17100
  // Now we create all the elements
17111
17101
  $rootScope.$apply("val0 = [1]; val1 = true; val2 = true");
@@ -17126,17 +17116,17 @@ describe("$compile", () => {
17126
17116
  // <!-- end ngIf: val2 -->
17127
17117
  // <!-- end ngRepeat: val in val0 -->
17128
17118
  // </div>
17129
- const ngIf1Scope = element.find("div").eq(0).scope();
17130
- const ngIf2Scope = element.find("div").eq(1).scope();
17131
- const ngRepeatScope = ngIf1Scope.$parent;
17119
+ // const ngIf1Scope = element.find("div").eq(0).scope();
17120
+ // const ngIf2Scope = element.find("div").eq(1).scope();
17121
+ // const ngRepeatScope = ngIf1Scope.$parent;
17132
17122
 
17133
- expect(ngIf1Scope.$id).not.toEqual(ngIf2Scope.$id);
17134
- expect(ngIf1Scope.$parent.$id).toEqual(ngRepeatScope.$id);
17135
- expect(ngIf2Scope.$parent.$id).toEqual(ngRepeatScope.$id);
17123
+ // expect(ngIf1Scope.$id).not.toEqual(ngIf2Scope.$id);
17124
+ // expect(ngIf1Scope.$parent.$id).toEqual(ngRepeatScope.$id);
17125
+ // expect(ngIf2Scope.$parent.$id).toEqual(ngRepeatScope.$id);
17136
17126
 
17137
- // What is happening here??
17138
- // We seem to have a repeater scope which doesn't actually match to any element
17139
- expect(ngRepeatScope.$parent.$id).toEqual($rootScope.$id);
17127
+ // // What is happening here??
17128
+ // // We seem to have a repeater scope which doesn't actually match to any element
17129
+ // expect(ngRepeatScope.$parent.$id).toEqual($rootScope.$id);
17140
17130
 
17141
17131
  // Now remove the first ngIf element from the first item in the repeater
17142
17132
  $rootScope.$apply("val1 = false");
@@ -17155,9 +17145,9 @@ describe("$compile", () => {
17155
17145
  // <!-- end ngRepeat: val in val0 -->
17156
17146
  // </div>
17157
17147
  //
17158
- expect(ngRepeatScope.$$destroyed).toEqual(false);
17159
- expect(ngIf1Scope.$$destroyed).toEqual(true);
17160
- expect(ngIf2Scope.$$destroyed).toEqual(false);
17148
+ // expect(ngRepeatScope.$$destroyed).toEqual(false);
17149
+ // expect(ngIf1Scope.$$destroyed).toEqual(true);
17150
+ // expect(ngIf2Scope.$$destroyed).toEqual(false);
17161
17151
 
17162
17152
  // Now remove the second ngIf element from the first item in the repeater
17163
17153
  $rootScope.$apply("val2 = false");
@@ -17171,17 +17161,18 @@ describe("$compile", () => {
17171
17161
  // <!-- end ngRepeat: val in val0 -->
17172
17162
  // </div>
17173
17163
 
17174
- expect(ngRepeatScope.$$destroyed).toEqual(false);
17175
- expect(ngIf1Scope.$$destroyed).toEqual(true);
17176
- expect(ngIf2Scope.$$destroyed).toEqual(true);
17164
+ // expect(ngRepeatScope.$$destroyed).toEqual(false);
17165
+ // expect(ngIf1Scope.$$destroyed).toEqual(true);
17166
+ // expect(ngIf2Scope.$$destroyed).toEqual(true);
17177
17167
 
17178
17168
  // Finally remove the repeat items
17179
17169
  $rootScope.$apply("val0 = []");
17180
17170
 
17181
17171
  // Somehow this ngRepeat scope knows how to destroy itself...
17182
- expect(ngRepeatScope.$$destroyed).toEqual(true);
17183
- expect(ngIf1Scope.$$destroyed).toEqual(true);
17184
- expect(ngIf2Scope.$$destroyed).toEqual(true);
17172
+ expect($rootScope.$$childHead).toBeNull();
17173
+ // expect(ngRepeatScope.$$destroyed).toEqual(true);
17174
+ // expect(ngIf1Scope.$$destroyed).toEqual(true);
17175
+ // expect(ngIf2Scope.$$destroyed).toEqual(true);
17185
17176
  });
17186
17177
 
17187
17178
  it("should throw error if unterminated", () => {
@@ -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();
@@ -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
  });