@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.
@@ -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;
@@ -1341,7 +1342,7 @@ describe("$compile", () => {
1341
1342
  expect(givenScope.$parent).toBe($rootScope);
1342
1343
  });
1343
1344
 
1344
- it("adds scope class and data for element with new scope", () => {
1345
+ it("adds new scope", () => {
1345
1346
  var givenScope;
1346
1347
  registerDirectives("myDirective", () => {
1347
1348
  return {
@@ -1354,7 +1355,7 @@ describe("$compile", () => {
1354
1355
  reloadModules();
1355
1356
  var el = $("<div my-directive></div>");
1356
1357
  $compile(el)($rootScope);
1357
- expect(el.data("$scope")).toBe(givenScope);
1358
+ expect($rootScope.$$childHead).toBe(givenScope);
1358
1359
  });
1359
1360
 
1360
1361
  it("creates an isolate scope when requested", () => {
@@ -1458,7 +1459,7 @@ describe("$compile", () => {
1458
1459
  }).toThrowError();
1459
1460
  });
1460
1461
 
1461
- it("adds isolate scope class and data for element with isolated scope", () => {
1462
+ it("adds isolated scope", () => {
1462
1463
  var givenScope;
1463
1464
  registerDirectives("myDirective", () => {
1464
1465
  return {
@@ -1471,7 +1472,7 @@ describe("$compile", () => {
1471
1472
  reloadModules();
1472
1473
  var el = $("<div my-directive></div>");
1473
1474
  $compile(el)($rootScope);
1474
- expect(el.isolateScope()).toBe(givenScope);
1475
+ expect($rootScope.$$childHead).toBe(givenScope);
1475
1476
  });
1476
1477
 
1477
1478
  it("allows observing attribute to the isolate scope", () => {
@@ -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
  });
@@ -6827,7 +6830,6 @@ describe("$compile", () => {
6827
6830
  return {
6828
6831
  pre(scope, element) {
6829
6832
  log.push(scope.$id);
6830
- expect(element.data("$scope")).toBe(scope);
6831
6833
  },
6832
6834
  };
6833
6835
  },
@@ -6839,7 +6841,6 @@ describe("$compile", () => {
6839
6841
  return function (scope, element) {
6840
6842
  iscope = scope;
6841
6843
  log.push(scope.$id);
6842
- expect(element.data("$isolateScopeNoTemplate")).toBe(scope);
6843
6844
  };
6844
6845
  },
6845
6846
  }));
@@ -6850,7 +6851,6 @@ describe("$compile", () => {
6850
6851
  compile() {
6851
6852
  return function (scope, element) {
6852
6853
  log.push(scope.$id);
6853
- expect(element.data("$scope")).toBe(scope);
6854
6854
  };
6855
6855
  },
6856
6856
  }));
@@ -6861,7 +6861,6 @@ describe("$compile", () => {
6861
6861
  compile() {
6862
6862
  return function (scope, element) {
6863
6863
  log.push(scope.$id);
6864
- expect(element.data("$scope")).toBe(scope);
6865
6864
  };
6866
6865
  },
6867
6866
  }));
@@ -6873,7 +6872,6 @@ describe("$compile", () => {
6873
6872
  compile() {
6874
6873
  return function (scope, element) {
6875
6874
  log.push(scope.$id);
6876
- expect(element.data("$scope")).toBe(scope);
6877
6875
  };
6878
6876
  },
6879
6877
  }));
@@ -6885,7 +6883,6 @@ describe("$compile", () => {
6885
6883
  return function (scope, element) {
6886
6884
  iscope = scope;
6887
6885
  log.push(scope.$id);
6888
- expect(element.data("$isolateScope")).toBe(scope);
6889
6886
  };
6890
6887
  },
6891
6888
  }));
@@ -6897,7 +6894,6 @@ describe("$compile", () => {
6897
6894
  return function (scope, element) {
6898
6895
  iscope = scope;
6899
6896
  log.push(scope.$id);
6900
- expect(element.data("$isolateScope")).toBe(scope);
6901
6897
  };
6902
6898
  },
6903
6899
  }));
@@ -6990,7 +6986,6 @@ describe("$compile", () => {
6990
6986
  $rootScope.name = "Jozo";
6991
6987
  $rootScope.$apply();
6992
6988
  expect(element.text().match(/Jozo/)).toBeTruthy();
6993
- expect(element.find("span").scope().$id).toBeDefined();
6994
6989
  });
6995
6990
 
6996
6991
  it("should allow creation of new scopes for replace directives with templates", () => {
@@ -7004,7 +6999,6 @@ describe("$compile", () => {
7004
6999
  $rootScope.name = "Jozo";
7005
7000
  $rootScope.$apply();
7006
7001
  expect(element.text().match(/Jozo/)).toBeTruthy();
7007
- expect(element.find("a").scope().$id).toBeDefined();
7008
7002
  });
7009
7003
 
7010
7004
  it("should allow creation of new scopes for replace directives with templates in a repeater", () => {
@@ -7017,8 +7011,6 @@ describe("$compile", () => {
7017
7011
  $rootScope.name = "Jozo";
7018
7012
  $rootScope.$apply();
7019
7013
  expect(element.text()).toBe("Jozo|Jozo|Jozo|");
7020
- expect(element.find("p").scope().$id).toBeDefined();
7021
- expect(element.find("a").scope().$id).toBeDefined();
7022
7014
  });
7023
7015
 
7024
7016
  it("should allow creation of new isolated scopes for directives with templates", () => {
@@ -7075,69 +7067,55 @@ describe("$compile", () => {
7075
7067
  });
7076
7068
 
7077
7069
  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
7070
  describe("with new scope directives", () => {
7086
7071
  it("should return the new scope at the directive element", () => {
7087
7072
  element = $compile("<div scope></div>")($rootScope);
7088
- expect(element.scope().$parent).toBe($rootScope);
7073
+ expect($rootScope.$$childHead.$parent).toBe($rootScope);
7089
7074
  });
7090
7075
 
7091
7076
  it("should return the new scope for children in the original template", () => {
7092
7077
  element = $compile("<div scope><a></a></div>")($rootScope);
7093
- expect(element.find("a").scope().$parent).toBe($rootScope);
7078
+ expect($rootScope.$$childHead.$parent).toBe($rootScope);
7094
7079
  });
7095
7080
 
7096
7081
  it("should return the new scope for children in the directive template", () => {
7097
7082
  $templateCache.put("tscope.html", "<a></a>");
7098
7083
  element = $compile("<div tscope></div>")($rootScope);
7099
7084
  $rootScope.$digest();
7100
- expect(element.find("a").scope().$parent).toBe($rootScope);
7085
+ expect($rootScope.$$childHead.$parent).toBe($rootScope);
7101
7086
  });
7102
7087
 
7103
7088
  it("should return the new scope for children in the directive sync template", () => {
7104
7089
  element = $compile("<div stscope></div>")($rootScope);
7105
- expect(element.find("span").scope().$parent).toBe($rootScope);
7090
+ expect($rootScope.$$childHead.$parent).toBe($rootScope);
7106
7091
  });
7107
7092
  });
7108
7093
 
7109
7094
  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
7095
  it("should return the non-isolate scope at the directive element", () => {
7096
+ expect($rootScope.$$childHead).toBeNull();
7116
7097
  let directiveElement;
7117
7098
  element = $compile("<div><div iscope></div></div>")($rootScope);
7118
7099
  directiveElement = element.children();
7119
- expect(directiveElement.scope()).toBe($rootScope);
7120
- expect(directiveElement.isolateScope().$parent).toBe($rootScope);
7100
+ expect($rootScope.$$childHead.$parent).toBe($rootScope);
7121
7101
  });
7122
7102
 
7123
7103
  it("should return the isolate scope for children in the original template", () => {
7124
7104
  element = $compile("<div iscope><a></a></div>")($rootScope);
7125
- expect(element.find("a").scope()).toBe($rootScope); // xx
7105
+ expect($rootScope.$$childHead.$parent).toBe($rootScope); // xx
7126
7106
  });
7127
7107
 
7128
7108
  it("should return the isolate scope for children in directive template", () => {
7129
7109
  $templateCache.put("tiscope.html", "<a></a>");
7130
7110
  element = $compile("<div tiscope></div>")($rootScope);
7131
- expect(element.isolateScope()).toBeUndefined(); // this is the current behavior, not desired feature
7111
+ expect($rootScope.$$childHead).toBeDefined(); // ??? this is the current behavior, not desired feature
7132
7112
  $rootScope.$digest();
7133
- expect(element.find("a").scope()).toBe(element.isolateScope());
7134
- expect(element.isolateScope()).not.toBe($rootScope);
7113
+ expect($rootScope.$$childHead).not.toBe($rootScope);
7135
7114
  });
7136
7115
 
7137
7116
  it("should return the isolate scope for children in directive sync template", () => {
7138
7117
  element = $compile("<div stiscope></div>")($rootScope);
7139
- expect(element.find("span").scope()).toBe(element.isolateScope());
7140
- expect(element.isolateScope()).not.toBe($rootScope);
7118
+ expect($rootScope.$$childHead).not.toBe($rootScope);
7141
7119
  });
7142
7120
 
7143
7121
  it('should handle "=" bindings with same method names in Object.prototype correctly when not present', () => {
@@ -7148,8 +7126,7 @@ describe("$compile", () => {
7148
7126
  };
7149
7127
 
7150
7128
  expect(func).not.toThrow();
7151
- const scope = element.isolateScope();
7152
- expect(element.find("span").scope()).toBe(scope);
7129
+ const scope = $rootScope.$$childHead;
7153
7130
  expect(scope).not.toBe($rootScope);
7154
7131
 
7155
7132
  // Not shadowed because optional
@@ -7171,8 +7148,7 @@ describe("$compile", () => {
7171
7148
  };
7172
7149
 
7173
7150
  expect(func).not.toThrow();
7174
- const scope = element.isolateScope();
7175
- expect(element.find("span").scope()).toBe(scope);
7151
+ const scope = $rootScope.$$childHead;
7176
7152
  expect(scope).not.toBe($rootScope);
7177
7153
  expect(scope.constructor).toBe("constructor");
7178
7154
  expect(scope.hasOwnProperty("constructor")).toBe(true);
@@ -7342,8 +7318,7 @@ describe("$compile", () => {
7342
7318
  };
7343
7319
 
7344
7320
  expect(func).not.toThrow();
7345
- const scope = element.isolateScope();
7346
- expect(element.find("span").scope()).toBe(scope);
7321
+ const scope = $rootScope.$$childHead;
7347
7322
  expect(scope).not.toBe($rootScope);
7348
7323
 
7349
7324
  // Does not shadow value because optional
@@ -7363,10 +7338,10 @@ describe("$compile", () => {
7363
7338
  };
7364
7339
 
7365
7340
  expect(func).not.toThrow();
7366
- expect(element.find("span").scope()).toBe(element.isolateScope());
7367
- expect(element.isolateScope()).not.toBe($rootScope);
7368
- expect(element.isolateScope().constructor).toBe("constructor");
7369
- expect(element.isolateScope().valueOf).toBe("valueOf");
7341
+ const scope = $rootScope.$$childHead;
7342
+ expect(scope).not.toBe($rootScope);
7343
+ expect(scope.constructor).toBe("constructor");
7344
+ expect(scope.valueOf).toBe("valueOf");
7370
7345
  });
7371
7346
 
7372
7347
  it('should handle "&" bindings with same method names in Object.prototype correctly when not present', () => {
@@ -7377,12 +7352,10 @@ describe("$compile", () => {
7377
7352
  };
7378
7353
 
7379
7354
  expect(func).not.toThrow();
7380
- expect(element.find("span").scope()).toBe(element.isolateScope());
7381
- expect(element.isolateScope()).not.toBe($rootScope);
7382
- expect(element.isolateScope().constructor).toBe(
7383
- $rootScope.constructor,
7384
- );
7385
- expect(element.isolateScope().valueOf()).toBeUndefined();
7355
+ const scope = $rootScope.$$childHead;
7356
+ expect(scope).not.toBe($rootScope);
7357
+ expect(scope.constructor).toBe($rootScope.constructor);
7358
+ expect(scope.valueOf()).toBeUndefined();
7386
7359
  });
7387
7360
 
7388
7361
  it('should handle "&" bindings with same method names in Object.prototype correctly when present', () => {
@@ -7399,10 +7372,10 @@ describe("$compile", () => {
7399
7372
  };
7400
7373
 
7401
7374
  expect(func).not.toThrow();
7402
- expect(element.find("span").scope()).toBe(element.isolateScope());
7403
- expect(element.isolateScope()).not.toBe($rootScope);
7404
- expect(element.isolateScope().constructor()).toBe("constructor");
7405
- expect(element.isolateScope().valueOf()).toBe("valueOf");
7375
+ const scope = $rootScope.$$childHead;
7376
+ expect(scope).not.toBe($rootScope);
7377
+ expect(scope.constructor()).toBe("constructor");
7378
+ expect(scope.valueOf()).toBe("valueOf");
7406
7379
  });
7407
7380
 
7408
7381
  it("should handle @ bindings on BOOLEAN attributes", () => {
@@ -8892,7 +8865,7 @@ describe("$compile", () => {
8892
8865
  }),
8893
8866
  });
8894
8867
 
8895
- element.isolateScope().$ctrl.prop1 = 2;
8868
+ $rootScope.$$childHead.$ctrl.prop1 = 2;
8896
8869
  $rootScope.$apply("val = 2");
8897
8870
  expect(log.pop()).toEqual({
8898
8871
  prop1: jasmine.objectContaining({
@@ -9656,7 +9629,7 @@ describe("$compile", () => {
9656
9629
  element = $compile('<div my-component reference="num"></div>')(
9657
9630
  $rootScope,
9658
9631
  );
9659
- const isolateScope = element.isolateScope();
9632
+ const isolateScope = $rootScope.$$childHead;
9660
9633
  expect(isolateScope.reference).toBeNaN();
9661
9634
 
9662
9635
  isolateScope.$apply((scope) => {
@@ -9670,7 +9643,7 @@ describe("$compile", () => {
9670
9643
  element = $compile('<div my-component reference="num"></div>')(
9671
9644
  $rootScope,
9672
9645
  );
9673
- const isolateScope = element.isolateScope();
9646
+ const isolateScope = $rootScope.$$childHead;
9674
9647
  expect(isolateScope.reference).toBeNaN();
9675
9648
 
9676
9649
  $rootScope.$apply((scope) => {
@@ -9706,7 +9679,7 @@ describe("$compile", () => {
9706
9679
  'to-string="value = !value"></div>',
9707
9680
  )($rootScope);
9708
9681
  }).not.toThrow();
9709
- const isolateScope = element.isolateScope();
9682
+ const isolateScope = $rootScope.$$childHead;
9710
9683
 
9711
9684
  expect(typeof isolateScope.constructor).toBe("string");
9712
9685
  expect(isArray(isolateScope.watch)).toBe(true);
@@ -9739,13 +9712,13 @@ describe("$compile", () => {
9739
9712
 
9740
9713
  it("should not initialize scope value if optional expression binding is not passed", () => {
9741
9714
  element = $compile("<div my-component></div>")($rootScope);
9742
- const isolateScope = element.isolateScope();
9715
+ const isolateScope = $rootScope.$$childHead;
9743
9716
  expect(isolateScope.optExpr).toBeUndefined();
9744
9717
  });
9745
9718
 
9746
9719
  it("should not initialize scope value if optional expression binding with Object.prototype name is not passed", () => {
9747
9720
  element = $compile("<div my-component></div>")($rootScope);
9748
- const isolateScope = element.isolateScope();
9721
+ const isolateScope = $rootScope.$$childHead;
9749
9722
  expect(isolateScope.constructor).toBe($rootScope.constructor);
9750
9723
  });
9751
9724
 
@@ -9753,7 +9726,7 @@ describe("$compile", () => {
9753
9726
  element = $compile(
9754
9727
  "<div my-component opt-expr=\"value = 'did!'\"></div>",
9755
9728
  )($rootScope);
9756
- const isolateScope = element.isolateScope();
9729
+ const isolateScope = $rootScope.$$childHead;
9757
9730
  expect(typeof isolateScope.optExpr).toBe("function");
9758
9731
  expect(isolateScope.optExpr()).toBe("did!");
9759
9732
  expect($rootScope.value).toBe("did!");
@@ -9763,7 +9736,7 @@ describe("$compile", () => {
9763
9736
  element = $compile(
9764
9737
  "<div my-component constructor=\"value = 'did!'\"></div>",
9765
9738
  )($rootScope);
9766
- const isolateScope = element.isolateScope();
9739
+ const isolateScope = $rootScope.$$childHead;
9767
9740
  expect(typeof isolateScope.constructor).toBe("function");
9768
9741
  expect(isolateScope.constructor()).toBe("did!");
9769
9742
  expect($rootScope.value).toBe("did!");
@@ -9791,7 +9764,7 @@ describe("$compile", () => {
9791
9764
  });
9792
9765
 
9793
9766
  element = $compile("<div test-dir></div>")($rootScope);
9794
- const scope = element.isolateScope();
9767
+ const scope = $rootScope.$$childHead;
9795
9768
  expect(scope.ctrl.getProp()).toBe("default");
9796
9769
 
9797
9770
  $rootScope.$digest();
@@ -9820,7 +9793,7 @@ describe("$compile", () => {
9820
9793
  });
9821
9794
 
9822
9795
  element = $compile("<div test-dir></div>")($rootScope);
9823
- const scope = element.isolateScope();
9796
+ const scope = $rootScope.$$childHead;
9824
9797
  expect(scope.ctrl.getProp()).toBe("default");
9825
9798
  $rootScope.$digest();
9826
9799
  expect(scope.ctrl.getProp()).toBe("default");
@@ -10696,7 +10669,7 @@ describe("$compile", () => {
10696
10669
  $rootScope,
10697
10670
  );
10698
10671
 
10699
- const isolateScope = element.isolateScope();
10672
+ const isolateScope = $rootScope.$$childHead;
10700
10673
  expect(isolateScope.owRef).toBeNaN();
10701
10674
 
10702
10675
  $rootScope.num = 64;
@@ -11877,7 +11850,7 @@ describe("$compile", () => {
11877
11850
  element = $compile("<div foo-dir>")($rootScope);
11878
11851
  $rootScope.$digest();
11879
11852
  expect(controllerCalled).toBe(true);
11880
- const childScope = element.children().scope();
11853
+ const childScope = $rootScope.$$childHead;
11881
11854
  expect(childScope).not.toBe($rootScope);
11882
11855
  expect(childScope.theCtrl).toBe(myCtrl);
11883
11856
  });
@@ -11935,7 +11908,7 @@ describe("$compile", () => {
11935
11908
  )($rootScope);
11936
11909
  $rootScope.$digest();
11937
11910
  expect(controllerCalled).toBe(true);
11938
- const childScope = element.children().scope();
11911
+ const childScope = $rootScope.$$childHead;
11939
11912
  expect(childScope).not.toBe($rootScope);
11940
11913
  expect(childScope.theCtrl).not.toBe(myCtrl);
11941
11914
  expect(childScope.theCtrl.constructor).toBe(MyCtrl);
@@ -11995,7 +11968,7 @@ describe("$compile", () => {
11995
11968
  )($rootScope);
11996
11969
  $rootScope.$digest();
11997
11970
  expect(controllerCalled).toBe(true);
11998
- const childScope = element.children().scope();
11971
+ const childScope = $rootScope.$$childHead;
11999
11972
  expect(childScope).not.toBe($rootScope);
12000
11973
  expect(childScope.theCtrl).not.toBe(myCtrl);
12001
11974
  expect(childScope.theCtrl.constructor).toBe(MyCtrl);
@@ -12026,7 +11999,7 @@ describe("$compile", () => {
12026
11999
  );
12027
12000
  initInjector("test1");
12028
12001
  element = $compile("<div test-dir></div>")($rootScope);
12029
- const scope = element.scope();
12002
+ const scope = $rootScope.$$childHead;
12030
12003
  expect(scope.ctrl.getProp()).toBe("default");
12031
12004
 
12032
12005
  $rootScope.$digest();
@@ -12056,7 +12029,7 @@ describe("$compile", () => {
12056
12029
  );
12057
12030
  initInjector("test1");
12058
12031
  element = $compile("<div test-dir></div>")($rootScope);
12059
- const scope = element.isolateScope();
12032
+ const scope = $rootScope.$$childHead;
12060
12033
  expect(scope.ctrl.getProp()).toBe("default");
12061
12034
 
12062
12035
  $rootScope.$digest();
@@ -12647,7 +12620,7 @@ describe("$compile", () => {
12647
12620
 
12648
12621
  element = element.children().eq(0);
12649
12622
  expect(element[0].checked).toBe(false);
12650
- element.isolateScope().model = true;
12623
+ $rootScope.$$childHead.model = true;
12651
12624
  $rootScope.$digest();
12652
12625
  expect(element[0].checked).toBe(true);
12653
12626
  });
@@ -13541,19 +13514,19 @@ describe("$compile", () => {
13541
13514
  element = $compile(
13542
13515
  '<div><div ng-repeat="x in xs" ng-if="x==1">{{x}}</div></div>',
13543
13516
  )($rootScope);
13544
- expect(CACHE.size).toEqual(cacheSize + 1);
13517
+ expect(CACHE.size).toEqual(cacheSize);
13545
13518
 
13546
13519
  $rootScope.$apply("xs = [0,1]");
13547
- expect(CACHE.size).toEqual(cacheSize + 2);
13520
+ expect(CACHE.size).toEqual(cacheSize);
13548
13521
 
13549
13522
  $rootScope.$apply("xs = [0]");
13550
- expect(CACHE.size).toEqual(cacheSize + 1);
13523
+ expect(CACHE.size).toEqual(cacheSize);
13551
13524
 
13552
13525
  $rootScope.$apply("xs = []");
13553
- expect(CACHE.size).toEqual(cacheSize + 1);
13526
+ expect(CACHE.size).toEqual(cacheSize);
13554
13527
 
13555
13528
  element.remove();
13556
- expect(CACHE.size).toEqual(cacheSize + 0);
13529
+ expect(CACHE.size).toEqual(cacheSize);
13557
13530
  });
13558
13531
 
13559
13532
  it('should not leak if two "element" transclusions are on the same element', () => {
@@ -13565,20 +13538,20 @@ describe("$compile", () => {
13565
13538
  $rootScope.$apply("xs = [0,1]");
13566
13539
  // At this point we have a bunch of comment placeholders but no real transcluded elements
13567
13540
  // So the cache only contains the root element's data
13568
- expect(CACHE.size).toEqual(cacheSize + 1);
13541
+ expect(CACHE.size).toEqual(cacheSize);
13569
13542
 
13570
13543
  $rootScope.$apply("val = true");
13571
13544
  // Now we have two concrete transcluded elements plus some comments so two more cache items
13572
- expect(CACHE.size).toEqual(cacheSize + 3);
13545
+ expect(CACHE.size).toEqual(cacheSize);
13573
13546
 
13574
13547
  $rootScope.$apply("val = false");
13575
13548
  // Once again we only have comments so no transcluded elements and the cache is back to just
13576
13549
  // the root element
13577
- expect(CACHE.size).toEqual(cacheSize + 1);
13550
+ expect(CACHE.size).toEqual(cacheSize);
13578
13551
 
13579
13552
  element.remove();
13580
13553
  // Now we've even removed the root element along with its cache
13581
- expect(CACHE.size).toEqual(cacheSize + 0);
13554
+ expect(CACHE.size).toEqual(cacheSize);
13582
13555
  });
13583
13556
 
13584
13557
  // it("should not leak when continuing the compilation of elements on a scope that was destroyed", () => {
@@ -13647,7 +13620,6 @@ describe("$compile", () => {
13647
13620
  $rootScope.$apply(`xs = [${xs}]`);
13648
13621
  firstRepeatedElem = element.children(".ng-scope").eq(0);
13649
13622
 
13650
- expect(firstRepeatedElem.data("$scope")).toBeDefined();
13651
13623
  privateData = CACHE.get(firstRepeatedElem[0][EXPANDO]);
13652
13624
  expect(privateData.events).toBeDefined();
13653
13625
 
@@ -17026,40 +16998,39 @@ describe("$compile", () => {
17026
16998
  "</div>",
17027
16999
  )($rootScope);
17028
17000
  $rootScope.$apply("val0 = true; val1 = true; val2 = true");
17029
-
17001
+ expect($rootScope.$$childHead).toBeTruthy();
17002
+ expect($rootScope.$$childHead.$$childHead).toBeTruthy();
17030
17003
  // At this point we should have something like:
17031
17004
  //
17032
17005
  // <div>
17033
17006
  //
17034
- // <!-- ngIf: val0 -->
17035
- //
17007
+ // <!---->
17036
17008
  // <div ng-if-start="val0">
17037
- // <!-- ngIf: val1 -->
17009
+ // <!---->
17038
17010
  // <span ng-if="val1"></span>
17039
- // <!-- end ngIf: val1 -->
17011
+ // <!---->
17040
17012
  // </div>
17041
17013
  //
17042
17014
  // <div ng-if-end="">
17043
- // <!-- ngIf: val2 -->
17015
+ // <!---->
17044
17016
  // <span ng-if="val2"></span>
17045
- // <!-- end ngIf: val2 -->
17017
+ // <!---->
17046
17018
  // </div>
17047
17019
  //
17048
- // <!-- end ngIf: val0 -->
17020
+ // <!---->
17049
17021
  // </div>
17050
- const ngIfStartScope = element.find("div").eq(0).scope();
17051
- const ngIfEndScope = element.find("div").eq(1).scope();
17022
+ // const ngIfStartScope = element.find("div").eq(0).scope();
17023
+ // const ngIfEndScope = element.find("div").eq(1).scope();
17052
17024
 
17053
- expect(ngIfStartScope.$id).toEqual(ngIfEndScope.$id);
17025
+ // expect(ngIfStartScope.$id).toEqual(ngIfEndScope.$id);
17054
17026
 
17055
- const ngIf1Scope = element.find("span").eq(0).scope();
17056
- const ngIf2Scope = element.find("span").eq(1).scope();
17027
+ // const ngIf1Scope = element.find("span").eq(0).scope();
17028
+ // const ngIf2Scope = element.find("span").eq(1).scope();
17057
17029
 
17058
- expect(ngIf1Scope.$id).not.toEqual(ngIf2Scope.$id);
17059
- expect(ngIf1Scope.$parent.$id).toEqual(ngIf2Scope.$parent.$id);
17030
+ // expect(ngIf1Scope.$id).not.toEqual(ngIf2Scope.$id);
17031
+ // expect(ngIf1Scope.$parent.$id).toEqual(ngIf2Scope.$parent.$id);
17060
17032
 
17061
17033
  $rootScope.$apply("val1 = false");
17062
-
17063
17034
  // Now we should have something like:
17064
17035
  //
17065
17036
  // <div>
@@ -17075,9 +17046,9 @@ describe("$compile", () => {
17075
17046
  // <!-- end ngIf: val0 -->
17076
17047
  // </div>
17077
17048
 
17078
- expect(ngIfStartScope.$$destroyed).not.toEqual(true);
17079
- expect(ngIf1Scope.$$destroyed).toEqual(true);
17080
- expect(ngIf2Scope.$$destroyed).not.toEqual(true);
17049
+ // expect(ngIfStartScope.$$destroyed).not.toEqual(true);
17050
+ // expect(ngIf1Scope.$$destroyed).toEqual(true);
17051
+ // expect(ngIf2Scope.$$destroyed).not.toEqual(true);
17081
17052
 
17082
17053
  $rootScope.$apply("val0 = false");
17083
17054
 
@@ -17086,10 +17057,11 @@ describe("$compile", () => {
17086
17057
  // <div>
17087
17058
  // <!-- ngIf: val0 -->
17088
17059
  // </div>
17089
-
17090
- expect(ngIfStartScope.$$destroyed).toEqual(true);
17091
- expect(ngIf1Scope.$$destroyed).toEqual(true);
17092
- expect(ngIf2Scope.$$destroyed).toEqual(true);
17060
+ // TODO: Until we figure out a better way of testing this
17061
+ expect($rootScope.$$childHead).toBeNull();
17062
+ // expect(ngIfStartScope.$$destroyed).toEqual(true);
17063
+ // expect(ngIf1Scope.$$destroyed).toEqual(true);
17064
+ // expect(ngIf2Scope.$$destroyed).toEqual(true);
17093
17065
  });
17094
17066
 
17095
17067
  it("should set up and destroy the transclusion scopes correctly", () => {
@@ -17105,7 +17077,7 @@ describe("$compile", () => {
17105
17077
  // <!-- ngRepeat: val in val0 -->
17106
17078
  // </div>
17107
17079
 
17108
- expect(element.scope().$id).toEqual($rootScope.$id);
17080
+ //expect(element.scope().$id).toEqual($rootScope.$id);
17109
17081
 
17110
17082
  // Now we create all the elements
17111
17083
  $rootScope.$apply("val0 = [1]; val1 = true; val2 = true");
@@ -17126,17 +17098,17 @@ describe("$compile", () => {
17126
17098
  // <!-- end ngIf: val2 -->
17127
17099
  // <!-- end ngRepeat: val in val0 -->
17128
17100
  // </div>
17129
- const ngIf1Scope = element.find("div").eq(0).scope();
17130
- const ngIf2Scope = element.find("div").eq(1).scope();
17131
- const ngRepeatScope = ngIf1Scope.$parent;
17101
+ // const ngIf1Scope = element.find("div").eq(0).scope();
17102
+ // const ngIf2Scope = element.find("div").eq(1).scope();
17103
+ // const ngRepeatScope = ngIf1Scope.$parent;
17132
17104
 
17133
- expect(ngIf1Scope.$id).not.toEqual(ngIf2Scope.$id);
17134
- expect(ngIf1Scope.$parent.$id).toEqual(ngRepeatScope.$id);
17135
- expect(ngIf2Scope.$parent.$id).toEqual(ngRepeatScope.$id);
17105
+ // expect(ngIf1Scope.$id).not.toEqual(ngIf2Scope.$id);
17106
+ // expect(ngIf1Scope.$parent.$id).toEqual(ngRepeatScope.$id);
17107
+ // expect(ngIf2Scope.$parent.$id).toEqual(ngRepeatScope.$id);
17136
17108
 
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);
17109
+ // // What is happening here??
17110
+ // // We seem to have a repeater scope which doesn't actually match to any element
17111
+ // expect(ngRepeatScope.$parent.$id).toEqual($rootScope.$id);
17140
17112
 
17141
17113
  // Now remove the first ngIf element from the first item in the repeater
17142
17114
  $rootScope.$apply("val1 = false");
@@ -17155,9 +17127,9 @@ describe("$compile", () => {
17155
17127
  // <!-- end ngRepeat: val in val0 -->
17156
17128
  // </div>
17157
17129
  //
17158
- expect(ngRepeatScope.$$destroyed).toEqual(false);
17159
- expect(ngIf1Scope.$$destroyed).toEqual(true);
17160
- expect(ngIf2Scope.$$destroyed).toEqual(false);
17130
+ // expect(ngRepeatScope.$$destroyed).toEqual(false);
17131
+ // expect(ngIf1Scope.$$destroyed).toEqual(true);
17132
+ // expect(ngIf2Scope.$$destroyed).toEqual(false);
17161
17133
 
17162
17134
  // Now remove the second ngIf element from the first item in the repeater
17163
17135
  $rootScope.$apply("val2 = false");
@@ -17171,17 +17143,18 @@ describe("$compile", () => {
17171
17143
  // <!-- end ngRepeat: val in val0 -->
17172
17144
  // </div>
17173
17145
 
17174
- expect(ngRepeatScope.$$destroyed).toEqual(false);
17175
- expect(ngIf1Scope.$$destroyed).toEqual(true);
17176
- expect(ngIf2Scope.$$destroyed).toEqual(true);
17146
+ // expect(ngRepeatScope.$$destroyed).toEqual(false);
17147
+ // expect(ngIf1Scope.$$destroyed).toEqual(true);
17148
+ // expect(ngIf2Scope.$$destroyed).toEqual(true);
17177
17149
 
17178
17150
  // Finally remove the repeat items
17179
17151
  $rootScope.$apply("val0 = []");
17180
17152
 
17181
17153
  // 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);
17154
+ expect($rootScope.$$childHead).toBeNull();
17155
+ // expect(ngRepeatScope.$$destroyed).toEqual(true);
17156
+ // expect(ngIf1Scope.$$destroyed).toEqual(true);
17157
+ // expect(ngIf2Scope.$$destroyed).toEqual(true);
17185
17158
  });
17186
17159
 
17187
17160
  it("should throw error if unterminated", () => {