@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
|
@@ -741,6 +741,7 @@ describe("$compile", () => {
|
|
|
741
741
|
// According to spec SVG element className property is readonly, but only FF
|
|
742
742
|
// implements it this way which causes compile exceptions.
|
|
743
743
|
element = $compile("<svg><text>{{1}}</text></svg>")($rootScope);
|
|
744
|
+
$rootScope.$digest();
|
|
744
745
|
expect(element.text()).toEqual("1");
|
|
745
746
|
});
|
|
746
747
|
|
|
@@ -1011,6 +1012,8 @@ describe("$compile", () => {
|
|
|
1011
1012
|
gotValue = value;
|
|
1012
1013
|
});
|
|
1013
1014
|
|
|
1015
|
+
$rootScope.$digest();
|
|
1016
|
+
|
|
1014
1017
|
expect(gotValue).toEqual("42");
|
|
1015
1018
|
},
|
|
1016
1019
|
);
|
|
@@ -1052,6 +1055,7 @@ describe("$compile", () => {
|
|
|
1052
1055
|
"<my-directive></my-directive>",
|
|
1053
1056
|
function (element, attrs) {
|
|
1054
1057
|
attrs.$addClass("some-class");
|
|
1058
|
+
$rootScope.$digest();
|
|
1055
1059
|
expect(element[0].classList.contains("some-class")).toBe(true);
|
|
1056
1060
|
},
|
|
1057
1061
|
);
|
|
@@ -1063,6 +1067,7 @@ describe("$compile", () => {
|
|
|
1063
1067
|
'<my-directive class="some-class"></my-directive>',
|
|
1064
1068
|
function (element, attrs) {
|
|
1065
1069
|
attrs.$removeClass("some-class");
|
|
1070
|
+
$rootScope.$digest();
|
|
1066
1071
|
expect(element[0].classList.contains("some-class")).toBe(false);
|
|
1067
1072
|
},
|
|
1068
1073
|
);
|
|
@@ -1074,6 +1079,7 @@ describe("$compile", () => {
|
|
|
1074
1079
|
'<my-directive class="one three four"></my-directive>',
|
|
1075
1080
|
function (element, attrs) {
|
|
1076
1081
|
attrs.$updateClass("one two three", "one three four");
|
|
1082
|
+
$rootScope.$digest();
|
|
1077
1083
|
expect(element[0].classList.contains("one")).toBe(true);
|
|
1078
1084
|
expect(element[0].classList.contains("two")).toBe(true);
|
|
1079
1085
|
expect(element[0].classList.contains("three")).toBe(true);
|
|
@@ -1590,6 +1596,7 @@ describe("$compile", () => {
|
|
|
1590
1596
|
$compile(el)($rootScope);
|
|
1591
1597
|
|
|
1592
1598
|
$rootScope.parentAttr = 41;
|
|
1599
|
+
$rootScope.$digest();
|
|
1593
1600
|
expect(givenScope.myAttr).toBe(42);
|
|
1594
1601
|
});
|
|
1595
1602
|
|
|
@@ -1666,6 +1673,7 @@ describe("$compile", () => {
|
|
|
1666
1673
|
$compile(el)($rootScope);
|
|
1667
1674
|
|
|
1668
1675
|
$rootScope.parentAttr = 41;
|
|
1676
|
+
$rootScope.$digest();
|
|
1669
1677
|
expect(givenScope.myAttr).toBe(42);
|
|
1670
1678
|
});
|
|
1671
1679
|
|
|
@@ -1701,6 +1709,7 @@ describe("$compile", () => {
|
|
|
1701
1709
|
$compile(el)($rootScope);
|
|
1702
1710
|
|
|
1703
1711
|
isolateScope.myAttr = 42;
|
|
1712
|
+
$rootScope.$digest();
|
|
1704
1713
|
expect($rootScope.parentAttr).toBe(42);
|
|
1705
1714
|
});
|
|
1706
1715
|
|
|
@@ -1722,6 +1731,7 @@ describe("$compile", () => {
|
|
|
1722
1731
|
|
|
1723
1732
|
$rootScope.parentAttr = 42;
|
|
1724
1733
|
isolateScope.myAttr = 43;
|
|
1734
|
+
$rootScope.$digest();
|
|
1725
1735
|
expect($rootScope.parentAttr).toBe(42);
|
|
1726
1736
|
expect(isolateScope.myAttr).toBe(42);
|
|
1727
1737
|
});
|
|
@@ -1744,7 +1754,9 @@ describe("$compile", () => {
|
|
|
1744
1754
|
};
|
|
1745
1755
|
var el = $('<div my-directive my-attr="parentFunction()"></div>');
|
|
1746
1756
|
$compile(el)($rootScope);
|
|
1747
|
-
expect(() => {
|
|
1757
|
+
expect(() => {
|
|
1758
|
+
$rootScope.$digest();
|
|
1759
|
+
}).toThrowError();
|
|
1748
1760
|
});
|
|
1749
1761
|
|
|
1750
1762
|
it("can watch two-way bindings as collections", () => {
|
|
@@ -1765,6 +1777,7 @@ describe("$compile", () => {
|
|
|
1765
1777
|
};
|
|
1766
1778
|
var el = $('<div my-directive my-attr="parentFunction()"></div>');
|
|
1767
1779
|
$compile(el)($rootScope);
|
|
1780
|
+
$rootScope.$digest();
|
|
1768
1781
|
expect(givenScope.myAttr).toEqual([1, 2, 3]);
|
|
1769
1782
|
});
|
|
1770
1783
|
|
|
@@ -2027,6 +2040,8 @@ describe("$compile", () => {
|
|
|
2027
2040
|
var el = $('<div my-directive="abc"></div>');
|
|
2028
2041
|
|
|
2029
2042
|
$compile(el)($rootScope);
|
|
2043
|
+
$rootScope.$digest();
|
|
2044
|
+
|
|
2030
2045
|
expect(ctl.myAttr).toEqual("abc");
|
|
2031
2046
|
});
|
|
2032
2047
|
|
|
@@ -4741,6 +4756,8 @@ describe("$compile", () => {
|
|
|
4741
4756
|
$compile("<fff></fff>")($rootScope);
|
|
4742
4757
|
$compile("<ffff></ffff>")($rootScope);
|
|
4743
4758
|
$compile("<fffff></fffff>")($rootScope);
|
|
4759
|
+
$rootScope.$digest();
|
|
4760
|
+
|
|
4744
4761
|
expect(log.join("; ")).toEqual(
|
|
4745
4762
|
"ff template: true; " +
|
|
4746
4763
|
"ff compile: true; " +
|
|
@@ -4950,6 +4967,7 @@ describe("$compile", () => {
|
|
|
4950
4967
|
$rootScope.name = "Lucas";
|
|
4951
4968
|
$rootScope.color = "blue";
|
|
4952
4969
|
$compile(element[0].childNodes)($rootScope);
|
|
4970
|
+
$rootScope.$digest();
|
|
4953
4971
|
expect(element.text()).toEqual("Name: Lucas\nColor: blue");
|
|
4954
4972
|
});
|
|
4955
4973
|
|
|
@@ -5022,6 +5040,7 @@ describe("$compile", () => {
|
|
|
5022
5040
|
);
|
|
5023
5041
|
|
|
5024
5042
|
$compile(element[0].childNodes)($rootScope);
|
|
5043
|
+
$rootScope.$digest();
|
|
5025
5044
|
document.body.appendChild(element[0]);
|
|
5026
5045
|
expect(element.find("span").text()).toContain("Should render");
|
|
5027
5046
|
});
|
|
@@ -5056,6 +5075,7 @@ describe("$compile", () => {
|
|
|
5056
5075
|
'<div><div ng-repeat="i in [1,2]"><div after>A</div></div></div>',
|
|
5057
5076
|
);
|
|
5058
5077
|
$compile(element)($rootScope);
|
|
5078
|
+
$rootScope.$digest();
|
|
5059
5079
|
expect(element.text()).toBe("ABAB");
|
|
5060
5080
|
});
|
|
5061
5081
|
|
|
@@ -5072,6 +5092,7 @@ describe("$compile", () => {
|
|
|
5072
5092
|
element = JQLite("<div><div remove-node></div><div>{{test}}</div></div>");
|
|
5073
5093
|
$rootScope.test = "Hello";
|
|
5074
5094
|
$compile(element)($rootScope);
|
|
5095
|
+
$rootScope.$digest();
|
|
5075
5096
|
expect(element.children().length).toBe(1);
|
|
5076
5097
|
expect(element.text()).toBe("Hello");
|
|
5077
5098
|
});
|
|
@@ -5347,12 +5368,14 @@ describe("$compile", () => {
|
|
|
5347
5368
|
it("should compile template when replacing", () => {
|
|
5348
5369
|
reloadModules();
|
|
5349
5370
|
element = $compile("<div><div replace>ignore</div><div>")($rootScope);
|
|
5371
|
+
$rootScope.$digest();
|
|
5350
5372
|
expect(element.text()).toEqual("Replace!");
|
|
5351
5373
|
});
|
|
5352
5374
|
|
|
5353
5375
|
it("should compile template when appending", () => {
|
|
5354
5376
|
reloadModules();
|
|
5355
5377
|
element = $compile("<div><div append>ignore</div><div>")($rootScope);
|
|
5378
|
+
$rootScope.$digest();
|
|
5356
5379
|
expect(element.text()).toEqual("Append!");
|
|
5357
5380
|
});
|
|
5358
5381
|
|
|
@@ -5417,6 +5440,7 @@ describe("$compile", () => {
|
|
|
5417
5440
|
element = $compile(
|
|
5418
5441
|
"<div>" + '<div ng-repeat="i in [1,2]" replace></div>' + "</div>",
|
|
5419
5442
|
)($rootScope);
|
|
5443
|
+
$rootScope.$digest();
|
|
5420
5444
|
expect(element.text()).toEqual("Replace!Replace!");
|
|
5421
5445
|
});
|
|
5422
5446
|
|
|
@@ -5425,6 +5449,7 @@ describe("$compile", () => {
|
|
|
5425
5449
|
element = $compile(
|
|
5426
5450
|
"<div>" + '<div ng-repeat="i in [1,2]" append></div>' + "</div>",
|
|
5427
5451
|
)($rootScope);
|
|
5452
|
+
$rootScope.$digest();
|
|
5428
5453
|
expect(element.text()).toEqual("Append!Append!");
|
|
5429
5454
|
});
|
|
5430
5455
|
|
|
@@ -5433,6 +5458,7 @@ describe("$compile", () => {
|
|
|
5433
5458
|
element = $compile("<div replace-with-interpolated-class></div>")(
|
|
5434
5459
|
$rootScope,
|
|
5435
5460
|
);
|
|
5461
|
+
$rootScope.$digest();
|
|
5436
5462
|
expect(element[0].classList.contains("class_2")).toBeTrue();
|
|
5437
5463
|
});
|
|
5438
5464
|
|
|
@@ -5479,6 +5505,7 @@ describe("$compile", () => {
|
|
|
5479
5505
|
element = $compile('<div>{{log("A")}} foo {{::log("B")}}</div>')(
|
|
5480
5506
|
$rootScope,
|
|
5481
5507
|
);
|
|
5508
|
+
$rootScope.$digest();
|
|
5482
5509
|
expect(log.join("; ")).toEqual("A; B; A; B");
|
|
5483
5510
|
});
|
|
5484
5511
|
|
|
@@ -5633,6 +5660,7 @@ describe("$compile", () => {
|
|
|
5633
5660
|
'<svg><g svg-anchor="/foo/bar" text="foo/bar!"></g></svg>',
|
|
5634
5661
|
)($rootScope);
|
|
5635
5662
|
const child = element.children().eq(0);
|
|
5663
|
+
$rootScope.$digest();
|
|
5636
5664
|
expect(getNodeName(child)).toMatch(/a/i);
|
|
5637
5665
|
expect(isSVGElement(child[0])).toBe(true);
|
|
5638
5666
|
expect(child[0].href.baseVal).toBe("/foo/bar");
|
|
@@ -5660,6 +5688,7 @@ describe("$compile", () => {
|
|
|
5660
5688
|
element = $compile('<math><mn pow="2"><mn>8</mn></mn></math>')(
|
|
5661
5689
|
$rootScope,
|
|
5662
5690
|
);
|
|
5691
|
+
$rootScope.$digest();
|
|
5663
5692
|
const child = element.children().eq(0);
|
|
5664
5693
|
expect(getNodeName(child)).toMatch(/msup/i);
|
|
5665
5694
|
expect(isUnknownElement(child[0])).toBe(false);
|
|
@@ -5686,6 +5715,7 @@ describe("$compile", () => {
|
|
|
5686
5715
|
element = $compile(
|
|
5687
5716
|
"<template-url-with-prototype><template-url-with-prototype>",
|
|
5688
5717
|
)($rootScope);
|
|
5718
|
+
$rootScope.$digest();
|
|
5689
5719
|
expect(element.find("p")[0].innerHTML).toEqual("Test Value");
|
|
5690
5720
|
});
|
|
5691
5721
|
});
|
|
@@ -5919,6 +5949,7 @@ describe("$compile", () => {
|
|
|
5919
5949
|
expect(element[0].outerHTML).toEqual(
|
|
5920
5950
|
'<div cross-domain-template=""></div>',
|
|
5921
5951
|
);
|
|
5952
|
+
$rootScope.$digest();
|
|
5922
5953
|
expect(element[0].outerHTML).toEqual(
|
|
5923
5954
|
'<div cross-domain-template=""><span>example.com/cached-version</span></div>',
|
|
5924
5955
|
);
|
|
@@ -5927,6 +5958,7 @@ describe("$compile", () => {
|
|
|
5927
5958
|
it("should load cross domain templates when trusted", (done) => {
|
|
5928
5959
|
element = $compile("<div trusted-template></div>")($rootScope);
|
|
5929
5960
|
expect(element[0].outerHTML).toEqual('<div trusted-template=""></div>');
|
|
5961
|
+
$rootScope.$digest();
|
|
5930
5962
|
setTimeout(() => {
|
|
5931
5963
|
expect(element[0].outerHTML).toEqual(
|
|
5932
5964
|
'<div trusted-template="">Hello</div>',
|
|
@@ -5944,6 +5976,8 @@ describe("$compile", () => {
|
|
|
5944
5976
|
'<div><b hello=""></b><b cau=""></b></div>',
|
|
5945
5977
|
);
|
|
5946
5978
|
|
|
5979
|
+
$rootScope.$digest();
|
|
5980
|
+
|
|
5947
5981
|
expect(element[0].outerHTML).toEqual(
|
|
5948
5982
|
'<div><b hello=""></b><b cau=""><span>Cau!</span></b></div>',
|
|
5949
5983
|
);
|
|
@@ -5965,6 +5999,8 @@ describe("$compile", () => {
|
|
|
5965
5999
|
'<div><b i-hello=""></b><b i-cau=""></b></div>',
|
|
5966
6000
|
);
|
|
5967
6001
|
|
|
6002
|
+
$rootScope.$digest();
|
|
6003
|
+
|
|
5968
6004
|
expect(element[0].outerHTML).toBe(
|
|
5969
6005
|
'<div><b i-hello=""></b><span i-cau="">Cau!</span></div>',
|
|
5970
6006
|
);
|
|
@@ -5982,6 +6018,8 @@ describe("$compile", () => {
|
|
|
5982
6018
|
$rootScope.name = "Elvis";
|
|
5983
6019
|
element = $compile('<div><b hello=""></b></div>')($rootScope);
|
|
5984
6020
|
|
|
6021
|
+
$rootScope.$digest();
|
|
6022
|
+
|
|
5985
6023
|
setTimeout(() => {
|
|
5986
6024
|
expect(element[0].outerHTML).toEqual(
|
|
5987
6025
|
'<div><b hello=""><span>Hello, Elvis!</span></b></div>',
|
|
@@ -5995,6 +6033,8 @@ describe("$compile", () => {
|
|
|
5995
6033
|
$rootScope.name = "Elvis";
|
|
5996
6034
|
element = $compile("<div><b i-hello></b></div>")($rootScope);
|
|
5997
6035
|
|
|
6036
|
+
$rootScope.$digest();
|
|
6037
|
+
|
|
5998
6038
|
expect(element[0].outerHTML).toBe(
|
|
5999
6039
|
'<div><span i-hello="">Hello, Elvis!</span></div>',
|
|
6000
6040
|
);
|
|
@@ -6005,6 +6045,8 @@ describe("$compile", () => {
|
|
|
6005
6045
|
$rootScope.name = "Elvis";
|
|
6006
6046
|
element = $compile('<div><b hello=""></b></div>')($rootScope);
|
|
6007
6047
|
|
|
6048
|
+
$rootScope.$digest();
|
|
6049
|
+
|
|
6008
6050
|
expect(element[0].outerHTML).toEqual(
|
|
6009
6051
|
'<div><b hello=""><span replace="">Hello, Elvis!</span></b></div>',
|
|
6010
6052
|
);
|
|
@@ -6014,6 +6056,8 @@ describe("$compile", () => {
|
|
|
6014
6056
|
$rootScope.name = "Elvis";
|
|
6015
6057
|
element = $compile("<div replace></div>")($rootScope);
|
|
6016
6058
|
|
|
6059
|
+
$rootScope.$digest();
|
|
6060
|
+
|
|
6017
6061
|
expect(element[0].outerHTML).toEqual(
|
|
6018
6062
|
'<span replace="">Hello, Elvis!</span>',
|
|
6019
6063
|
);
|
|
@@ -6036,10 +6080,11 @@ describe("$compile", () => {
|
|
|
6036
6080
|
|
|
6037
6081
|
e1 = template($rootScope.$new(), () => {}); // clone
|
|
6038
6082
|
expect(e1.text()).toEqual("");
|
|
6039
|
-
// ;
|
|
6083
|
+
// $rootScope.$digest();
|
|
6040
6084
|
setTimeout(() => {
|
|
6041
6085
|
e2 = template($rootScope.$new(), () => {}); // clone
|
|
6042
6086
|
//
|
|
6087
|
+
$rootScope.$digest();
|
|
6043
6088
|
expect(e1.text()).toEqual("HelloElvis ");
|
|
6044
6089
|
expect(e2.text()).toEqual("HelloElvis ");
|
|
6045
6090
|
|
|
@@ -6064,6 +6109,7 @@ describe("$compile", () => {
|
|
|
6064
6109
|
|
|
6065
6110
|
await wait(100);
|
|
6066
6111
|
e2 = template($rootScope.$new(), () => {}); // clone
|
|
6112
|
+
$rootScope.$digest();
|
|
6067
6113
|
expect(e1.text()).toEqual("Elvis");
|
|
6068
6114
|
expect(e2.text()).toEqual("Elvis");
|
|
6069
6115
|
|
|
@@ -6091,6 +6137,7 @@ describe("$compile", () => {
|
|
|
6091
6137
|
|
|
6092
6138
|
await wait(100);
|
|
6093
6139
|
e2 = template($rootScope.$new(), () => {}); // clone
|
|
6140
|
+
$rootScope.$digest();
|
|
6094
6141
|
expect(e1.text()).toEqual("HelloElvis");
|
|
6095
6142
|
expect(e2.text()).toEqual("HelloElvis");
|
|
6096
6143
|
|
|
@@ -6110,6 +6157,7 @@ describe("$compile", () => {
|
|
|
6110
6157
|
|
|
6111
6158
|
e2 = template($rootScope.$new(), () => {}); // clone
|
|
6112
6159
|
|
|
6160
|
+
$rootScope.$digest();
|
|
6113
6161
|
setTimeout(() => {
|
|
6114
6162
|
expect(e1.text()).toEqual("Elvis");
|
|
6115
6163
|
expect(e2.text()).toEqual("Elvis");
|
|
@@ -6171,6 +6219,7 @@ describe("$compile", () => {
|
|
|
6171
6219
|
element = $compile("<div test></div>")($rootScope, (node) => {
|
|
6172
6220
|
node[0].classList.add("clonefn-class");
|
|
6173
6221
|
});
|
|
6222
|
+
$rootScope.$digest();
|
|
6174
6223
|
expect(element[0].classList.contains("template-class")).toBeTrue();
|
|
6175
6224
|
expect(element[0].classList.contains("clonefn-class")).toBeTrue();
|
|
6176
6225
|
});
|
|
@@ -6239,7 +6288,8 @@ describe("$compile", () => {
|
|
|
6239
6288
|
expect(log[0]).toEqual("first-C");
|
|
6240
6289
|
|
|
6241
6290
|
log.push("FLUSH");
|
|
6242
|
-
//
|
|
6291
|
+
// //$rootScope.$digest();
|
|
6292
|
+
$rootScope.$digest();
|
|
6243
6293
|
expect(log.join("; ")).toEqual(
|
|
6244
6294
|
"first-C; FLUSH; second-C; last-C; third-C; " +
|
|
6245
6295
|
"first-PreL; second-PreL; last-PreL; third-PreL; " +
|
|
@@ -6264,6 +6314,7 @@ describe("$compile", () => {
|
|
|
6264
6314
|
expect(log[0]).toEqual("iFirst-C");
|
|
6265
6315
|
|
|
6266
6316
|
log.push("FLUSH");
|
|
6317
|
+
$rootScope.$digest();
|
|
6267
6318
|
expect(log.join("; ")).toEqual(
|
|
6268
6319
|
"iFirst-C; FLUSH; iSecond-C; iThird-C; iLast-C; " +
|
|
6269
6320
|
"iFirst-PreL; iSecond-PreL; iThird-PreL; iLast-PreL; " +
|
|
@@ -6287,6 +6338,7 @@ describe("$compile", () => {
|
|
|
6287
6338
|
//expect(log.join("; ")).toEqual("first-C; FLUSH; second-C; last-C; third-C");
|
|
6288
6339
|
|
|
6289
6340
|
element = template($rootScope);
|
|
6341
|
+
$rootScope.$digest();
|
|
6290
6342
|
expect(log.join("; ")).toEqual(
|
|
6291
6343
|
"first-C; FLUSH; second-C; last-C; third-C; " +
|
|
6292
6344
|
"first-PreL; second-PreL; last-PreL; third-PreL; " +
|
|
@@ -6310,6 +6362,7 @@ describe("$compile", () => {
|
|
|
6310
6362
|
expect(log[0]).toEqual("iFirst-C");
|
|
6311
6363
|
log.push("FLUSH");
|
|
6312
6364
|
element = template($rootScope);
|
|
6365
|
+
$rootScope.$digest();
|
|
6313
6366
|
expect(log.join("; ")).toEqual(
|
|
6314
6367
|
"iFirst-C; FLUSH; iSecond-C; iThird-C; iLast-C; " +
|
|
6315
6368
|
"iFirst-PreL; iSecond-PreL; iThird-PreL; iLast-PreL; " +
|
|
@@ -6328,6 +6381,7 @@ describe("$compile", () => {
|
|
|
6328
6381
|
it("should allow multiple elements in template", () => {
|
|
6329
6382
|
$templateCache.set("second.html", "before <b>mid</b> after");
|
|
6330
6383
|
element = $compile("<div second></div>")($rootScope);
|
|
6384
|
+
$rootScope.$digest();
|
|
6331
6385
|
expect(element.text()).toEqual("before mid after");
|
|
6332
6386
|
});
|
|
6333
6387
|
|
|
@@ -6338,6 +6392,7 @@ describe("$compile", () => {
|
|
|
6338
6392
|
);
|
|
6339
6393
|
element = JQLite('<b hello="">{{1+2}}</b>');
|
|
6340
6394
|
$compile(element)($rootScope);
|
|
6395
|
+
$rootScope.$digest();
|
|
6341
6396
|
expect(element.text()).toEqual("3==3");
|
|
6342
6397
|
});
|
|
6343
6398
|
|
|
@@ -6370,7 +6425,7 @@ describe("$compile", () => {
|
|
|
6370
6425
|
|
|
6371
6426
|
// expect(() => {
|
|
6372
6427
|
// $compile("<p template></p>")($rootScope);
|
|
6373
|
-
// ;
|
|
6428
|
+
// $rootScope.$digest();
|
|
6374
6429
|
// }).toThrowError(/tplrt/);
|
|
6375
6430
|
// });
|
|
6376
6431
|
|
|
@@ -6386,7 +6441,9 @@ describe("$compile", () => {
|
|
|
6386
6441
|
it("should not throw if the root element is accompanied by: whitespace", () => {
|
|
6387
6442
|
$templateCache.set("template.html", "<div>Hello World!</div> \n");
|
|
6388
6443
|
element = $compile("<p template></p>")($rootScope);
|
|
6389
|
-
expect(() => {
|
|
6444
|
+
expect(() => {
|
|
6445
|
+
$rootScope.$digest();
|
|
6446
|
+
}).not.toThrow();
|
|
6390
6447
|
expect(element.length).toBe(1);
|
|
6391
6448
|
expect(element.text()).toBe("Hello World!");
|
|
6392
6449
|
});
|
|
@@ -6397,7 +6454,9 @@ describe("$compile", () => {
|
|
|
6397
6454
|
"<!-- oh hi --><div>Hello World!</div> \n",
|
|
6398
6455
|
);
|
|
6399
6456
|
element = $compile("<p template></p>")($rootScope);
|
|
6400
|
-
expect(() => {
|
|
6457
|
+
expect(() => {
|
|
6458
|
+
$rootScope.$digest();
|
|
6459
|
+
}).not.toThrow();
|
|
6401
6460
|
expect(element.length).toBe(1);
|
|
6402
6461
|
expect(element.text()).toBe("Hello World!");
|
|
6403
6462
|
});
|
|
@@ -6408,7 +6467,9 @@ describe("$compile", () => {
|
|
|
6408
6467
|
" <!-- oh hi --> <div>Hello World!</div> <!-- oh hi -->\n",
|
|
6409
6468
|
);
|
|
6410
6469
|
element = $compile("<p template></p>")($rootScope);
|
|
6411
|
-
expect(() => {
|
|
6470
|
+
expect(() => {
|
|
6471
|
+
$rootScope.$digest();
|
|
6472
|
+
}).not.toThrow();
|
|
6412
6473
|
expect(element.length).toBe(1);
|
|
6413
6474
|
expect(element.text()).toBe("Hello World!");
|
|
6414
6475
|
});
|
|
@@ -6486,6 +6547,7 @@ describe("$compile", () => {
|
|
|
6486
6547
|
expect(() => {
|
|
6487
6548
|
element = $compile("<div replace-with-tr></div>")($rootScope);
|
|
6488
6549
|
}).not.toThrow();
|
|
6550
|
+
$rootScope.$digest();
|
|
6489
6551
|
expect(getNodeName(element)).toMatch(/tr/i);
|
|
6490
6552
|
});
|
|
6491
6553
|
|
|
@@ -6494,6 +6556,7 @@ describe("$compile", () => {
|
|
|
6494
6556
|
expect(() => {
|
|
6495
6557
|
element = $compile("<div replace-with-td></div>")($rootScope);
|
|
6496
6558
|
}).not.toThrow();
|
|
6559
|
+
$rootScope.$digest();
|
|
6497
6560
|
expect(getNodeName(element)).toMatch(/td/i);
|
|
6498
6561
|
});
|
|
6499
6562
|
|
|
@@ -6502,6 +6565,7 @@ describe("$compile", () => {
|
|
|
6502
6565
|
expect(() => {
|
|
6503
6566
|
element = $compile("<div replace-with-th></div>")($rootScope);
|
|
6504
6567
|
}).not.toThrow();
|
|
6568
|
+
$rootScope.$digest();
|
|
6505
6569
|
expect(getNodeName(element)).toMatch(/th/i);
|
|
6506
6570
|
});
|
|
6507
6571
|
|
|
@@ -6510,6 +6574,7 @@ describe("$compile", () => {
|
|
|
6510
6574
|
expect(() => {
|
|
6511
6575
|
element = $compile("<div replace-with-thead></div>")($rootScope);
|
|
6512
6576
|
}).not.toThrow();
|
|
6577
|
+
$rootScope.$digest();
|
|
6513
6578
|
expect(getNodeName(element)).toMatch(/thead/i);
|
|
6514
6579
|
});
|
|
6515
6580
|
|
|
@@ -6518,6 +6583,7 @@ describe("$compile", () => {
|
|
|
6518
6583
|
expect(() => {
|
|
6519
6584
|
element = $compile("<div replace-with-tbody></div>")($rootScope);
|
|
6520
6585
|
}).not.toThrow();
|
|
6586
|
+
$rootScope.$digest();
|
|
6521
6587
|
expect(getNodeName(element)).toMatch(/tbody/i);
|
|
6522
6588
|
});
|
|
6523
6589
|
|
|
@@ -6526,6 +6592,7 @@ describe("$compile", () => {
|
|
|
6526
6592
|
expect(() => {
|
|
6527
6593
|
element = $compile("<div replace-with-tfoot></div>")($rootScope);
|
|
6528
6594
|
}).not.toThrow();
|
|
6595
|
+
$rootScope.$digest();
|
|
6529
6596
|
expect(getNodeName(element)).toMatch(/tfoot/i);
|
|
6530
6597
|
});
|
|
6531
6598
|
|
|
@@ -6534,6 +6601,7 @@ describe("$compile", () => {
|
|
|
6534
6601
|
expect(() => {
|
|
6535
6602
|
element = $compile("<div replace-with-option></div>")($rootScope);
|
|
6536
6603
|
}).not.toThrow();
|
|
6604
|
+
$rootScope.$digest();
|
|
6537
6605
|
expect(getNodeName(element)).toMatch(/option/i);
|
|
6538
6606
|
});
|
|
6539
6607
|
|
|
@@ -6542,6 +6610,7 @@ describe("$compile", () => {
|
|
|
6542
6610
|
expect(() => {
|
|
6543
6611
|
element = $compile("<div replace-with-optgroup></div>")($rootScope);
|
|
6544
6612
|
}).not.toThrow();
|
|
6613
|
+
$rootScope.$digest();
|
|
6545
6614
|
expect(getNodeName(element)).toMatch(/optgroup/i);
|
|
6546
6615
|
});
|
|
6547
6616
|
|
|
@@ -6567,6 +6636,7 @@ describe("$compile", () => {
|
|
|
6567
6636
|
element = $compile(
|
|
6568
6637
|
'<svg><g svg-anchor="/foo/bar" text="foo/bar!"></g></svg>',
|
|
6569
6638
|
)($rootScope);
|
|
6639
|
+
$rootScope.$digest();
|
|
6570
6640
|
const child = element.children().eq(0);
|
|
6571
6641
|
expect(getNodeName(child)).toMatch(/a/i);
|
|
6572
6642
|
expect(isSVGElement(child[0])).toBe(true);
|
|
@@ -6602,6 +6672,7 @@ describe("$compile", () => {
|
|
|
6602
6672
|
element = $compile('<math><mn pow="2"><mn>8</mn></mn></math>')(
|
|
6603
6673
|
$rootScope,
|
|
6604
6674
|
);
|
|
6675
|
+
$rootScope.$digest();
|
|
6605
6676
|
const child = element.children().eq(0);
|
|
6606
6677
|
expect(getNodeName(child)).toMatch(/msup/i);
|
|
6607
6678
|
expect(isUnknownElement(child[0])).toBe(false);
|
|
@@ -6633,6 +6704,7 @@ describe("$compile", () => {
|
|
|
6633
6704
|
element = $compile(
|
|
6634
6705
|
"<template-url-with-prototype><template-url-with-prototype>",
|
|
6635
6706
|
)($rootScope);
|
|
6707
|
+
$rootScope.$digest();
|
|
6636
6708
|
expect(element.find("p")[0].innerHTML).toEqual("Test Value");
|
|
6637
6709
|
},
|
|
6638
6710
|
);
|
|
@@ -6668,6 +6740,8 @@ describe("$compile", () => {
|
|
|
6668
6740
|
)($rootScope);
|
|
6669
6741
|
expect(element.text()).toEqual("");
|
|
6670
6742
|
|
|
6743
|
+
$rootScope.$digest();
|
|
6744
|
+
|
|
6671
6745
|
expect(element.text()).toEqual("template content");
|
|
6672
6746
|
},
|
|
6673
6747
|
);
|
|
@@ -6849,6 +6923,7 @@ describe("$compile", () => {
|
|
|
6849
6923
|
"<a log>{{name}}; scopeId: {{$id}}</a>",
|
|
6850
6924
|
);
|
|
6851
6925
|
element = $compile("<div><span tscope></span></div>")($rootScope);
|
|
6926
|
+
$rootScope.$digest();
|
|
6852
6927
|
expect(log.length).toEqual(2);
|
|
6853
6928
|
$rootScope.name = "Jozo";
|
|
6854
6929
|
$rootScope.$apply();
|
|
@@ -6861,6 +6936,7 @@ describe("$compile", () => {
|
|
|
6861
6936
|
"<p><a log>{{name}}; scopeId: {{$id}}</a></p>",
|
|
6862
6937
|
);
|
|
6863
6938
|
element = $compile("<div><span trscope></span></div>")($rootScope);
|
|
6939
|
+
$rootScope.$digest();
|
|
6864
6940
|
expect(log.length).toEqual(2);
|
|
6865
6941
|
$rootScope.name = "Jozo";
|
|
6866
6942
|
$rootScope.$apply();
|
|
@@ -6872,6 +6948,7 @@ describe("$compile", () => {
|
|
|
6872
6948
|
element = $compile(
|
|
6873
6949
|
'<div><span ng-repeat="i in [1,2,3]" trscope></span></div>',
|
|
6874
6950
|
)($rootScope);
|
|
6951
|
+
$rootScope.$digest();
|
|
6875
6952
|
expect(log.length).toEqual(6);
|
|
6876
6953
|
$rootScope.name = "Jozo";
|
|
6877
6954
|
$rootScope.$apply();
|
|
@@ -6881,6 +6958,7 @@ describe("$compile", () => {
|
|
|
6881
6958
|
it("should allow creation of new isolated scopes for directives with templates", () => {
|
|
6882
6959
|
$templateCache.set("tiscope.html", "<a log></a>");
|
|
6883
6960
|
element = $compile("<div><span tiscope></span></div>")($rootScope);
|
|
6961
|
+
$rootScope.$digest();
|
|
6884
6962
|
expect(log.length).toEqual(2);
|
|
6885
6963
|
$rootScope.name = "abc";
|
|
6886
6964
|
expect(iscope.$parent).toBe($rootScope);
|
|
@@ -6916,6 +6994,7 @@ describe("$compile", () => {
|
|
|
6916
6994
|
it("should not allow more than one isolate/new scope creation per element regardless of `templateUrl`", () => {
|
|
6917
6995
|
$templateCache.set("tiscope.html", "<div>Hello, world !</div>");
|
|
6918
6996
|
$compile("<div tiscope-a scope-b></div>")($rootScope);
|
|
6997
|
+
$rootScope.$digest();
|
|
6919
6998
|
expect(log[0].match(/multidir/)).toBeTruthy();
|
|
6920
6999
|
});
|
|
6921
7000
|
|
|
@@ -6944,6 +7023,7 @@ describe("$compile", () => {
|
|
|
6944
7023
|
it("should return the new scope for children in the directive template", () => {
|
|
6945
7024
|
$templateCache.set("tscope.html", "<a></a>");
|
|
6946
7025
|
element = $compile("<div tscope></div>")($rootScope);
|
|
7026
|
+
$rootScope.$digest();
|
|
6947
7027
|
expect($rootScope.$$childHead.$parent).toBe($rootScope);
|
|
6948
7028
|
});
|
|
6949
7029
|
|
|
@@ -6971,6 +7051,7 @@ describe("$compile", () => {
|
|
|
6971
7051
|
$templateCache.set("tiscope.html", "<a></a>");
|
|
6972
7052
|
element = $compile("<div tiscope></div>")($rootScope);
|
|
6973
7053
|
expect($rootScope.$$childHead).toBeDefined(); // ??? this is the current behavior, not desired feature
|
|
7054
|
+
$rootScope.$digest();
|
|
6974
7055
|
expect($rootScope.$$childHead).not.toBe($rootScope);
|
|
6975
7056
|
});
|
|
6976
7057
|
|
|
@@ -7291,7 +7372,7 @@ describe("$compile", () => {
|
|
|
7291
7372
|
// $rootScope,
|
|
7292
7373
|
// );
|
|
7293
7374
|
// $rootScope.$apply();
|
|
7294
|
-
// ;
|
|
7375
|
+
// $rootScope.$digest();
|
|
7295
7376
|
// directiveElement = element.find("a");
|
|
7296
7377
|
// child = directiveElement.find("span");
|
|
7297
7378
|
// expect(child.scope()).toBe(directiveElement.isolateScope());
|
|
@@ -7426,6 +7507,7 @@ describe("$compile", () => {
|
|
|
7426
7507
|
element = $compile('<div name="attr: {{name}}">text: {{name}}</div>')(
|
|
7427
7508
|
$rootScope,
|
|
7428
7509
|
);
|
|
7510
|
+
$rootScope.$digest();
|
|
7429
7511
|
expect(element.text()).toEqual("text: angular");
|
|
7430
7512
|
expect(element.attr("name")).toEqual("attr: angular");
|
|
7431
7513
|
});
|
|
@@ -7436,10 +7518,12 @@ describe("$compile", () => {
|
|
|
7436
7518
|
'<div name="attr: {{::name}}">text: {{::name}}</div>',
|
|
7437
7519
|
)($rootScope);
|
|
7438
7520
|
expect($rootScope.$$watchers.length).toBe(2);
|
|
7521
|
+
$rootScope.$digest();
|
|
7439
7522
|
expect(element.text()).toEqual("text: angular");
|
|
7440
7523
|
expect(element.attr("name")).toEqual("attr: angular");
|
|
7441
7524
|
expect($rootScope.$$watchers.length).toBe(0);
|
|
7442
7525
|
$rootScope.name = "not-angular";
|
|
7526
|
+
$rootScope.$digest();
|
|
7443
7527
|
expect(element.text()).toEqual("text: angular");
|
|
7444
7528
|
expect(element.attr("name")).toEqual("attr: angular");
|
|
7445
7529
|
});
|
|
@@ -7450,16 +7534,19 @@ describe("$compile", () => {
|
|
|
7450
7534
|
'<div name="attr: {{::name}}">text: {{ ::name }}</div>',
|
|
7451
7535
|
)($rootScope);
|
|
7452
7536
|
expect($rootScope.$$watchers.length).toBe(2);
|
|
7537
|
+
$rootScope.$digest();
|
|
7453
7538
|
expect(element.text()).toEqual("text: angular");
|
|
7454
7539
|
expect(element.attr("name")).toEqual("attr: angular");
|
|
7455
7540
|
expect($rootScope.$$watchers.length).toBe(0);
|
|
7456
7541
|
$rootScope.name = "not-angular";
|
|
7542
|
+
$rootScope.$digest();
|
|
7457
7543
|
expect(element.text()).toEqual("text: angular");
|
|
7458
7544
|
expect(element.attr("name")).toEqual("attr: angular");
|
|
7459
7545
|
});
|
|
7460
7546
|
|
|
7461
7547
|
it("should interpolate a multi-part expression for regular attributes", () => {
|
|
7462
7548
|
element = $compile('<div foo="some/{{id}}"></div>')($rootScope);
|
|
7549
|
+
$rootScope.$digest();
|
|
7463
7550
|
expect(element.attr("foo")).toBe("some/");
|
|
7464
7551
|
$rootScope.$apply(() => {
|
|
7465
7552
|
$rootScope.id = 1;
|
|
@@ -7543,6 +7630,7 @@ describe("$compile", () => {
|
|
|
7543
7630
|
element = $compile('<div name="attr: {{name}}">text: {{name}}</div>')(
|
|
7544
7631
|
$rootScope,
|
|
7545
7632
|
);
|
|
7633
|
+
$rootScope.$digest();
|
|
7546
7634
|
expect(element.text()).toEqual("text: angular");
|
|
7547
7635
|
expect(element.attr("name")).toEqual("attr: angular");
|
|
7548
7636
|
});
|
|
@@ -7583,6 +7671,7 @@ describe("$compile", () => {
|
|
|
7583
7671
|
element = $compile(
|
|
7584
7672
|
'<div some-attr="foo-{{1+1}}" replace-some-attr></div>',
|
|
7585
7673
|
)($rootScope);
|
|
7674
|
+
$rootScope.$digest();
|
|
7586
7675
|
expect(element.attr("some-attr")).toEqual("bar-2");
|
|
7587
7676
|
});
|
|
7588
7677
|
|
|
@@ -7591,6 +7680,7 @@ describe("$compile", () => {
|
|
|
7591
7680
|
expect(directiveAttrs.someAttr).toBe("nonBound");
|
|
7592
7681
|
|
|
7593
7682
|
expect(observeSpy).not.toHaveBeenCalled();
|
|
7683
|
+
$rootScope.$digest();
|
|
7594
7684
|
expect(observeSpy).toHaveBeenCalled();
|
|
7595
7685
|
});
|
|
7596
7686
|
|
|
@@ -7598,6 +7688,7 @@ describe("$compile", () => {
|
|
|
7598
7688
|
const element = $compile('<img src="abc" data-src="123">')($rootScope);
|
|
7599
7689
|
expect(element.attr("src")).toEqual("abc");
|
|
7600
7690
|
expect(element.attr("data-src")).toEqual("123");
|
|
7691
|
+
$rootScope.$digest();
|
|
7601
7692
|
expect(element.attr("src")).toEqual("abc");
|
|
7602
7693
|
expect(element.attr("data-src")).toEqual("123");
|
|
7603
7694
|
});
|
|
@@ -7618,6 +7709,7 @@ describe("$compile", () => {
|
|
|
7618
7709
|
$compile("<observing-directive observer></observing-directive>")(
|
|
7619
7710
|
$rootScope,
|
|
7620
7711
|
);
|
|
7712
|
+
$rootScope.$digest();
|
|
7621
7713
|
expect(observeSpy).not.toHaveBeenCalledWith(undefined);
|
|
7622
7714
|
});
|
|
7623
7715
|
|
|
@@ -7642,6 +7734,8 @@ describe("$compile", () => {
|
|
|
7642
7734
|
);
|
|
7643
7735
|
|
|
7644
7736
|
$compile('<div some-attr="{{value}}" error></div>')($rootScope);
|
|
7737
|
+
$rootScope.$digest();
|
|
7738
|
+
|
|
7645
7739
|
expect(observeSpy).toHaveBeenCalled();
|
|
7646
7740
|
expect(observeSpy).toHaveBeenCalledTimes(2);
|
|
7647
7741
|
});
|
|
@@ -7650,6 +7744,7 @@ describe("$compile", () => {
|
|
|
7650
7744
|
element = $compile(
|
|
7651
7745
|
'<select ng-model="x"><option value="">Greet {{name}}!</option></select>',
|
|
7652
7746
|
)($rootScope);
|
|
7747
|
+
$rootScope.$digest();
|
|
7653
7748
|
expect(
|
|
7654
7749
|
element[0].outerHTML.replace(' selected="selected"', ""),
|
|
7655
7750
|
).toEqual(
|
|
@@ -7658,6 +7753,7 @@ describe("$compile", () => {
|
|
|
7658
7753
|
"</select>",
|
|
7659
7754
|
);
|
|
7660
7755
|
$rootScope.name = "Misko";
|
|
7756
|
+
$rootScope.$digest();
|
|
7661
7757
|
expect(
|
|
7662
7758
|
element[0].outerHTML.replace(' selected="selected"', ""),
|
|
7663
7759
|
).toEqual(
|
|
@@ -7675,6 +7771,7 @@ describe("$compile", () => {
|
|
|
7675
7771
|
// Run the actual test
|
|
7676
7772
|
const base = JQLite('<div>— {{ "This doesn\'t." }}</div>');
|
|
7677
7773
|
element = $compile(base)($rootScope);
|
|
7774
|
+
$rootScope.$digest();
|
|
7678
7775
|
expect(element.text()).toBe("— This doesn't.");
|
|
7679
7776
|
|
|
7680
7777
|
// Unregister the MutationObserver (and hope it doesn't mess up with subsequent tests)
|
|
@@ -7714,6 +7811,7 @@ describe("$compile", () => {
|
|
|
7714
7811
|
$rootScope,
|
|
7715
7812
|
);
|
|
7716
7813
|
$rootScope.hello = "ahoj";
|
|
7814
|
+
$rootScope.$digest();
|
|
7717
7815
|
expect(element.text()).toBe("ahoj|ahoj|ahoj");
|
|
7718
7816
|
});
|
|
7719
7817
|
|
|
@@ -7735,6 +7833,8 @@ describe("$compile", () => {
|
|
|
7735
7833
|
element = $compile(tmpl)($rootScope);
|
|
7736
7834
|
|
|
7737
7835
|
$rootScope.hello = "ahoj";
|
|
7836
|
+
$rootScope.$digest();
|
|
7837
|
+
|
|
7738
7838
|
expect(element.text()).toBe("ahoj|ahoj|ahoj");
|
|
7739
7839
|
});
|
|
7740
7840
|
|
|
@@ -7757,6 +7857,8 @@ describe("$compile", () => {
|
|
|
7757
7857
|
element = $compile(tmpl)($rootScope);
|
|
7758
7858
|
|
|
7759
7859
|
$rootScope.hello = "ahoj";
|
|
7860
|
+
$rootScope.$digest();
|
|
7861
|
+
|
|
7760
7862
|
expect(element.text()).toBe("ahoj|ahoj|ahoj");
|
|
7761
7863
|
});
|
|
7762
7864
|
|
|
@@ -7783,6 +7885,7 @@ describe("$compile", () => {
|
|
|
7783
7885
|
$rootScope,
|
|
7784
7886
|
);
|
|
7785
7887
|
$rootScope.hello = "ahoj";
|
|
7888
|
+
$rootScope.$digest();
|
|
7786
7889
|
expect(element.text()).toBe("ahoj|ahoj|ahoj");
|
|
7787
7890
|
});
|
|
7788
7891
|
|
|
@@ -7807,6 +7910,8 @@ describe("$compile", () => {
|
|
|
7807
7910
|
expect(log).toEqual([]);
|
|
7808
7911
|
|
|
7809
7912
|
$rootScope.myVal = "carrot";
|
|
7913
|
+
$rootScope.$digest();
|
|
7914
|
+
|
|
7810
7915
|
expect(log[0]).toEqual("carrot");
|
|
7811
7916
|
});
|
|
7812
7917
|
});
|
|
@@ -8952,6 +9057,7 @@ describe("$compile", () => {
|
|
|
8952
9057
|
$rootScope.a = "foo";
|
|
8953
9058
|
|
|
8954
9059
|
element = $compile(template)($rootScope);
|
|
9060
|
+
$rootScope.$digest();
|
|
8955
9061
|
expect(constructorSpy).toHaveBeenCalled();
|
|
8956
9062
|
expect(prototypeSpy).not.toHaveBeenCalled();
|
|
8957
9063
|
|
|
@@ -8983,6 +9089,8 @@ describe("$compile", () => {
|
|
|
8983
9089
|
$rootScope.b = NaN;
|
|
8984
9090
|
|
|
8985
9091
|
element = $compile(template)($rootScope);
|
|
9092
|
+
$rootScope.$digest();
|
|
9093
|
+
|
|
8986
9094
|
expect(onChangesSpy).toHaveBeenCalledTimes(2);
|
|
8987
9095
|
expect(onChangesSpy.calls.argsFor(0)[0]).toEqual({
|
|
8988
9096
|
prop: jasmine.objectContaining({ currentValue: "foo" }),
|
|
@@ -9109,6 +9217,7 @@ describe("$compile", () => {
|
|
|
9109
9217
|
|
|
9110
9218
|
// Update val to trigger the onChanges
|
|
9111
9219
|
$rootScope.a = 42;
|
|
9220
|
+
$rootScope.$digest();
|
|
9112
9221
|
expect(log).toEqual([
|
|
9113
9222
|
[
|
|
9114
9223
|
"OuterController",
|
|
@@ -9564,6 +9673,7 @@ describe("$compile", () => {
|
|
|
9564
9673
|
const scope = $rootScope.$$childHead;
|
|
9565
9674
|
expect(scope.ctrl.getProp()).toBe("default");
|
|
9566
9675
|
|
|
9676
|
+
$rootScope.$digest();
|
|
9567
9677
|
expect(scope.ctrl.getProp()).toBe("default");
|
|
9568
9678
|
});
|
|
9569
9679
|
|
|
@@ -9591,8 +9701,10 @@ describe("$compile", () => {
|
|
|
9591
9701
|
element = $compile("<div test-dir></div>")($rootScope);
|
|
9592
9702
|
const scope = $rootScope.$$childHead;
|
|
9593
9703
|
expect(scope.ctrl.getProp()).toBe("default");
|
|
9704
|
+
$rootScope.$digest();
|
|
9594
9705
|
expect(scope.ctrl.getProp()).toBe("default");
|
|
9595
9706
|
scope.prop = "foop";
|
|
9707
|
+
$rootScope.$digest();
|
|
9596
9708
|
expect(scope.ctrl.getProp()).toBe("foop");
|
|
9597
9709
|
});
|
|
9598
9710
|
|
|
@@ -9625,19 +9737,23 @@ describe("$compile", () => {
|
|
|
9625
9737
|
'<div other-tpl-dir param1="::foo" param2="bar"></div>',
|
|
9626
9738
|
)($rootScope);
|
|
9627
9739
|
expect(countWatches($rootScope)).toEqual(6); // 4 -> template watch group, 2 -> '='
|
|
9740
|
+
$rootScope.$digest();
|
|
9628
9741
|
expect(element.html()).toBe("1:;2:;3:;4:");
|
|
9629
9742
|
expect(countWatches($rootScope)).toEqual(6);
|
|
9630
9743
|
|
|
9631
9744
|
$rootScope.foo = "foo";
|
|
9745
|
+
$rootScope.$digest();
|
|
9632
9746
|
expect(element.html()).toBe("1:foo;2:;3:foo;4:");
|
|
9633
9747
|
expect(countWatches($rootScope)).toEqual(4);
|
|
9634
9748
|
|
|
9635
9749
|
$rootScope.foo = "baz";
|
|
9636
9750
|
$rootScope.bar = "bar";
|
|
9751
|
+
$rootScope.$digest();
|
|
9637
9752
|
expect(element.html()).toBe("1:foo;2:bar;3:foo;4:bar");
|
|
9638
9753
|
expect(countWatches($rootScope)).toEqual(3);
|
|
9639
9754
|
|
|
9640
9755
|
$rootScope.bar = "baz";
|
|
9756
|
+
$rootScope.$digest();
|
|
9641
9757
|
expect(element.html()).toBe("1:foo;2:baz;3:foo;4:bar");
|
|
9642
9758
|
});
|
|
9643
9759
|
|
|
@@ -9659,19 +9775,23 @@ describe("$compile", () => {
|
|
|
9659
9775
|
'<div other-tpl-dir param1="{{::foo}}" param2="{{bar}}"></div>',
|
|
9660
9776
|
)($rootScope);
|
|
9661
9777
|
expect(countWatches($rootScope)).toEqual(6); // 4 -> template watch group, 2 -> {{ }}
|
|
9778
|
+
$rootScope.$digest();
|
|
9662
9779
|
expect(element.html()).toBe("1:;2:;3:;4:");
|
|
9663
9780
|
expect(countWatches($rootScope)).toEqual(4); // (- 2) -> bind-once in template
|
|
9664
9781
|
|
|
9665
9782
|
$rootScope.foo = "foo";
|
|
9783
|
+
$rootScope.$digest();
|
|
9666
9784
|
expect(element.html()).toBe("1:foo;2:;3:;4:");
|
|
9667
9785
|
expect(countWatches($rootScope)).toEqual(3);
|
|
9668
9786
|
|
|
9669
9787
|
$rootScope.foo = "baz";
|
|
9670
9788
|
$rootScope.bar = "bar";
|
|
9789
|
+
$rootScope.$digest();
|
|
9671
9790
|
expect(element.html()).toBe("1:foo;2:bar;3:;4:");
|
|
9672
9791
|
expect(countWatches($rootScope)).toEqual(3);
|
|
9673
9792
|
|
|
9674
9793
|
$rootScope.bar = "baz";
|
|
9794
|
+
$rootScope.$digest();
|
|
9675
9795
|
expect(element.html()).toBe("1:foo;2:baz;3:;4:");
|
|
9676
9796
|
});
|
|
9677
9797
|
|
|
@@ -9697,19 +9817,23 @@ describe("$compile", () => {
|
|
|
9697
9817
|
element = $compile(
|
|
9698
9818
|
'<div other-tpl-dir param1="::foo" param2="bar"></div>',
|
|
9699
9819
|
)($rootScope);
|
|
9820
|
+
$rootScope.$digest();
|
|
9700
9821
|
expect(element.html()).toBe("1:;2:;3:;4:");
|
|
9701
9822
|
expect(countWatches($rootScope)).toEqual(6); // 4 -> template watch group, 2 -> '='
|
|
9702
9823
|
|
|
9703
9824
|
$rootScope.foo = "foo";
|
|
9825
|
+
$rootScope.$digest();
|
|
9704
9826
|
expect(element.html()).toBe("1:foo;2:;3:foo;4:");
|
|
9705
9827
|
expect(countWatches($rootScope)).toEqual(4);
|
|
9706
9828
|
|
|
9707
9829
|
$rootScope.foo = "baz";
|
|
9708
9830
|
$rootScope.bar = "bar";
|
|
9831
|
+
$rootScope.$digest();
|
|
9709
9832
|
expect(element.html()).toBe("1:foo;2:bar;3:foo;4:bar");
|
|
9710
9833
|
expect(countWatches($rootScope)).toEqual(3);
|
|
9711
9834
|
|
|
9712
9835
|
$rootScope.bar = "baz";
|
|
9836
|
+
$rootScope.$digest();
|
|
9713
9837
|
expect(element.html()).toBe("1:foo;2:baz;3:foo;4:bar");
|
|
9714
9838
|
});
|
|
9715
9839
|
|
|
@@ -9735,19 +9859,23 @@ describe("$compile", () => {
|
|
|
9735
9859
|
element = $compile(
|
|
9736
9860
|
'<div other-tpl-dir param1="{{::foo}}" param2="{{bar}}"></div>',
|
|
9737
9861
|
)($rootScope);
|
|
9862
|
+
$rootScope.$digest();
|
|
9738
9863
|
expect(element.html()).toBe("1:;2:;3:;4:");
|
|
9739
9864
|
expect(countWatches($rootScope)).toEqual(4); // (4 - 2) -> template watch group, 2 -> {{ }}
|
|
9740
9865
|
|
|
9741
9866
|
$rootScope.foo = "foo";
|
|
9867
|
+
$rootScope.$digest();
|
|
9742
9868
|
expect(element.html()).toBe("1:foo;2:;3:;4:");
|
|
9743
9869
|
expect(countWatches($rootScope)).toEqual(3);
|
|
9744
9870
|
|
|
9745
9871
|
$rootScope.foo = "baz";
|
|
9746
9872
|
$rootScope.bar = "bar";
|
|
9873
|
+
$rootScope.$digest();
|
|
9747
9874
|
expect(element.html()).toBe("1:foo;2:bar;3:;4:");
|
|
9748
9875
|
expect(countWatches($rootScope)).toEqual(3);
|
|
9749
9876
|
|
|
9750
9877
|
$rootScope.bar = "baz";
|
|
9878
|
+
$rootScope.$digest();
|
|
9751
9879
|
expect(element.html()).toBe("1:foo;2:baz;3:;4:");
|
|
9752
9880
|
});
|
|
9753
9881
|
|
|
@@ -9777,6 +9905,7 @@ describe("$compile", () => {
|
|
|
9777
9905
|
'<div><hello greeting="greeting"></hello></div>' +
|
|
9778
9906
|
"</div>",
|
|
9779
9907
|
)($rootScope);
|
|
9908
|
+
$rootScope.$digest();
|
|
9780
9909
|
element.find("button")[0].click();
|
|
9781
9910
|
expect(element.find("p").text()).toBe("Hello!");
|
|
9782
9911
|
});
|
|
@@ -10214,6 +10343,8 @@ describe("$compile", () => {
|
|
|
10214
10343
|
expect($rootScope.name).toEqual("outer");
|
|
10215
10344
|
expect(component.input).toEqual("$onInit");
|
|
10216
10345
|
|
|
10346
|
+
$rootScope.$digest();
|
|
10347
|
+
|
|
10217
10348
|
expect($rootScope.name).toEqual("outer");
|
|
10218
10349
|
expect(component.input).toEqual("$onInit");
|
|
10219
10350
|
|
|
@@ -10235,6 +10366,8 @@ describe("$compile", () => {
|
|
|
10235
10366
|
expect(component.input).toEqual("$onInit");
|
|
10236
10367
|
|
|
10237
10368
|
$rootScope.name[0] = "inner";
|
|
10369
|
+
$rootScope.$digest();
|
|
10370
|
+
|
|
10238
10371
|
expect($rootScope.name).toEqual(["inner"]);
|
|
10239
10372
|
expect(component.input).toEqual("$onInit");
|
|
10240
10373
|
|
|
@@ -10256,6 +10389,8 @@ describe("$compile", () => {
|
|
|
10256
10389
|
expect(component.input).toEqual("$onInit");
|
|
10257
10390
|
|
|
10258
10391
|
$rootScope.name = ["outer"];
|
|
10392
|
+
$rootScope.$digest();
|
|
10393
|
+
|
|
10259
10394
|
expect($rootScope.name).toEqual(["outer"]);
|
|
10260
10395
|
expect(component.input).toEqual(["outer"]);
|
|
10261
10396
|
|
|
@@ -10342,6 +10477,8 @@ describe("$compile", () => {
|
|
|
10342
10477
|
);
|
|
10343
10478
|
|
|
10344
10479
|
expect(component.input).toEqual("$onInit");
|
|
10480
|
+
$rootScope.$digest();
|
|
10481
|
+
|
|
10345
10482
|
expect($rootScope.name).toEqual("outer2");
|
|
10346
10483
|
expect(component.input).toEqual("outer2");
|
|
10347
10484
|
expect(log).toEqual([
|
|
@@ -11031,9 +11168,11 @@ describe("$compile", () => {
|
|
|
11031
11168
|
$rootScope,
|
|
11032
11169
|
);
|
|
11033
11170
|
const p = element.find("p");
|
|
11171
|
+
$rootScope.$digest();
|
|
11034
11172
|
expect(p.text()).toBe("Test: ");
|
|
11035
11173
|
|
|
11036
11174
|
$rootScope.text = "Kittens";
|
|
11175
|
+
$rootScope.$digest();
|
|
11037
11176
|
expect(p.text()).toBe("Test: Kittens");
|
|
11038
11177
|
});
|
|
11039
11178
|
|
|
@@ -11082,6 +11221,7 @@ describe("$compile", () => {
|
|
|
11082
11221
|
'dir-str="Hello, {{whom}}!" ' +
|
|
11083
11222
|
'dir-fn="fn()"></div>',
|
|
11084
11223
|
)($rootScope);
|
|
11224
|
+
$rootScope.$digest();
|
|
11085
11225
|
expect(controllerCalled).toBe(true);
|
|
11086
11226
|
});
|
|
11087
11227
|
|
|
@@ -11242,6 +11382,7 @@ describe("$compile", () => {
|
|
|
11242
11382
|
'dir-str="Hello, {{whom}}!" ' +
|
|
11243
11383
|
'dir-fn="fn()"></div>',
|
|
11244
11384
|
)($rootScope);
|
|
11385
|
+
$rootScope.$digest();
|
|
11245
11386
|
expect(controllerCalled).toBe(true);
|
|
11246
11387
|
if (ddo.controllerAs || ddo.controller.indexOf(" as ") !== -1) {
|
|
11247
11388
|
if (ddo.scope) {
|
|
@@ -11322,6 +11463,7 @@ describe("$compile", () => {
|
|
|
11322
11463
|
'bar-fn="fn2()" > ' +
|
|
11323
11464
|
"</div>",
|
|
11324
11465
|
)($rootScope);
|
|
11466
|
+
$rootScope.$digest();
|
|
11325
11467
|
expect(controller1Called).toBe(true);
|
|
11326
11468
|
expect(controller2Called).toBe(true);
|
|
11327
11469
|
});
|
|
@@ -11392,6 +11534,7 @@ describe("$compile", () => {
|
|
|
11392
11534
|
'bar-fn="fn2()" > ' +
|
|
11393
11535
|
"</div>",
|
|
11394
11536
|
)($rootScope);
|
|
11537
|
+
$rootScope.$digest();
|
|
11395
11538
|
expect(controller1Called).toBe(true);
|
|
11396
11539
|
expect(controller2Called).toBe(true);
|
|
11397
11540
|
});
|
|
@@ -11463,6 +11606,7 @@ describe("$compile", () => {
|
|
|
11463
11606
|
'bar-fn="fn2()" > ' +
|
|
11464
11607
|
"</div>",
|
|
11465
11608
|
)($rootScope);
|
|
11609
|
+
$rootScope.$digest();
|
|
11466
11610
|
expect(controller1Called).toBe(true);
|
|
11467
11611
|
expect(controller2Called).toBe(true);
|
|
11468
11612
|
});
|
|
@@ -11510,6 +11654,8 @@ describe("$compile", () => {
|
|
|
11510
11654
|
"</child>" +
|
|
11511
11655
|
"</div>",
|
|
11512
11656
|
)($rootScope);
|
|
11657
|
+
$rootScope.$digest();
|
|
11658
|
+
|
|
11513
11659
|
const parentCtrl = element.controller("ngController");
|
|
11514
11660
|
const childCtrl = element.find("child").controller("child");
|
|
11515
11661
|
|
|
@@ -11523,6 +11669,8 @@ describe("$compile", () => {
|
|
|
11523
11669
|
expect(childCtrl.fromParent4).not.toBe(childCtrl.value4);
|
|
11524
11670
|
|
|
11525
11671
|
childCtrl.fromParent2 = "modified";
|
|
11672
|
+
$rootScope.$digest();
|
|
11673
|
+
|
|
11526
11674
|
expect(parentCtrl.value2).toBe("modified");
|
|
11527
11675
|
expect(childCtrl.value2).toBe("child2");
|
|
11528
11676
|
});
|
|
@@ -11571,6 +11719,8 @@ describe("$compile", () => {
|
|
|
11571
11719
|
"</child>" +
|
|
11572
11720
|
"</div>",
|
|
11573
11721
|
)($rootScope);
|
|
11722
|
+
$rootScope.$digest();
|
|
11723
|
+
|
|
11574
11724
|
const parentCtrl = element.controller("ngController");
|
|
11575
11725
|
const childCtrl = element.find("child").controller("child");
|
|
11576
11726
|
|
|
@@ -11584,6 +11734,8 @@ describe("$compile", () => {
|
|
|
11584
11734
|
expect(childCtrl.fromParent4).not.toBe(childCtrl.value4);
|
|
11585
11735
|
|
|
11586
11736
|
childCtrl.fromParent2 = "modified";
|
|
11737
|
+
$rootScope.$digest();
|
|
11738
|
+
|
|
11587
11739
|
expect(parentCtrl.value2).toBe("modified");
|
|
11588
11740
|
expect(childCtrl.value2).toBe("child2");
|
|
11589
11741
|
});
|
|
@@ -11608,6 +11760,7 @@ describe("$compile", () => {
|
|
|
11608
11760
|
initInjector("test1");
|
|
11609
11761
|
$templateCache.set("test.html", "<p>isolate</p>");
|
|
11610
11762
|
element = $compile("<div foo-dir>")($rootScope);
|
|
11763
|
+
$rootScope.$digest();
|
|
11611
11764
|
expect(controllerCalled).toBe(true);
|
|
11612
11765
|
const childScope = $rootScope.$$childHead;
|
|
11613
11766
|
expect(childScope).not.toBe($rootScope);
|
|
@@ -11665,6 +11818,7 @@ describe("$compile", () => {
|
|
|
11665
11818
|
'dir-str="Hello, {{whom}}!" ' +
|
|
11666
11819
|
'dir-fn="fn()"></div>',
|
|
11667
11820
|
)($rootScope);
|
|
11821
|
+
$rootScope.$digest();
|
|
11668
11822
|
expect(controllerCalled).toBe(true);
|
|
11669
11823
|
const childScope = $rootScope.$$childHead;
|
|
11670
11824
|
expect(childScope).not.toBe($rootScope);
|
|
@@ -11724,6 +11878,7 @@ describe("$compile", () => {
|
|
|
11724
11878
|
'dir-str="Hello, {{whom}}!" ' +
|
|
11725
11879
|
'dir-fn="fn()"></div>',
|
|
11726
11880
|
)($rootScope);
|
|
11881
|
+
$rootScope.$digest();
|
|
11727
11882
|
expect(controllerCalled).toBe(true);
|
|
11728
11883
|
const childScope = $rootScope.$$childHead;
|
|
11729
11884
|
expect(childScope).not.toBe($rootScope);
|
|
@@ -11759,6 +11914,7 @@ describe("$compile", () => {
|
|
|
11759
11914
|
const scope = $rootScope.$$childHead;
|
|
11760
11915
|
expect(scope.ctrl.getProp()).toBe("default");
|
|
11761
11916
|
|
|
11917
|
+
$rootScope.$digest();
|
|
11762
11918
|
expect(scope.ctrl.getProp()).toBe("default");
|
|
11763
11919
|
});
|
|
11764
11920
|
|
|
@@ -11788,6 +11944,7 @@ describe("$compile", () => {
|
|
|
11788
11944
|
const scope = $rootScope.$$childHead;
|
|
11789
11945
|
expect(scope.ctrl.getProp()).toBe("default");
|
|
11790
11946
|
|
|
11947
|
+
$rootScope.$digest();
|
|
11791
11948
|
expect(scope.ctrl.getProp()).toBe("default");
|
|
11792
11949
|
});
|
|
11793
11950
|
});
|
|
@@ -12056,6 +12213,7 @@ describe("$compile", () => {
|
|
|
12056
12213
|
initInjector("test1");
|
|
12057
12214
|
$templateCache.set("dirB.html", "<p>dirB</p>");
|
|
12058
12215
|
element = $compile("<div dir-a dir-b></div>")($rootScope);
|
|
12216
|
+
$rootScope.$digest();
|
|
12059
12217
|
expect(log[0]).toEqual("dirAController.name: dirA");
|
|
12060
12218
|
});
|
|
12061
12219
|
|
|
@@ -12375,6 +12533,7 @@ describe("$compile", () => {
|
|
|
12375
12533
|
element = element.children().eq(0);
|
|
12376
12534
|
expect(element[0].checked).toBe(false);
|
|
12377
12535
|
$rootScope.$$childHead.model = true;
|
|
12536
|
+
$rootScope.$digest();
|
|
12378
12537
|
expect(element[0].checked).toBe(true);
|
|
12379
12538
|
});
|
|
12380
12539
|
|
|
@@ -12402,6 +12561,7 @@ describe("$compile", () => {
|
|
|
12402
12561
|
expect(normalScope).toBe($rootScope);
|
|
12403
12562
|
expect(normalScope.name).toEqual(undefined);
|
|
12404
12563
|
expect(isolateScope.name).toEqual("WORKS");
|
|
12564
|
+
$rootScope.$digest();
|
|
12405
12565
|
expect(element.text()).toEqual("WORKS");
|
|
12406
12566
|
});
|
|
12407
12567
|
|
|
@@ -12460,6 +12620,7 @@ describe("$compile", () => {
|
|
|
12460
12620
|
"</div>",
|
|
12461
12621
|
)($rootScope);
|
|
12462
12622
|
|
|
12623
|
+
$rootScope.$digest();
|
|
12463
12624
|
expect(log.join("; ")).toEqual(
|
|
12464
12625
|
"inside=isolate; " +
|
|
12465
12626
|
"outside replaced=non-isolate; " + // outside
|
|
@@ -13163,6 +13324,8 @@ describe("$compile", () => {
|
|
|
13163
13324
|
const elem1 = $compile(tmplWithFoo)($rootScope);
|
|
13164
13325
|
const elem2 = $compile(tmplWithBar)($rootScope);
|
|
13165
13326
|
|
|
13327
|
+
$rootScope.$digest();
|
|
13328
|
+
|
|
13166
13329
|
expect(elem1.text()).toBe("[Hello, world!]");
|
|
13167
13330
|
expect(elem2.text()).toBe("[This is a header!|This is a footer!]");
|
|
13168
13331
|
|
|
@@ -13309,7 +13472,7 @@ describe("$compile", () => {
|
|
|
13309
13472
|
// module
|
|
13310
13473
|
// .controller("Leak", ($scope, $timeout) => {
|
|
13311
13474
|
// $scope.code = "red";
|
|
13312
|
-
//
|
|
13475
|
+
// $timeout(() => {
|
|
13313
13476
|
// $scope.code = "blue";
|
|
13314
13477
|
// });
|
|
13315
13478
|
// })
|
|
@@ -13337,7 +13500,7 @@ describe("$compile", () => {
|
|
|
13337
13500
|
// "</div>",
|
|
13338
13501
|
// );
|
|
13339
13502
|
// element = template($rootScope, function () {});
|
|
13340
|
-
// ;
|
|
13503
|
+
// $rootScope.$digest();
|
|
13341
13504
|
|
|
13342
13505
|
// expect(linkFn).toHaveBeenCalled();
|
|
13343
13506
|
// expect(CACHE.size).toEqual(cacheSize + 2);
|
|
@@ -13346,7 +13509,7 @@ describe("$compile", () => {
|
|
|
13346
13509
|
// const destroyedScope = $rootScope.$new();
|
|
13347
13510
|
// destroyedScope.$destroy();
|
|
13348
13511
|
// const clone = template(destroyedScope, () => {});
|
|
13349
|
-
// ;
|
|
13512
|
+
// $rootScope.$digest();
|
|
13350
13513
|
// // expect(linkFn).not.toHaveBeenCalled();
|
|
13351
13514
|
// // clone.remove();
|
|
13352
13515
|
// });
|
|
@@ -14244,6 +14407,7 @@ describe("$compile", () => {
|
|
|
14244
14407
|
element = $compile("<div sync-sync>transcluded content</div>")(
|
|
14245
14408
|
$rootScope,
|
|
14246
14409
|
);
|
|
14410
|
+
$rootScope.$digest();
|
|
14247
14411
|
expect(element.text()).toEqual("transcluded content");
|
|
14248
14412
|
});
|
|
14249
14413
|
|
|
@@ -14251,6 +14415,7 @@ describe("$compile", () => {
|
|
|
14251
14415
|
element = $compile("<div sync-async>transcluded content</div>")(
|
|
14252
14416
|
$rootScope,
|
|
14253
14417
|
);
|
|
14418
|
+
$rootScope.$digest();
|
|
14254
14419
|
expect(element.text()).toEqual("transcluded content");
|
|
14255
14420
|
});
|
|
14256
14421
|
|
|
@@ -14258,6 +14423,7 @@ describe("$compile", () => {
|
|
|
14258
14423
|
element = $compile("<div async-sync>transcluded content</div>")(
|
|
14259
14424
|
$rootScope,
|
|
14260
14425
|
);
|
|
14426
|
+
$rootScope.$digest();
|
|
14261
14427
|
expect(element.text()).toEqual("transcluded content");
|
|
14262
14428
|
});
|
|
14263
14429
|
|
|
@@ -14265,6 +14431,7 @@ describe("$compile", () => {
|
|
|
14265
14431
|
element = $compile("<div async-async>transcluded content</div>")(
|
|
14266
14432
|
$rootScope,
|
|
14267
14433
|
);
|
|
14434
|
+
$rootScope.$digest();
|
|
14268
14435
|
expect(element.text()).toEqual("transcluded content");
|
|
14269
14436
|
});
|
|
14270
14437
|
|
|
@@ -14350,6 +14517,7 @@ describe("$compile", () => {
|
|
|
14350
14517
|
element = $compile('<iso><span ng-bind="val"></span></iso>')(
|
|
14351
14518
|
$rootScope,
|
|
14352
14519
|
);
|
|
14520
|
+
$rootScope.$digest();
|
|
14353
14521
|
expect(element.text()).toEqual("transcluded content");
|
|
14354
14522
|
});
|
|
14355
14523
|
|
|
@@ -14358,6 +14526,7 @@ describe("$compile", () => {
|
|
|
14358
14526
|
element = $compile(
|
|
14359
14527
|
'<iso-async1><span ng-bind="val"></span></iso-async1>',
|
|
14360
14528
|
)($rootScope);
|
|
14529
|
+
$rootScope.$digest();
|
|
14361
14530
|
expect(element.text()).toEqual("transcluded content");
|
|
14362
14531
|
});
|
|
14363
14532
|
|
|
@@ -14366,6 +14535,7 @@ describe("$compile", () => {
|
|
|
14366
14535
|
element = $compile(
|
|
14367
14536
|
'<iso-async2><span ng-bind="val"></span></iso-async2>',
|
|
14368
14537
|
)($rootScope);
|
|
14538
|
+
$rootScope.$digest();
|
|
14369
14539
|
expect(element.text()).toEqual("transcluded content");
|
|
14370
14540
|
});
|
|
14371
14541
|
});
|
|
@@ -14392,10 +14562,12 @@ describe("$compile", () => {
|
|
|
14392
14562
|
|
|
14393
14563
|
initInjector("test1");
|
|
14394
14564
|
let element = $compile("<div my-example></div>")($rootScope);
|
|
14565
|
+
$rootScope.$digest();
|
|
14395
14566
|
expect(element.text()).toEqual("myExample 0!");
|
|
14396
14567
|
dealoc(element);
|
|
14397
14568
|
|
|
14398
14569
|
element = $compile("<div my-example><p></p></div>")($rootScope);
|
|
14570
|
+
$rootScope.$digest();
|
|
14399
14571
|
expect(element.text()).toEqual("myExample 1!has children");
|
|
14400
14572
|
dealoc(element);
|
|
14401
14573
|
});
|
|
@@ -14522,6 +14694,7 @@ describe("$compile", () => {
|
|
|
14522
14694
|
$templateCache.set("template.html", "<p second>template.html</p>");
|
|
14523
14695
|
expect(() => {
|
|
14524
14696
|
$compile("<div template first></div>");
|
|
14697
|
+
$rootScope.$digest();
|
|
14525
14698
|
}).toThrowError(/multidir/);
|
|
14526
14699
|
});
|
|
14527
14700
|
|
|
@@ -14747,6 +14920,7 @@ describe("$compile", () => {
|
|
|
14747
14920
|
initInjector("test1");
|
|
14748
14921
|
$templateCache.set("template.html", "<div transclude></div>");
|
|
14749
14922
|
element = $compile("<div template></div>")($rootScope);
|
|
14923
|
+
$rootScope.$digest();
|
|
14750
14924
|
expect(transclude).toBeDefined();
|
|
14751
14925
|
});
|
|
14752
14926
|
|
|
@@ -14787,6 +14961,7 @@ describe("$compile", () => {
|
|
|
14787
14961
|
element = $compile("<div><div outer><div inner></div></div></div>")(
|
|
14788
14962
|
$rootScope,
|
|
14789
14963
|
);
|
|
14964
|
+
$rootScope.$digest();
|
|
14790
14965
|
const child = element.children();
|
|
14791
14966
|
|
|
14792
14967
|
expect(log).toEqual(["outer:div", "innerAgain:div", "inner:div"]);
|
|
@@ -14816,6 +14991,7 @@ describe("$compile", () => {
|
|
|
14816
14991
|
$rootScope,
|
|
14817
14992
|
);
|
|
14818
14993
|
$rootScope.bar = "bar";
|
|
14994
|
+
$rootScope.$digest();
|
|
14819
14995
|
expect(element.text()).toBe("bar");
|
|
14820
14996
|
});
|
|
14821
14997
|
|
|
@@ -14831,6 +15007,7 @@ describe("$compile", () => {
|
|
|
14831
15007
|
element = $compile("<div><div foo=\"'foo'\" bar=\"'bar'\"></div></div>")(
|
|
14832
15008
|
$rootScope,
|
|
14833
15009
|
);
|
|
15010
|
+
$rootScope.$digest();
|
|
14834
15011
|
expect(element.text()).toBe("foobar");
|
|
14835
15012
|
});
|
|
14836
15013
|
|
|
@@ -14839,6 +15016,8 @@ describe("$compile", () => {
|
|
|
14839
15016
|
element = $compile(
|
|
14840
15017
|
"<ul><li ng-repeat=\"item in ['-->', 'x']\">{{item}}|</li></ul>",
|
|
14841
15018
|
)($rootScope);
|
|
15019
|
+
$rootScope.$digest();
|
|
15020
|
+
|
|
14842
15021
|
expect(element.text()).toBe("-->|x|");
|
|
14843
15022
|
});
|
|
14844
15023
|
|
|
@@ -14856,11 +15035,11 @@ describe("$compile", () => {
|
|
|
14856
15035
|
});
|
|
14857
15036
|
},
|
|
14858
15037
|
}))
|
|
14859
|
-
.directive("trans", () => ({
|
|
15038
|
+
.directive("trans", ($timeout) => ({
|
|
14860
15039
|
transclude: true,
|
|
14861
15040
|
link(scope, element, attrs, ctrl, transclude) {
|
|
14862
15041
|
// We use timeout here to simulate how ng-if works
|
|
14863
|
-
|
|
15042
|
+
$timeout(() => {
|
|
14864
15043
|
transclude((child) => {
|
|
14865
15044
|
element.append(child);
|
|
14866
15045
|
});
|
|
@@ -14982,6 +15161,8 @@ describe("$compile", () => {
|
|
|
14982
15161
|
initInjector("test1");
|
|
14983
15162
|
$templateCache.set("baz.html", "<div>Baz</div>");
|
|
14984
15163
|
element = $compile("<trans><inner></inner></trans>")($rootScope);
|
|
15164
|
+
$rootScope.$digest();
|
|
15165
|
+
|
|
14985
15166
|
expect(innerCompilationCount).toBe(0);
|
|
14986
15167
|
transclude((child) => {
|
|
14987
15168
|
element.append(child);
|
|
@@ -15101,6 +15282,8 @@ describe("$compile", () => {
|
|
|
15101
15282
|
initInjector("test1");
|
|
15102
15283
|
$templateCache.set("inner.html", "<inner></inner>");
|
|
15103
15284
|
element = $compile("<outer></outer>")($rootScope);
|
|
15285
|
+
$rootScope.$digest();
|
|
15286
|
+
|
|
15104
15287
|
expect(innerCompilationCount).toBe(1);
|
|
15105
15288
|
});
|
|
15106
15289
|
});
|
|
@@ -15450,6 +15633,7 @@ describe("$compile", () => {
|
|
|
15450
15633
|
it("should NOT require trusted values for trusted URIs", () => {
|
|
15451
15634
|
element = $compile(`<${tag} src="{{testUrl}}"></${tag}>`)($rootScope);
|
|
15452
15635
|
$rootScope.testUrl = "http://example.com/image.mp4"; // `http` is trusted
|
|
15636
|
+
$rootScope.$digest();
|
|
15453
15637
|
expect(element.attr("src")).toEqual("http://example.com/image.mp4");
|
|
15454
15638
|
});
|
|
15455
15639
|
|
|
@@ -15459,16 +15643,19 @@ describe("$compile", () => {
|
|
|
15459
15643
|
// Some browsers complain if you try to write `javascript:` into an `img[src]`
|
|
15460
15644
|
// So for the test use something different
|
|
15461
15645
|
$rootScope.testUrl = $sce.trustAsMediaUrl("untrusted:foo()");
|
|
15646
|
+
$rootScope.$digest();
|
|
15462
15647
|
expect(element.attr("src")).toEqual("untrusted:foo()");
|
|
15463
15648
|
|
|
15464
15649
|
// As a URL
|
|
15465
15650
|
element = $compile(`<${tag} src="{{testUrl}}"></${tag}>`)($rootScope);
|
|
15466
15651
|
$rootScope.testUrl = $sce.trustAsUrl("untrusted:foo()");
|
|
15652
|
+
$rootScope.$digest();
|
|
15467
15653
|
expect(element.attr("src")).toEqual("untrusted:foo()");
|
|
15468
15654
|
|
|
15469
15655
|
// As a RESOURCE URL
|
|
15470
15656
|
element = $compile(`<${tag} src="{{testUrl}}"></${tag}>`)($rootScope);
|
|
15471
15657
|
$rootScope.testUrl = $sce.trustAsResourceUrl("untrusted:foo()");
|
|
15658
|
+
$rootScope.$digest();
|
|
15472
15659
|
expect(element.attr("src")).toEqual("untrusted:foo()");
|
|
15473
15660
|
});
|
|
15474
15661
|
});
|
|
@@ -15481,6 +15668,7 @@ describe("$compile", () => {
|
|
|
15481
15668
|
`<video><${tag} src="{{testUrl}}"></${tag}></video>`,
|
|
15482
15669
|
)($rootScope);
|
|
15483
15670
|
$rootScope.testUrl = "http://example.com/image.mp4"; // `http` is trusted
|
|
15671
|
+
$rootScope.$digest();
|
|
15484
15672
|
expect(element.find(tag).attr("src")).toEqual(
|
|
15485
15673
|
"http://example.com/image.mp4",
|
|
15486
15674
|
);
|
|
@@ -15492,6 +15680,7 @@ describe("$compile", () => {
|
|
|
15492
15680
|
`<video><${tag} src="{{testUrl}}"></${tag}></video>`,
|
|
15493
15681
|
)($rootScope);
|
|
15494
15682
|
$rootScope.testUrl = $sce.trustAsMediaUrl("javascript:foo()");
|
|
15683
|
+
$rootScope.$digest();
|
|
15495
15684
|
expect(element.find(tag).attr("src")).toEqual("javascript:foo()");
|
|
15496
15685
|
|
|
15497
15686
|
// As a URL
|
|
@@ -15499,6 +15688,7 @@ describe("$compile", () => {
|
|
|
15499
15688
|
`<video><${tag} src="{{testUrl}}"></${tag}></video>`,
|
|
15500
15689
|
)($rootScope);
|
|
15501
15690
|
$rootScope.testUrl = $sce.trustAsUrl("javascript:foo()");
|
|
15691
|
+
$rootScope.$digest();
|
|
15502
15692
|
expect(element.find(tag).attr("src")).toEqual("javascript:foo()");
|
|
15503
15693
|
|
|
15504
15694
|
// As a RESOURCE URL
|
|
@@ -15506,6 +15696,7 @@ describe("$compile", () => {
|
|
|
15506
15696
|
`<video><${tag} src="{{testUrl}}"></${tag}></video>`,
|
|
15507
15697
|
)($rootScope);
|
|
15508
15698
|
$rootScope.testUrl = $sce.trustAsResourceUrl("javascript:foo()");
|
|
15699
|
+
$rootScope.$digest();
|
|
15509
15700
|
expect(element.find(tag).attr("src")).toEqual("javascript:foo()");
|
|
15510
15701
|
});
|
|
15511
15702
|
});
|
|
@@ -15517,22 +15708,26 @@ describe("$compile", () => {
|
|
|
15517
15708
|
// Some browsers complain if you try to write `javascript:` into an `img[src]`
|
|
15518
15709
|
// So for the test use something different
|
|
15519
15710
|
$rootScope.testUrl = $sce.trustAsMediaUrl("someUntrustedThing:foo();");
|
|
15711
|
+
$rootScope.$digest();
|
|
15520
15712
|
expect(element.attr("src")).toEqual("someUntrustedThing:foo();");
|
|
15521
15713
|
});
|
|
15522
15714
|
|
|
15523
15715
|
it("should sanitize concatenated values even if they are trusted", () => {
|
|
15524
15716
|
element = $compile('<img src="{{testUrl}}ponies"></img>')($rootScope);
|
|
15525
15717
|
$rootScope.testUrl = $sce.trustAsUrl("untrusted:foo();");
|
|
15718
|
+
$rootScope.$digest();
|
|
15526
15719
|
expect(element.attr("src")).toEqual("unsafe:untrusted:foo();ponies");
|
|
15527
15720
|
|
|
15528
15721
|
element = $compile('<img src="http://{{testUrl2}}"></img>')($rootScope);
|
|
15529
15722
|
$rootScope.testUrl2 = $sce.trustAsUrl("xyz;");
|
|
15723
|
+
$rootScope.$digest();
|
|
15530
15724
|
expect(element.attr("src")).toEqual("http://xyz;");
|
|
15531
15725
|
|
|
15532
15726
|
element = $compile('<img src="{{testUrl3}}{{testUrl3}}"></img>')(
|
|
15533
15727
|
$rootScope,
|
|
15534
15728
|
);
|
|
15535
15729
|
$rootScope.testUrl3 = $sce.trustAsUrl("untrusted:foo();");
|
|
15730
|
+
$rootScope.$digest();
|
|
15536
15731
|
expect(element.attr("src")).toEqual(
|
|
15537
15732
|
"unsafe:untrusted:foo();untrusted:foo();",
|
|
15538
15733
|
);
|
|
@@ -15569,10 +15764,12 @@ describe("$compile", () => {
|
|
|
15569
15764
|
|
|
15570
15765
|
element = $compile('<img src="{{testUrl}}ponies"></img>')($rootScope);
|
|
15571
15766
|
$rootScope.testUrl = $sce.trustAsUrl("javascript:foo();");
|
|
15767
|
+
$rootScope.$digest();
|
|
15572
15768
|
expect(element.attr("src")).toEqual("someSanitizedUrl");
|
|
15573
15769
|
|
|
15574
15770
|
element = $compile('<img src="http://{{testUrl}}"></img>')($rootScope);
|
|
15575
15771
|
$rootScope.testUrl = $sce.trustAsUrl("xyz");
|
|
15772
|
+
$rootScope.$digest();
|
|
15576
15773
|
expect(element.attr("src")).toEqual("someSanitizedUrl");
|
|
15577
15774
|
});
|
|
15578
15775
|
|
|
@@ -15615,12 +15812,14 @@ describe("$compile", () => {
|
|
|
15615
15812
|
it("should NOT require trusted values for trusted URI values", () => {
|
|
15616
15813
|
element = $compile('<img srcset="{{testUrl}}"></img>')($rootScope);
|
|
15617
15814
|
$rootScope.testUrl = "http://example.com/image.png"; // `http` is trusted
|
|
15815
|
+
$rootScope.$digest();
|
|
15618
15816
|
expect(element.attr("srcset")).toEqual("http://example.com/image.png");
|
|
15619
15817
|
});
|
|
15620
15818
|
|
|
15621
15819
|
it("should accept trusted values, if they are also trusted URIs", () => {
|
|
15622
15820
|
element = $compile('<img srcset="{{testUrl}}"></img>')($rootScope);
|
|
15623
15821
|
$rootScope.testUrl = $sce.trustAsUrl("http://example.com");
|
|
15822
|
+
$rootScope.$digest();
|
|
15624
15823
|
expect(element.attr("srcset")).toEqual("http://example.com");
|
|
15625
15824
|
});
|
|
15626
15825
|
|
|
@@ -15629,12 +15828,14 @@ describe("$compile", () => {
|
|
|
15629
15828
|
// Use trustAsHtml and ng-bind-html to work around this.
|
|
15630
15829
|
element = $compile('<img srcset="{{testUrl}}"></img>')($rootScope);
|
|
15631
15830
|
$rootScope.testUrl = $sce.trustAsUrl("javascript:something");
|
|
15831
|
+
$rootScope.$digest();
|
|
15632
15832
|
expect(element.attr("srcset")).toEqual("unsafe:javascript:something");
|
|
15633
15833
|
|
|
15634
15834
|
element = $compile('<img srcset="{{testUrl}},{{testUrl}}"></img>')(
|
|
15635
15835
|
$rootScope,
|
|
15636
15836
|
);
|
|
15637
15837
|
$rootScope.testUrl = $sce.trustAsUrl("javascript:something");
|
|
15838
|
+
$rootScope.$digest();
|
|
15638
15839
|
expect(element.attr("srcset")).toEqual(
|
|
15639
15840
|
"unsafe:javascript:something ,unsafe:javascript:something",
|
|
15640
15841
|
);
|
|
@@ -15719,6 +15920,7 @@ describe("$compile", () => {
|
|
|
15719
15920
|
|
|
15720
15921
|
Object.entries(testSet).forEach(([url, ref]) => {
|
|
15721
15922
|
$rootScope.testUrl = url;
|
|
15923
|
+
$rootScope.$digest();
|
|
15722
15924
|
expect(element.attr("srcset")).toEqual(ref);
|
|
15723
15925
|
});
|
|
15724
15926
|
});
|
|
@@ -15728,27 +15930,33 @@ describe("$compile", () => {
|
|
|
15728
15930
|
it("should NOT require trusted values for trusted URI values", () => {
|
|
15729
15931
|
$rootScope.testUrl = "http://example.com/image.png"; // `http` is trusted
|
|
15730
15932
|
element = $compile('<a href="{{testUrl}}"></a>')($rootScope);
|
|
15933
|
+
$rootScope.$digest();
|
|
15731
15934
|
expect(element.attr("href")).toEqual("http://example.com/image.png");
|
|
15732
15935
|
|
|
15733
15936
|
element = $compile('<a ng-href="{{testUrl}}"></a>')($rootScope);
|
|
15937
|
+
$rootScope.$digest();
|
|
15734
15938
|
expect(element.attr("ng-href")).toEqual("http://example.com/image.png");
|
|
15735
15939
|
});
|
|
15736
15940
|
|
|
15737
15941
|
it("should accept trusted values for non-trusted URI values", () => {
|
|
15738
15942
|
$rootScope.testUrl = $sce.trustAsUrl("javascript:foo()"); // `javascript` is not trusted
|
|
15739
15943
|
element = $compile('<a href="{{testUrl}}"></a>')($rootScope);
|
|
15944
|
+
$rootScope.$digest();
|
|
15740
15945
|
expect(element.attr("href")).toEqual("javascript:foo()");
|
|
15741
15946
|
|
|
15742
15947
|
element = $compile('<a ng-href="{{testUrl}}"></a>')($rootScope);
|
|
15948
|
+
$rootScope.$digest();
|
|
15743
15949
|
expect(element.attr("ng-href")).toEqual("javascript:foo()");
|
|
15744
15950
|
});
|
|
15745
15951
|
|
|
15746
15952
|
it("should sanitize non-trusted values", () => {
|
|
15747
15953
|
$rootScope.testUrl = "javascript:foo()"; // `javascript` is not trusted
|
|
15748
15954
|
element = $compile('<a href="{{testUrl}}"></a>')($rootScope);
|
|
15955
|
+
$rootScope.$digest();
|
|
15749
15956
|
expect(element.attr("href")).toEqual("unsafe:javascript:foo()");
|
|
15750
15957
|
|
|
15751
15958
|
element = $compile('<a ng-href="{{testUrl}}"></a>')($rootScope);
|
|
15959
|
+
$rootScope.$digest();
|
|
15752
15960
|
expect(element.attr("href")).toEqual("unsafe:javascript:foo()");
|
|
15753
15961
|
});
|
|
15754
15962
|
|
|
@@ -15872,9 +16080,16 @@ describe("$compile", () => {
|
|
|
15872
16080
|
'<foo href="http://example.com/{{testUrl}}"></foo><foo href="http://example.com/{{::testUrl}}"></foo>',
|
|
15873
16081
|
)($rootScope);
|
|
15874
16082
|
$rootScope.testUrl = [1];
|
|
16083
|
+
$rootScope.$digest();
|
|
16084
|
+
|
|
15875
16085
|
$rootScope.testUrl = [];
|
|
16086
|
+
$rootScope.$digest();
|
|
16087
|
+
|
|
15876
16088
|
$rootScope.testUrl = { a: "b" };
|
|
16089
|
+
$rootScope.$digest();
|
|
16090
|
+
|
|
15877
16091
|
$rootScope.testUrl = {};
|
|
16092
|
+
$rootScope.$digest();
|
|
15878
16093
|
expect(true).toBeTrue();
|
|
15879
16094
|
});
|
|
15880
16095
|
});
|
|
@@ -16107,6 +16322,7 @@ describe("$compile", () => {
|
|
|
16107
16322
|
$rootScope.name = "Misko";
|
|
16108
16323
|
element = $compile('<span ng-attr-test="{{name}}"></span>')($rootScope);
|
|
16109
16324
|
expect(element.attr("test")).toBeUndefined();
|
|
16325
|
+
$rootScope.$digest();
|
|
16110
16326
|
expect(element.attr("test")).toBe("Misko");
|
|
16111
16327
|
});
|
|
16112
16328
|
|
|
@@ -16116,6 +16332,7 @@ describe("$compile", () => {
|
|
|
16116
16332
|
$rootScope,
|
|
16117
16333
|
);
|
|
16118
16334
|
expect(element.attr("test")).toBe("123");
|
|
16335
|
+
$rootScope.$digest();
|
|
16119
16336
|
expect(element.attr("test")).toBe("Misko");
|
|
16120
16337
|
});
|
|
16121
16338
|
|
|
@@ -16125,6 +16342,7 @@ describe("$compile", () => {
|
|
|
16125
16342
|
$rootScope,
|
|
16126
16343
|
);
|
|
16127
16344
|
expect(element.attr("test")).toBe("123");
|
|
16345
|
+
$rootScope.$digest();
|
|
16128
16346
|
expect(element.attr("test")).toBe("Misko");
|
|
16129
16347
|
});
|
|
16130
16348
|
|
|
@@ -16132,6 +16350,7 @@ describe("$compile", () => {
|
|
|
16132
16350
|
element = $compile('<span ng-attr-test="foo"></span>')($rootScope);
|
|
16133
16351
|
expect(element.attr("test")).toBeUndefined();
|
|
16134
16352
|
|
|
16353
|
+
$rootScope.$digest();
|
|
16135
16354
|
expect(element.attr("test")).toBe("foo");
|
|
16136
16355
|
});
|
|
16137
16356
|
|
|
@@ -16139,10 +16358,13 @@ describe("$compile", () => {
|
|
|
16139
16358
|
element = $compile('<span ng-attr-test="{{name}}{{emphasis}}"></span>')(
|
|
16140
16359
|
$rootScope,
|
|
16141
16360
|
);
|
|
16361
|
+
$rootScope.$digest();
|
|
16142
16362
|
expect(element.attr("test")).toBeUndefined();
|
|
16143
16363
|
$rootScope.name = "caitp";
|
|
16364
|
+
$rootScope.$digest();
|
|
16144
16365
|
expect(element.attr("test")).toBeUndefined();
|
|
16145
16366
|
$rootScope.emphasis = "!!!";
|
|
16367
|
+
$rootScope.$digest();
|
|
16146
16368
|
expect(element.attr("test")).toBe("caitp!!!");
|
|
16147
16369
|
});
|
|
16148
16370
|
|
|
@@ -16198,6 +16420,7 @@ describe("$compile", () => {
|
|
|
16198
16420
|
'<div async-test test="123" ng-attr-test="{{test}}"></div>',
|
|
16199
16421
|
)($rootScope);
|
|
16200
16422
|
expect(element.attr("test")).toBe("123");
|
|
16423
|
+
$rootScope.$digest();
|
|
16201
16424
|
expect(log).toEqual(["TEST", "TEST"]);
|
|
16202
16425
|
});
|
|
16203
16426
|
|
|
@@ -16207,6 +16430,7 @@ describe("$compile", () => {
|
|
|
16207
16430
|
'<div async-test ng-attr-test="{{test}}" test="123"></div>',
|
|
16208
16431
|
)($rootScope);
|
|
16209
16432
|
expect(element.attr("test")).toBe("123");
|
|
16433
|
+
$rootScope.$digest();
|
|
16210
16434
|
expect(log).toEqual(["TEST", "TEST"]);
|
|
16211
16435
|
});
|
|
16212
16436
|
});
|
|
@@ -16219,6 +16443,7 @@ describe("$compile", () => {
|
|
|
16219
16443
|
expect(element.attr("test")).toBeUndefined();
|
|
16220
16444
|
expect(element.attr("test2")).toBeUndefined();
|
|
16221
16445
|
expect(element.attr("test3")).toBeUndefined();
|
|
16446
|
+
$rootScope.$digest();
|
|
16222
16447
|
expect(element.attr("test")).toBe("Misko");
|
|
16223
16448
|
expect(element.attr("test2")).toBe("Misko");
|
|
16224
16449
|
expect(element.attr("test3")).toBe("Misko");
|
|
@@ -16263,6 +16488,7 @@ describe("$compile", () => {
|
|
|
16263
16488
|
it('should work with the "href" attribute', () => {
|
|
16264
16489
|
$rootScope.value = "test";
|
|
16265
16490
|
element = $compile('<a ng-attr-href="test/{{value}}"></a>')($rootScope);
|
|
16491
|
+
$rootScope.$digest();
|
|
16266
16492
|
expect(element.attr("href")).toBe("test/test");
|
|
16267
16493
|
});
|
|
16268
16494
|
|
|
@@ -16277,6 +16503,7 @@ describe("$compile", () => {
|
|
|
16277
16503
|
expect(element.attr("test4")).toBeUndefined();
|
|
16278
16504
|
expect(element.attr("test5")).toBeUndefined();
|
|
16279
16505
|
expect(element.attr("test6")).toBeUndefined();
|
|
16506
|
+
$rootScope.$digest();
|
|
16280
16507
|
expect(element.attr("test2")).toBe("Misko");
|
|
16281
16508
|
expect(element.attr("test3")).toBe("Misko");
|
|
16282
16509
|
expect(element.attr("test4")).toBe("Misko");
|
|
@@ -16290,9 +16517,11 @@ describe("$compile", () => {
|
|
|
16290
16517
|
element = $compile('<img ng-attr-src="{{name}}">')($rootScope);
|
|
16291
16518
|
expect(element.attr("src")).toBeUndefined();
|
|
16292
16519
|
|
|
16520
|
+
$rootScope.$digest();
|
|
16293
16521
|
expect(element.attr("src")).toBe("some-image.png");
|
|
16294
16522
|
|
|
16295
16523
|
$rootScope.name = "other-image.png";
|
|
16524
|
+
$rootScope.$digest();
|
|
16296
16525
|
expect(element.attr("src")).toBe("other-image.png");
|
|
16297
16526
|
});
|
|
16298
16527
|
|
|
@@ -16301,9 +16530,11 @@ describe("$compile", () => {
|
|
|
16301
16530
|
element = $compile('<img ng-attr-data-src="{{name}}">')($rootScope);
|
|
16302
16531
|
expect(element.attr("data-src")).toBeUndefined();
|
|
16303
16532
|
|
|
16533
|
+
$rootScope.$digest();
|
|
16304
16534
|
expect(element.attr("data-src")).toBe("some-image.png");
|
|
16305
16535
|
|
|
16306
16536
|
$rootScope.name = "other-image.png";
|
|
16537
|
+
$rootScope.$digest();
|
|
16307
16538
|
expect(element.attr("data-src")).toBe("other-image.png");
|
|
16308
16539
|
});
|
|
16309
16540
|
|
|
@@ -16314,10 +16545,12 @@ describe("$compile", () => {
|
|
|
16314
16545
|
)($rootScope);
|
|
16315
16546
|
expect(element.attr("data-src")).toBeUndefined();
|
|
16316
16547
|
|
|
16548
|
+
$rootScope.$digest();
|
|
16317
16549
|
expect(element.attr("src")).toBe("constant.png");
|
|
16318
16550
|
expect(element.attr("data-src")).toBe("some-image.png");
|
|
16319
16551
|
|
|
16320
16552
|
$rootScope.name = "other-image.png";
|
|
16553
|
+
$rootScope.$digest();
|
|
16321
16554
|
expect(element.attr("src")).toBe("constant.png");
|
|
16322
16555
|
expect(element.attr("data-src")).toBe("other-image.png");
|
|
16323
16556
|
});
|
|
@@ -16332,6 +16565,7 @@ describe("$compile", () => {
|
|
|
16332
16565
|
expect(element.attr("dash-test")).toBeUndefined();
|
|
16333
16566
|
expect(element.attr("dash-test2")).toBeUndefined();
|
|
16334
16567
|
expect(element.attr("dash-test3")).toBeUndefined();
|
|
16568
|
+
$rootScope.$digest();
|
|
16335
16569
|
expect(element.attr("dash-test")).toBe("JamieMason");
|
|
16336
16570
|
expect(element.attr("dash-test2")).toBe("JamieMason");
|
|
16337
16571
|
expect(element.attr("dash-test3")).toBe("JamieMason");
|
|
@@ -16345,6 +16579,7 @@ describe("$compile", () => {
|
|
|
16345
16579
|
expect(element.attr("dash-test2")).toBeUndefined();
|
|
16346
16580
|
expect(element.attr("dash-test3")).toBeUndefined();
|
|
16347
16581
|
expect(element.attr("dash-test4")).toBeUndefined();
|
|
16582
|
+
$rootScope.$digest();
|
|
16348
16583
|
expect(element.attr("dash-test2")).toBe("JamieMason");
|
|
16349
16584
|
expect(element.attr("dash-test3")).toBe("JamieMason");
|
|
16350
16585
|
expect(element.attr("dash-test4")).toBe("JamieMason");
|
|
@@ -16360,6 +16595,7 @@ describe("$compile", () => {
|
|
|
16360
16595
|
$compile(
|
|
16361
16596
|
'<span data-dash-starter data-on-dash-start="starter"></span>',
|
|
16362
16597
|
)($rootScope);
|
|
16598
|
+
$rootScope.$digest();
|
|
16363
16599
|
expect(log[0]).toEqual("starter");
|
|
16364
16600
|
});
|
|
16365
16601
|
|
|
@@ -16373,6 +16609,7 @@ describe("$compile", () => {
|
|
|
16373
16609
|
$compile('<span data-dash-ender data-on-dash-end="ender"></span>')(
|
|
16374
16610
|
$rootScope,
|
|
16375
16611
|
);
|
|
16612
|
+
$rootScope.$digest();
|
|
16376
16613
|
expect(log[0]).toEqual("ender");
|
|
16377
16614
|
});
|
|
16378
16615
|
});
|
|
@@ -16546,6 +16783,7 @@ describe("$compile", () => {
|
|
|
16546
16783
|
$rootScope,
|
|
16547
16784
|
);
|
|
16548
16785
|
expect(element.attr("view-box")).toBeUndefined();
|
|
16786
|
+
$rootScope.$digest();
|
|
16549
16787
|
expect(element.attr("view-box")).toBe("0 0 0 0");
|
|
16550
16788
|
});
|
|
16551
16789
|
|
|
@@ -16562,6 +16800,8 @@ describe("$compile", () => {
|
|
|
16562
16800
|
"</feSpecularLighting></filter></svg>",
|
|
16563
16801
|
)($rootScope);
|
|
16564
16802
|
expect(element.attr("viewBox")).toBeUndefined();
|
|
16803
|
+
$rootScope.$digest();
|
|
16804
|
+
|
|
16565
16805
|
expect(element.attr("view-box")).toBe("0 0 0 0");
|
|
16566
16806
|
expect(element.find("filter").attr("filter-units")).toBe("0.42");
|
|
16567
16807
|
expect(element.find("feDiffuseLighting").attr("surface-scale")).toBe("1");
|
|
@@ -16580,6 +16820,7 @@ describe("$compile", () => {
|
|
|
16580
16820
|
"<span ng-show-end='show'></span>" +
|
|
16581
16821
|
"</div>",
|
|
16582
16822
|
)($rootScope);
|
|
16823
|
+
$rootScope.$digest();
|
|
16583
16824
|
await wait(100);
|
|
16584
16825
|
const spans = element.find("span");
|
|
16585
16826
|
expect(spans.eq(0)[0].classList.contains("ng-hide")).toBeTrue();
|
|
@@ -16594,6 +16835,7 @@ describe("$compile", () => {
|
|
|
16594
16835
|
"<span ng-repeat-end>{{i}}B;</span>" +
|
|
16595
16836
|
"</div>",
|
|
16596
16837
|
)($rootScope);
|
|
16838
|
+
$rootScope.$digest();
|
|
16597
16839
|
expect(element.text()).toEqual("1A1B;2A2B;");
|
|
16598
16840
|
});
|
|
16599
16841
|
|
|
@@ -16606,6 +16848,7 @@ describe("$compile", () => {
|
|
|
16606
16848
|
"<span ng-repeat-end>{{i}}B;</span>" +
|
|
16607
16849
|
"</div>",
|
|
16608
16850
|
)($rootScope);
|
|
16851
|
+
$rootScope.$digest();
|
|
16609
16852
|
expect(element.text()).toEqual("1A:1B;2A:2B;");
|
|
16610
16853
|
});
|
|
16611
16854
|
|
|
@@ -16617,6 +16860,7 @@ describe("$compile", () => {
|
|
|
16617
16860
|
"<span ng-repeat-end>{{i}}B;</span>" +
|
|
16618
16861
|
"<div></div>",
|
|
16619
16862
|
)($rootScope);
|
|
16863
|
+
$rootScope.$digest();
|
|
16620
16864
|
element = JQLite(element[0].parentNode.childNodes); // reset because repeater is top level.
|
|
16621
16865
|
expect(element.text()).toEqual("1A1B;2A2B;");
|
|
16622
16866
|
});
|
|
@@ -16642,6 +16886,7 @@ describe("$compile", () => {
|
|
|
16642
16886
|
"<div ng-repeat-end>{{i}}B;</div>" +
|
|
16643
16887
|
"<div></div>",
|
|
16644
16888
|
)($rootScope);
|
|
16889
|
+
$rootScope.$digest();
|
|
16645
16890
|
element = JQLite(element[0].parentNode.childNodes); // reset because repeater is top level.
|
|
16646
16891
|
expect(element.text()).toEqual("1A..1B;2A..2B;");
|
|
16647
16892
|
});
|
|
@@ -16656,6 +16901,7 @@ describe("$compile", () => {
|
|
|
16656
16901
|
"<div ng-repeat-end>){{i}};</div>" +
|
|
16657
16902
|
"<div></div>",
|
|
16658
16903
|
)($rootScope);
|
|
16904
|
+
$rootScope.$digest();
|
|
16659
16905
|
element = JQLite(element[0].parentNode.childNodes); // reset because repeater is top level.
|
|
16660
16906
|
expect(element.text()).toEqual("1(2-23-3)1;2(2-23-3)2;");
|
|
16661
16907
|
});
|
|
@@ -16860,6 +17106,8 @@ describe("$compile", () => {
|
|
|
16860
17106
|
"</div>",
|
|
16861
17107
|
)($rootScope);
|
|
16862
17108
|
|
|
17109
|
+
$rootScope.$digest();
|
|
17110
|
+
|
|
16863
17111
|
expect(element.text()).toBe("XY");
|
|
16864
17112
|
///expect(angular.element(element[0].firstChild).data("x")).toBe("abc");
|
|
16865
17113
|
});
|
|
@@ -16886,6 +17134,7 @@ describe("$compile", () => {
|
|
|
16886
17134
|
"<span ng-show-end></span>" +
|
|
16887
17135
|
"</div>",
|
|
16888
17136
|
)($rootScope);
|
|
17137
|
+
$rootScope.$digest();
|
|
16889
17138
|
await wait(100);
|
|
16890
17139
|
const spans = element.find("span");
|
|
16891
17140
|
expect(spans.eq(0)[0].classList.contains("ng-hide")).toBeTrue();
|
|
@@ -16904,13 +17153,13 @@ describe("$compile", () => {
|
|
|
16904
17153
|
// const element = JQLite('<div class="{{val1}} {{val2}} fire"></div>');
|
|
16905
17154
|
// $compile(element)($rootScope);
|
|
16906
17155
|
|
|
16907
|
-
// ;
|
|
17156
|
+
// $rootScope.$digest();
|
|
16908
17157
|
|
|
16909
17158
|
// expect(element[0].classList.contains("fire")).toBe(true);
|
|
16910
17159
|
|
|
16911
17160
|
// $rootScope.val1 = "ice";
|
|
16912
17161
|
// $rootScope.val2 = "rice";
|
|
16913
|
-
// ;
|
|
17162
|
+
// $rootScope.$digest();
|
|
16914
17163
|
|
|
16915
17164
|
// data = $animate.queue.shift();
|
|
16916
17165
|
// expect(data.event).toBe("addClass");
|
|
@@ -16921,7 +17170,7 @@ describe("$compile", () => {
|
|
|
16921
17170
|
// expect(element[0].classList.contains("fire")).toBe(true);
|
|
16922
17171
|
|
|
16923
17172
|
// $rootScope.val2 = "dice";
|
|
16924
|
-
// ;
|
|
17173
|
+
// $rootScope.$digest();
|
|
16925
17174
|
|
|
16926
17175
|
// data = $animate.queue.shift();
|
|
16927
17176
|
// expect(data.event).toBe("addClass");
|
|
@@ -16937,7 +17186,7 @@ describe("$compile", () => {
|
|
|
16937
17186
|
|
|
16938
17187
|
// $rootScope.val1 = "";
|
|
16939
17188
|
// $rootScope.val2 = "";
|
|
16940
|
-
// ;
|
|
17189
|
+
// $rootScope.$digest();
|
|
16941
17190
|
|
|
16942
17191
|
// data = $animate.queue.shift();
|
|
16943
17192
|
// expect(data.event).toBe("removeClass");
|