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