@angular-wave/angular.ts 0.0.7 → 0.0.9
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 +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/docs/.cspell.yml +8 -0
- package/docs/.github/dependabot.yml +14 -0
- package/docs/.nvmrc +1 -0
- package/docs/CONTRIBUTING.md +28 -0
- package/docs/Dockerfile +4 -0
- package/docs/LICENSE +201 -0
- package/docs/README.md +184 -0
- package/docs/assets/scss/_variables_project.scss +6 -0
- package/docs/config.yaml +15 -0
- package/docs/content/en/_index.md +77 -0
- package/docs/content/en/about/featured-background.jpg +0 -0
- package/docs/content/en/about/index.md +35 -0
- package/docs/content/en/blog/_index.md +8 -0
- package/docs/content/en/blog/news/_index.md +4 -0
- package/docs/content/en/blog/news/first-post/featured-sunset-get.png +0 -0
- package/docs/content/en/blog/news/first-post/index.md +48 -0
- package/docs/content/en/blog/news/second-post.md +244 -0
- package/docs/content/en/blog/releases/_index.md +4 -0
- package/docs/content/en/blog/releases/in-depth-monoliths-detailed-spec.md +244 -0
- package/docs/content/en/community/_index.md +6 -0
- package/docs/content/en/docs/_index.md +29 -0
- package/docs/content/en/docs/concepts/_index.md +14 -0
- package/docs/content/en/docs/contribution-guidelines/_index.md +79 -0
- package/docs/content/en/docs/examples/_index.md +13 -0
- package/docs/content/en/docs/getting-started/_index.md +35 -0
- package/docs/content/en/docs/getting-started/example-page.md +240 -0
- package/docs/content/en/docs/overview/_index.md +36 -0
- package/docs/content/en/docs/reference/_index.md +12 -0
- package/docs/content/en/docs/reference/parameter-reference.md +211 -0
- package/docs/content/en/docs/tasks/Ponycopters/_index.md +12 -0
- package/docs/content/en/docs/tasks/Ponycopters/configuring-ponycopters.md +238 -0
- package/docs/content/en/docs/tasks/Ponycopters/launching-ponycopters.md +236 -0
- package/docs/content/en/docs/tasks/_index.md +21 -0
- package/docs/content/en/docs/tasks/beds.md +237 -0
- package/docs/content/en/docs/tasks/porridge.md +237 -0
- package/docs/content/en/docs/tasks/task.md +237 -0
- package/docs/content/en/docs/tutorials/_index.md +13 -0
- package/docs/content/en/docs/tutorials/multi-bear.md +236 -0
- package/docs/content/en/docs/tutorials/tutorial2.md +236 -0
- package/docs/content/en/featured-background.jpg +0 -0
- package/docs/content/en/search.md +4 -0
- package/docs/docker-compose.yaml +13 -0
- package/docs/docsy.work +5 -0
- package/docs/docsy.work.sum +0 -0
- package/docs/go.mod +5 -0
- package/docs/go.sum +6 -0
- package/docs/hugo-disabled.toml +221 -0
- package/docs/hugo.yaml +220 -0
- package/docs/layouts/404.html +7 -0
- package/docs/layouts/_default/_markup/render-heading.html +1 -0
- package/docs/netlify.toml +12 -0
- package/docs/package.json +42 -0
- package/package.json +1 -1
- package/rollup.config.js +2 -5
- package/src/core/compile.js +82 -269
- package/src/core/compile.md +51 -16
- package/src/core/filter.md +23 -17
- package/src/core/interval.md +73 -72
- package/src/core/sce.js +2 -13
- package/src/directive/if.js +2 -7
- package/src/directive/repeat.js +5 -346
- package/src/directive/repeat.md +358 -0
- package/src/directive/switch.js +2 -4
- package/src/exts/messages.js +2 -494
- package/src/exts/messages.md +550 -0
- package/src/injector.md +30 -1
- package/src/jqLite.js +11 -17
- package/src/loader.js +0 -4
- package/test/binding.spec.js +24 -24
- package/test/jqlite.spec.js +0 -56
- package/test/messages/messages.spec.js +3 -5
- package/test/module-test.html +5 -1
- package/test/ng/compile.spec.js +94 -371
- package/test/ng/directive/form.spec.js +8 -8
- package/test/ng/directive/repeat.spec.js +0 -37
- package/test/ng/directive/switch.spec.js +2 -9
- package/types/jqlite.d.ts +0 -78
- package/dist/angular-ts.cjs.js +0 -1
package/test/ng/compile.spec.js
CHANGED
|
@@ -89,7 +89,7 @@ describe("$compile", () => {
|
|
|
89
89
|
function registerDefaultDirectives() {
|
|
90
90
|
return registerDirectives({
|
|
91
91
|
log: () => ({
|
|
92
|
-
restrict: "
|
|
92
|
+
restrict: "A",
|
|
93
93
|
priority: 0,
|
|
94
94
|
compile: valueFn((scope, element, attrs) => {
|
|
95
95
|
log.push(attrs.log || "LOG");
|
|
@@ -97,7 +97,7 @@ describe("$compile", () => {
|
|
|
97
97
|
}),
|
|
98
98
|
|
|
99
99
|
highLog: () => ({
|
|
100
|
-
restrict: "
|
|
100
|
+
restrict: "A",
|
|
101
101
|
priority: 3,
|
|
102
102
|
compile: valueFn((scope, element, attrs) => {
|
|
103
103
|
log.push(attrs.highLog || "HIGH");
|
|
@@ -105,7 +105,7 @@ describe("$compile", () => {
|
|
|
105
105
|
}),
|
|
106
106
|
|
|
107
107
|
mediumLog: () => ({
|
|
108
|
-
restrict: "
|
|
108
|
+
restrict: "A",
|
|
109
109
|
priority: 2,
|
|
110
110
|
compile: valueFn((scope, element, attrs) => {
|
|
111
111
|
log.push(attrs.mediumLog || "MEDIUM");
|
|
@@ -113,7 +113,7 @@ describe("$compile", () => {
|
|
|
113
113
|
}),
|
|
114
114
|
|
|
115
115
|
greet: () => ({
|
|
116
|
-
restrict: "
|
|
116
|
+
restrict: "A",
|
|
117
117
|
priority: 10,
|
|
118
118
|
compile: valueFn((scope, element, attrs) => {
|
|
119
119
|
element.text(`Hello ${attrs.greet}`);
|
|
@@ -732,21 +732,12 @@ describe("$compile", () => {
|
|
|
732
732
|
expect(element.text()).toEqual("0hello2angular4");
|
|
733
733
|
});
|
|
734
734
|
|
|
735
|
-
it("should allow directives in classes", () => {
|
|
736
|
-
reloadModules();
|
|
737
|
-
element = $compile('<div class="greet: angular; log:123;"></div>')(
|
|
738
|
-
$rootScope,
|
|
739
|
-
);
|
|
740
|
-
expect(element.html()).toEqual("Hello angular");
|
|
741
|
-
expect(log[0]).toEqual("123");
|
|
742
|
-
});
|
|
743
|
-
|
|
744
735
|
it("should allow directives in SVG element classes", () => {
|
|
745
736
|
reloadModules();
|
|
746
737
|
if (!window.SVGElement) return;
|
|
747
|
-
element = $compile(
|
|
748
|
-
|
|
749
|
-
)
|
|
738
|
+
element = $compile('<svg><text greet="angular" log="123"></text></svg>')(
|
|
739
|
+
$rootScope,
|
|
740
|
+
);
|
|
750
741
|
const text = element.children().eq(0);
|
|
751
742
|
// In old Safari, SVG elements don't have innerHTML, so element.html() won't work
|
|
752
743
|
// (https://bugs.webkit.org/show_bug.cgi?id=136903)
|
|
@@ -769,7 +760,7 @@ describe("$compile", () => {
|
|
|
769
760
|
myModule.directive("log", ($rootScope, $injector) => {
|
|
770
761
|
injectableInjector = $injector;
|
|
771
762
|
return {
|
|
772
|
-
restrict: "
|
|
763
|
+
restrict: "A",
|
|
773
764
|
compile(element, templateAttr) {
|
|
774
765
|
expect(typeof templateAttr.$normalize).toBe("function");
|
|
775
766
|
expect(typeof templateAttr.$set).toBe("function");
|
|
@@ -791,7 +782,7 @@ describe("$compile", () => {
|
|
|
791
782
|
|
|
792
783
|
reloadModules();
|
|
793
784
|
element = $compile(
|
|
794
|
-
'<div
|
|
785
|
+
'<div log exp="abc" aa="A" x-Bb="B" daTa-cC="C">unlinked</div>',
|
|
795
786
|
)($rootScope);
|
|
796
787
|
|
|
797
788
|
expect(element.text()).toEqual("worked");
|
|
@@ -3585,7 +3576,7 @@ describe("$compile", () => {
|
|
|
3585
3576
|
|
|
3586
3577
|
$compile(el);
|
|
3587
3578
|
|
|
3588
|
-
expect(el[0].innerHTML).toEqual("
|
|
3579
|
+
expect(el[0].innerHTML).toEqual("<!---->");
|
|
3589
3580
|
});
|
|
3590
3581
|
|
|
3591
3582
|
it("includes directive attribute value in comment", () => {
|
|
@@ -3599,7 +3590,7 @@ describe("$compile", () => {
|
|
|
3599
3590
|
|
|
3600
3591
|
$compile(el);
|
|
3601
3592
|
|
|
3602
|
-
expect(el[0].innerHTML).toEqual("
|
|
3593
|
+
expect(el[0].innerHTML).toEqual("<!---->");
|
|
3603
3594
|
});
|
|
3604
3595
|
|
|
3605
3596
|
it("calls directive compile and link with comment", () => {
|
|
@@ -4550,50 +4541,6 @@ describe("$compile", () => {
|
|
|
4550
4541
|
expect($rootScope.valueOne).toBe(51);
|
|
4551
4542
|
expect($rootScope.valueTwo).toBe(51);
|
|
4552
4543
|
});
|
|
4553
|
-
|
|
4554
|
-
it("allows configuring $onChanges TTL", () => {
|
|
4555
|
-
let compileProvider;
|
|
4556
|
-
window.angular.module("myModule", [
|
|
4557
|
-
function ($compileProvider) {
|
|
4558
|
-
expect($compileProvider.onChangesTtl()).toBe(10);
|
|
4559
|
-
$compileProvider.onChangesTtl(50);
|
|
4560
|
-
compileProvider = $compileProvider;
|
|
4561
|
-
expect($compileProvider.onChangesTtl()).toBe(50);
|
|
4562
|
-
$compileProvider.component("myComponent", {
|
|
4563
|
-
bindings: {
|
|
4564
|
-
input: "<",
|
|
4565
|
-
increment: "=",
|
|
4566
|
-
},
|
|
4567
|
-
controller: function () {
|
|
4568
|
-
this.$onChanges = function () {
|
|
4569
|
-
if (this.increment) {
|
|
4570
|
-
this.increment = this.increment + 1;
|
|
4571
|
-
}
|
|
4572
|
-
};
|
|
4573
|
-
},
|
|
4574
|
-
});
|
|
4575
|
-
},
|
|
4576
|
-
]);
|
|
4577
|
-
reloadModules();
|
|
4578
|
-
var watchSpy = jasmine.createSpy();
|
|
4579
|
-
$rootScope.$watch(watchSpy);
|
|
4580
|
-
|
|
4581
|
-
var el = $(
|
|
4582
|
-
"<div>" +
|
|
4583
|
-
'<my-component input="valueOne" increment="valueTwo"></my-component>' +
|
|
4584
|
-
'<my-component input="valueTwo" increment="valueOne"></my-component>' +
|
|
4585
|
-
"</div>",
|
|
4586
|
-
);
|
|
4587
|
-
$compile(el)($rootScope);
|
|
4588
|
-
$rootScope.$apply();
|
|
4589
|
-
|
|
4590
|
-
$rootScope.valueOne = 42;
|
|
4591
|
-
$rootScope.valueTwo = 42;
|
|
4592
|
-
$rootScope.$apply();
|
|
4593
|
-
expect($rootScope.valueOne).toBe(91);
|
|
4594
|
-
expect($rootScope.valueTwo).toBe(91);
|
|
4595
|
-
compileProvider.onChangesTtl(10);
|
|
4596
|
-
});
|
|
4597
4544
|
});
|
|
4598
4545
|
|
|
4599
4546
|
describe("configuration", () => {
|
|
@@ -4663,43 +4610,9 @@ describe("$compile", () => {
|
|
|
4663
4610
|
]);
|
|
4664
4611
|
});
|
|
4665
4612
|
|
|
4666
|
-
it("should allow onChangesTtl to be configured", () => {
|
|
4667
|
-
createInjector([
|
|
4668
|
-
"ng",
|
|
4669
|
-
($compileProvider) => {
|
|
4670
|
-
expect($compileProvider.onChangesTtl()).toBe(10); // the default
|
|
4671
|
-
$compileProvider.onChangesTtl(2);
|
|
4672
|
-
expect($compileProvider.onChangesTtl()).toBe(2);
|
|
4673
|
-
$compileProvider.onChangesTtl(10);
|
|
4674
|
-
},
|
|
4675
|
-
]);
|
|
4676
|
-
});
|
|
4677
|
-
|
|
4678
|
-
it("should allow commentDirectivesEnabled to be configured", () => {
|
|
4679
|
-
createInjector([
|
|
4680
|
-
"ng",
|
|
4681
|
-
($compileProvider) => {
|
|
4682
|
-
expect($compileProvider.commentDirectivesEnabled()).toBe(true); // the default
|
|
4683
|
-
$compileProvider.commentDirectivesEnabled(false);
|
|
4684
|
-
expect($compileProvider.commentDirectivesEnabled()).toBe(false);
|
|
4685
|
-
},
|
|
4686
|
-
]);
|
|
4687
|
-
});
|
|
4688
|
-
|
|
4689
|
-
it("should allow cssClassDirectivesEnabled to be configured", () => {
|
|
4690
|
-
createInjector([
|
|
4691
|
-
"ng",
|
|
4692
|
-
($compileProvider) => {
|
|
4693
|
-
expect($compileProvider.cssClassDirectivesEnabled()).toBe(true); // the default
|
|
4694
|
-
$compileProvider.cssClassDirectivesEnabled(false);
|
|
4695
|
-
expect($compileProvider.cssClassDirectivesEnabled()).toBe(false);
|
|
4696
|
-
},
|
|
4697
|
-
]);
|
|
4698
|
-
});
|
|
4699
|
-
|
|
4700
4613
|
it("should register a directive", () => {
|
|
4701
4614
|
myModule.directive("div", () => ({
|
|
4702
|
-
restrict: "
|
|
4615
|
+
restrict: "EA",
|
|
4703
4616
|
link(scope, element) {
|
|
4704
4617
|
log = "OK";
|
|
4705
4618
|
element.text("SUCCESS");
|
|
@@ -4714,14 +4627,14 @@ describe("$compile", () => {
|
|
|
4714
4627
|
it("should allow registration of multiple directives with same name", () => {
|
|
4715
4628
|
myModule
|
|
4716
4629
|
.directive("div", () => ({
|
|
4717
|
-
restrict: "
|
|
4630
|
+
restrict: "EA",
|
|
4718
4631
|
link: {
|
|
4719
4632
|
pre: () => log.push("pre1"),
|
|
4720
4633
|
post: () => log.push("post1"),
|
|
4721
4634
|
},
|
|
4722
4635
|
}))
|
|
4723
4636
|
.directive("div", () => ({
|
|
4724
|
-
restrict: "
|
|
4637
|
+
restrict: "EA",
|
|
4725
4638
|
link: {
|
|
4726
4639
|
pre: () => log.push("pre2"),
|
|
4727
4640
|
post: () => log.push("post2"),
|
|
@@ -5272,7 +5185,7 @@ describe("$compile", () => {
|
|
|
5272
5185
|
reloadModules();
|
|
5273
5186
|
|
|
5274
5187
|
element = $compile(
|
|
5275
|
-
'<div high-log medium-stop log
|
|
5188
|
+
'<div high-log medium-stop log medium-log><a set="FAIL">OK</a></div>',
|
|
5276
5189
|
)($rootScope);
|
|
5277
5190
|
expect(element.text()).toEqual("OK");
|
|
5278
5191
|
expect(log).toEqual(["MEDIUM", "HIGH"]);
|
|
@@ -5334,7 +5247,7 @@ describe("$compile", () => {
|
|
|
5334
5247
|
.directive(
|
|
5335
5248
|
"replace",
|
|
5336
5249
|
valueFn({
|
|
5337
|
-
restrict: "
|
|
5250
|
+
restrict: "A",
|
|
5338
5251
|
replace: true,
|
|
5339
5252
|
template:
|
|
5340
5253
|
'<div class="log" style="width: 10px" high-log>Replace!</div>',
|
|
@@ -5347,7 +5260,7 @@ describe("$compile", () => {
|
|
|
5347
5260
|
.directive(
|
|
5348
5261
|
"nomerge",
|
|
5349
5262
|
valueFn({
|
|
5350
|
-
restrict: "
|
|
5263
|
+
restrict: "A",
|
|
5351
5264
|
replace: true,
|
|
5352
5265
|
template: '<div class="log" id="myid" high-log>No Merge!</div>',
|
|
5353
5266
|
compile(element, attr) {
|
|
@@ -5359,7 +5272,7 @@ describe("$compile", () => {
|
|
|
5359
5272
|
.directive(
|
|
5360
5273
|
"append",
|
|
5361
5274
|
valueFn({
|
|
5362
|
-
restrict: "
|
|
5275
|
+
restrict: "A",
|
|
5363
5276
|
template:
|
|
5364
5277
|
'<div class="log" style="width: 10px" high-log>Append!</div>',
|
|
5365
5278
|
compile(element, attr) {
|
|
@@ -5873,7 +5786,7 @@ describe("$compile", () => {
|
|
|
5873
5786
|
.directive(
|
|
5874
5787
|
"hello",
|
|
5875
5788
|
valueFn({
|
|
5876
|
-
restrict: "
|
|
5789
|
+
restrict: "A",
|
|
5877
5790
|
templateUrl: "mock/hello",
|
|
5878
5791
|
transclude: true,
|
|
5879
5792
|
}),
|
|
@@ -5881,7 +5794,7 @@ describe("$compile", () => {
|
|
|
5881
5794
|
.directive(
|
|
5882
5795
|
"401",
|
|
5883
5796
|
valueFn({
|
|
5884
|
-
restrict: "
|
|
5797
|
+
restrict: "A",
|
|
5885
5798
|
templateUrl: "mock/401",
|
|
5886
5799
|
transclude: true,
|
|
5887
5800
|
}),
|
|
@@ -5889,19 +5802,19 @@ describe("$compile", () => {
|
|
|
5889
5802
|
.directive(
|
|
5890
5803
|
"cau",
|
|
5891
5804
|
valueFn({
|
|
5892
|
-
restrict: "
|
|
5805
|
+
restrict: "A",
|
|
5893
5806
|
templateUrl: "mock/divexpr",
|
|
5894
5807
|
}),
|
|
5895
5808
|
)
|
|
5896
5809
|
.directive(
|
|
5897
5810
|
"crossDomainTemplate",
|
|
5898
5811
|
valueFn({
|
|
5899
|
-
restrict: "
|
|
5812
|
+
restrict: "A",
|
|
5900
5813
|
templateUrl: "http://example.com/should-not-load.html",
|
|
5901
5814
|
}),
|
|
5902
5815
|
)
|
|
5903
5816
|
.directive("trustedTemplate", () => ({
|
|
5904
|
-
restrict: "
|
|
5817
|
+
restrict: "A",
|
|
5905
5818
|
templateUrl() {
|
|
5906
5819
|
return $sce.trustAsResourceUrl("http://localhost:3000/hello");
|
|
5907
5820
|
},
|
|
@@ -5909,7 +5822,7 @@ describe("$compile", () => {
|
|
|
5909
5822
|
.directive(
|
|
5910
5823
|
"cError",
|
|
5911
5824
|
valueFn({
|
|
5912
|
-
restrict: "
|
|
5825
|
+
restrict: "A",
|
|
5913
5826
|
templateUrl: "mock/empty",
|
|
5914
5827
|
compile() {
|
|
5915
5828
|
throw new Error("cError");
|
|
@@ -5919,7 +5832,7 @@ describe("$compile", () => {
|
|
|
5919
5832
|
.directive(
|
|
5920
5833
|
"lError",
|
|
5921
5834
|
valueFn({
|
|
5922
|
-
restrict: "
|
|
5835
|
+
restrict: "A",
|
|
5923
5836
|
templateUrl: "mock/empty",
|
|
5924
5837
|
compile() {
|
|
5925
5838
|
throw new Error("lError");
|
|
@@ -5929,7 +5842,7 @@ describe("$compile", () => {
|
|
|
5929
5842
|
.directive(
|
|
5930
5843
|
"iHello",
|
|
5931
5844
|
valueFn({
|
|
5932
|
-
restrict: "
|
|
5845
|
+
restrict: "A",
|
|
5933
5846
|
replace: true,
|
|
5934
5847
|
templateUrl: "mock/div",
|
|
5935
5848
|
}),
|
|
@@ -5937,7 +5850,7 @@ describe("$compile", () => {
|
|
|
5937
5850
|
.directive(
|
|
5938
5851
|
"iCau",
|
|
5939
5852
|
valueFn({
|
|
5940
|
-
restrict: "
|
|
5853
|
+
restrict: "A",
|
|
5941
5854
|
replace: true,
|
|
5942
5855
|
templateUrl: "mock/divexpr",
|
|
5943
5856
|
}),
|
|
@@ -5945,7 +5858,7 @@ describe("$compile", () => {
|
|
|
5945
5858
|
.directive(
|
|
5946
5859
|
"iCError",
|
|
5947
5860
|
valueFn({
|
|
5948
|
-
restrict: "
|
|
5861
|
+
restrict: "A",
|
|
5949
5862
|
replace: true,
|
|
5950
5863
|
templateUrl: "error.html",
|
|
5951
5864
|
compile() {
|
|
@@ -5956,7 +5869,7 @@ describe("$compile", () => {
|
|
|
5956
5869
|
.directive(
|
|
5957
5870
|
"iLError",
|
|
5958
5871
|
valueFn({
|
|
5959
|
-
restrict: "
|
|
5872
|
+
restrict: "A",
|
|
5960
5873
|
replace: true,
|
|
5961
5874
|
templateUrl: "error.html",
|
|
5962
5875
|
compile() {
|
|
@@ -6040,7 +5953,7 @@ describe("$compile", () => {
|
|
|
6040
5953
|
|
|
6041
5954
|
it("should not load cross domain templates by default", () => {
|
|
6042
5955
|
expect(() => {
|
|
6043
|
-
$compile(
|
|
5956
|
+
$compile("<div cross-domain-template></div>")($rootScope);
|
|
6044
5957
|
}).toThrowError(/insecurl/);
|
|
6045
5958
|
});
|
|
6046
5959
|
|
|
@@ -6049,27 +5962,23 @@ describe("$compile", () => {
|
|
|
6049
5962
|
"http://example.com/should-not-load.html",
|
|
6050
5963
|
"<span>example.com/cached-version</span>",
|
|
6051
5964
|
);
|
|
6052
|
-
element = $compile(
|
|
6053
|
-
$rootScope,
|
|
6054
|
-
);
|
|
5965
|
+
element = $compile("<div cross-domain-template></div>")($rootScope);
|
|
6055
5966
|
expect(element[0].outerHTML).toEqual(
|
|
6056
|
-
'<div
|
|
5967
|
+
'<div cross-domain-template=""></div>',
|
|
6057
5968
|
);
|
|
6058
5969
|
$rootScope.$digest();
|
|
6059
5970
|
expect(element[0].outerHTML).toEqual(
|
|
6060
|
-
'<div
|
|
5971
|
+
'<div cross-domain-template=""><span>example.com/cached-version</span></div>',
|
|
6061
5972
|
);
|
|
6062
5973
|
});
|
|
6063
5974
|
|
|
6064
5975
|
it("should load cross domain templates when trusted", (done) => {
|
|
6065
|
-
element = $compile(
|
|
6066
|
-
expect(element[0].outerHTML).toEqual(
|
|
6067
|
-
'<div class="trustedTemplate"></div>',
|
|
6068
|
-
);
|
|
5976
|
+
element = $compile("<div trusted-template></div>")($rootScope);
|
|
5977
|
+
expect(element[0].outerHTML).toEqual('<div trusted-template=""></div>');
|
|
6069
5978
|
$rootScope.$digest();
|
|
6070
5979
|
setTimeout(() => {
|
|
6071
5980
|
expect(element[0].outerHTML).toEqual(
|
|
6072
|
-
'<div
|
|
5981
|
+
'<div trusted-template="">Hello</div>',
|
|
6073
5982
|
);
|
|
6074
5983
|
done();
|
|
6075
5984
|
}, 100);
|
|
@@ -6077,22 +5986,22 @@ describe("$compile", () => {
|
|
|
6077
5986
|
|
|
6078
5987
|
it("should append template via $http and cache it in $templateCache", (done) => {
|
|
6079
5988
|
$templateCache.put("mock/divexpr", "<span>Cau!</span>");
|
|
6080
|
-
element = $compile(
|
|
6081
|
-
|
|
6082
|
-
)
|
|
5989
|
+
element = $compile("<div><b hello>ignore</b><b cau>ignore</b></div>")(
|
|
5990
|
+
$rootScope,
|
|
5991
|
+
);
|
|
6083
5992
|
expect(element[0].outerHTML).toEqual(
|
|
6084
|
-
'<div><b
|
|
5993
|
+
'<div><b hello=""></b><b cau=""></b></div>',
|
|
6085
5994
|
);
|
|
6086
5995
|
|
|
6087
5996
|
$rootScope.$digest();
|
|
6088
5997
|
|
|
6089
5998
|
expect(element[0].outerHTML).toEqual(
|
|
6090
|
-
'<div><b
|
|
5999
|
+
'<div><b hello=""></b><b cau=""><span>Cau!</span></b></div>',
|
|
6091
6000
|
);
|
|
6092
6001
|
|
|
6093
6002
|
setTimeout(() => {
|
|
6094
6003
|
expect(element[0].outerHTML).toEqual(
|
|
6095
|
-
`<div><b
|
|
6004
|
+
`<div><b hello="">Hello</b><b cau=""><span>Cau!</span></b></div>`,
|
|
6096
6005
|
);
|
|
6097
6006
|
done();
|
|
6098
6007
|
}, 100);
|
|
@@ -6101,21 +6010,21 @@ describe("$compile", () => {
|
|
|
6101
6010
|
it("should inline template via $http and cache it in $templateCache", (done) => {
|
|
6102
6011
|
$templateCache.put("mock/divexpr", "<span>Cau!</span>");
|
|
6103
6012
|
element = $compile(
|
|
6104
|
-
"<div><b
|
|
6013
|
+
"<div><b i-hello>ignore</b><b i-cau>ignore</b></div>",
|
|
6105
6014
|
)($rootScope);
|
|
6106
6015
|
expect(element[0].outerHTML).toEqual(
|
|
6107
|
-
'<div><b
|
|
6016
|
+
'<div><b i-hello=""></b><b i-cau=""></b></div>',
|
|
6108
6017
|
);
|
|
6109
6018
|
|
|
6110
6019
|
$rootScope.$digest();
|
|
6111
6020
|
|
|
6112
6021
|
expect(element[0].outerHTML).toBe(
|
|
6113
|
-
'<div><b
|
|
6022
|
+
'<div><b i-hello=""></b><span i-cau="">Cau!</span></div>',
|
|
6114
6023
|
);
|
|
6115
6024
|
|
|
6116
6025
|
setTimeout(() => {
|
|
6117
6026
|
expect(element[0].outerHTML).toBe(
|
|
6118
|
-
'<div><div
|
|
6027
|
+
'<div><div i-hello="">Hello</div><span i-cau="">Cau!</span></div>',
|
|
6119
6028
|
);
|
|
6120
6029
|
done();
|
|
6121
6030
|
}, 100);
|
|
@@ -6124,13 +6033,13 @@ describe("$compile", () => {
|
|
|
6124
6033
|
it("should compile, link and flush the template append", (done) => {
|
|
6125
6034
|
$templateCache.put("mock/hello", "<span>Hello, {{name}}!</span>");
|
|
6126
6035
|
$rootScope.name = "Elvis";
|
|
6127
|
-
element = $compile('<div><b
|
|
6036
|
+
element = $compile('<div><b hello=""></b></div>')($rootScope);
|
|
6128
6037
|
|
|
6129
6038
|
$rootScope.$digest();
|
|
6130
6039
|
|
|
6131
6040
|
setTimeout(() => {
|
|
6132
6041
|
expect(element[0].outerHTML).toEqual(
|
|
6133
|
-
'<div><b
|
|
6042
|
+
'<div><b hello=""><span>Hello, Elvis!</span></b></div>',
|
|
6134
6043
|
);
|
|
6135
6044
|
done();
|
|
6136
6045
|
}, 100);
|
|
@@ -6139,24 +6048,24 @@ describe("$compile", () => {
|
|
|
6139
6048
|
it("should compile, link and flush the template inline", () => {
|
|
6140
6049
|
$templateCache.put("mock/div", "<span>Hello, {{name}}!</span>");
|
|
6141
6050
|
$rootScope.name = "Elvis";
|
|
6142
|
-
element = $compile("<div><b
|
|
6051
|
+
element = $compile("<div><b i-hello></b></div>")($rootScope);
|
|
6143
6052
|
|
|
6144
6053
|
$rootScope.$digest();
|
|
6145
6054
|
|
|
6146
6055
|
expect(element[0].outerHTML).toBe(
|
|
6147
|
-
'<div><span
|
|
6056
|
+
'<div><span i-hello="">Hello, Elvis!</span></div>',
|
|
6148
6057
|
);
|
|
6149
6058
|
});
|
|
6150
6059
|
|
|
6151
6060
|
it("should compile template when replacing element in another template", () => {
|
|
6152
6061
|
$templateCache.put("mock/hello", "<div replace></div>");
|
|
6153
6062
|
$rootScope.name = "Elvis";
|
|
6154
|
-
element = $compile('<div><b
|
|
6063
|
+
element = $compile('<div><b hello=""></b></div>')($rootScope);
|
|
6155
6064
|
|
|
6156
6065
|
$rootScope.$digest();
|
|
6157
6066
|
|
|
6158
6067
|
expect(element[0].outerHTML).toEqual(
|
|
6159
|
-
'<div><b
|
|
6068
|
+
'<div><b hello=""><span replace="">Hello, Elvis!</span></b></div>',
|
|
6160
6069
|
);
|
|
6161
6070
|
});
|
|
6162
6071
|
|
|
@@ -6177,10 +6086,10 @@ describe("$compile", () => {
|
|
|
6177
6086
|
$rootScope.name = "Elvis";
|
|
6178
6087
|
const template = $compile(
|
|
6179
6088
|
"<div>" +
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
"<b
|
|
6183
|
-
"<b
|
|
6089
|
+
"<b hello></b>" +
|
|
6090
|
+
"<b cau></b>" +
|
|
6091
|
+
"<b c-error></b>" +
|
|
6092
|
+
"<b l-error></b>" +
|
|
6184
6093
|
"</div>",
|
|
6185
6094
|
);
|
|
6186
6095
|
let e1;
|
|
@@ -6208,7 +6117,7 @@ describe("$compile", () => {
|
|
|
6208
6117
|
|
|
6209
6118
|
it("should resolve widgets after cloning in append mode without $templateCache", (done) => {
|
|
6210
6119
|
$rootScope.expr = "Elvis";
|
|
6211
|
-
const template = $compile(
|
|
6120
|
+
const template = $compile("<div cau></div>");
|
|
6212
6121
|
let e1;
|
|
6213
6122
|
let e2;
|
|
6214
6123
|
|
|
@@ -6233,10 +6142,10 @@ describe("$compile", () => {
|
|
|
6233
6142
|
$rootScope.name = "Elvis";
|
|
6234
6143
|
const template = $compile(
|
|
6235
6144
|
"<div>" +
|
|
6236
|
-
"<b
|
|
6237
|
-
"<b
|
|
6238
|
-
"<b
|
|
6239
|
-
"<b
|
|
6145
|
+
"<b i-hello></b>" +
|
|
6146
|
+
"<b i-cau></b>" +
|
|
6147
|
+
"<b i-c-error></b>" +
|
|
6148
|
+
"<b i-l-error></b>" +
|
|
6240
6149
|
"</div>",
|
|
6241
6150
|
);
|
|
6242
6151
|
let e1;
|
|
@@ -6260,7 +6169,7 @@ describe("$compile", () => {
|
|
|
6260
6169
|
|
|
6261
6170
|
it("should resolve widgets after cloning in inline mode without $templateCache", (done) => {
|
|
6262
6171
|
$rootScope.expr = "Elvis";
|
|
6263
|
-
const template = $compile('<div
|
|
6172
|
+
const template = $compile('<div i-cau=""></div>');
|
|
6264
6173
|
let e1;
|
|
6265
6174
|
let e2;
|
|
6266
6175
|
|
|
@@ -6283,7 +6192,7 @@ describe("$compile", () => {
|
|
|
6283
6192
|
it("should be implicitly terminal and not compile placeholder content in append", () => {
|
|
6284
6193
|
// we can't compile the contents because that would result in a memory leak
|
|
6285
6194
|
$templateCache.put("mock/hello", "Hello!");
|
|
6286
|
-
element = $compile('<div><b
|
|
6195
|
+
element = $compile('<div><b hello=""><div log></div></b></div>')(
|
|
6287
6196
|
$rootScope,
|
|
6288
6197
|
);
|
|
6289
6198
|
|
|
@@ -6294,7 +6203,7 @@ describe("$compile", () => {
|
|
|
6294
6203
|
// we can't compile the contents because that would result in a memory leak
|
|
6295
6204
|
|
|
6296
6205
|
$templateCache.put("mock/hello", "Hello!");
|
|
6297
|
-
element = $compile("<div><b
|
|
6206
|
+
element = $compile("<div><b i-hello><div log></div></b></div>")(
|
|
6298
6207
|
$rootScope,
|
|
6299
6208
|
);
|
|
6300
6209
|
|
|
@@ -6303,10 +6212,10 @@ describe("$compile", () => {
|
|
|
6303
6212
|
|
|
6304
6213
|
// TODO: Figure out why the test fails twice
|
|
6305
6214
|
it("should throw an error and clear element content if the template fails to load", (done) => {
|
|
6306
|
-
element = $compile(
|
|
6215
|
+
element = $compile("<div><b 401>content</b></div>")($rootScope);
|
|
6307
6216
|
setTimeout(() => {
|
|
6308
6217
|
expect(errors.length).toBe(2);
|
|
6309
|
-
expect(element[0].outerHTML).toBe('<div><b
|
|
6218
|
+
expect(element[0].outerHTML).toBe('<div><b 401=""></b></div>');
|
|
6310
6219
|
done();
|
|
6311
6220
|
}, 1000);
|
|
6312
6221
|
});
|
|
@@ -6343,7 +6252,7 @@ describe("$compile", () => {
|
|
|
6343
6252
|
module = angular.module("test1", ["ng"]).directive(
|
|
6344
6253
|
"hello",
|
|
6345
6254
|
valueFn({
|
|
6346
|
-
restrict: "
|
|
6255
|
+
restrict: "A",
|
|
6347
6256
|
templateUrl: "mock/hello",
|
|
6348
6257
|
transclude: true,
|
|
6349
6258
|
}),
|
|
@@ -6502,7 +6411,7 @@ describe("$compile", () => {
|
|
|
6502
6411
|
"mock/hello",
|
|
6503
6412
|
"<span>3==<span ng-transclude></span></span>",
|
|
6504
6413
|
);
|
|
6505
|
-
element = JQLite('<b
|
|
6414
|
+
element = JQLite('<b hello="">{{1+2}}</b>');
|
|
6506
6415
|
$compile(element)($rootScope);
|
|
6507
6416
|
$rootScope.$digest();
|
|
6508
6417
|
expect(element.text()).toEqual("3==3");
|
|
@@ -6520,7 +6429,7 @@ describe("$compile", () => {
|
|
|
6520
6429
|
"<span>i=<span ng-transclude></span>;</span>",
|
|
6521
6430
|
);
|
|
6522
6431
|
element = JQLite(
|
|
6523
|
-
`<div><b
|
|
6432
|
+
`<div><b hello ng-repeat="i in [${is}]">{{i}}</b></div>`,
|
|
6524
6433
|
);
|
|
6525
6434
|
$compile(element)($rootScope);
|
|
6526
6435
|
$rootScope.$digest();
|
|
@@ -6913,7 +6822,7 @@ describe("$compile", () => {
|
|
|
6913
6822
|
["", "a", "b"].forEach((name) => {
|
|
6914
6823
|
module.directive(`scope${name.toUpperCase()}`, () => ({
|
|
6915
6824
|
scope: true,
|
|
6916
|
-
restrict: "
|
|
6825
|
+
restrict: "A",
|
|
6917
6826
|
compile() {
|
|
6918
6827
|
return {
|
|
6919
6828
|
pre(scope, element) {
|
|
@@ -6925,7 +6834,7 @@ describe("$compile", () => {
|
|
|
6925
6834
|
}));
|
|
6926
6835
|
module.directive(`iscope${name.toUpperCase()}`, () => ({
|
|
6927
6836
|
scope: {},
|
|
6928
|
-
restrict: "
|
|
6837
|
+
restrict: "A",
|
|
6929
6838
|
compile() {
|
|
6930
6839
|
return function (scope, element) {
|
|
6931
6840
|
iscope = scope;
|
|
@@ -6936,7 +6845,7 @@ describe("$compile", () => {
|
|
|
6936
6845
|
}));
|
|
6937
6846
|
module.directive(`tscope${name.toUpperCase()}`, () => ({
|
|
6938
6847
|
scope: true,
|
|
6939
|
-
restrict: "
|
|
6848
|
+
restrict: "A",
|
|
6940
6849
|
templateUrl: "tscope.html",
|
|
6941
6850
|
compile() {
|
|
6942
6851
|
return function (scope, element) {
|
|
@@ -6947,7 +6856,7 @@ describe("$compile", () => {
|
|
|
6947
6856
|
}));
|
|
6948
6857
|
module.directive(`stscope${name.toUpperCase()}`, () => ({
|
|
6949
6858
|
scope: true,
|
|
6950
|
-
restrict: "
|
|
6859
|
+
restrict: "A",
|
|
6951
6860
|
template: "<span></span>",
|
|
6952
6861
|
compile() {
|
|
6953
6862
|
return function (scope, element) {
|
|
@@ -6959,7 +6868,7 @@ describe("$compile", () => {
|
|
|
6959
6868
|
module.directive(`trscope${name.toUpperCase()}`, () => ({
|
|
6960
6869
|
scope: true,
|
|
6961
6870
|
replace: true,
|
|
6962
|
-
restrict: "
|
|
6871
|
+
restrict: "A",
|
|
6963
6872
|
templateUrl: "trscope.html",
|
|
6964
6873
|
compile() {
|
|
6965
6874
|
return function (scope, element) {
|
|
@@ -6970,7 +6879,7 @@ describe("$compile", () => {
|
|
|
6970
6879
|
}));
|
|
6971
6880
|
module.directive(`tiscope${name.toUpperCase()}`, () => ({
|
|
6972
6881
|
scope: {},
|
|
6973
|
-
restrict: "
|
|
6882
|
+
restrict: "A",
|
|
6974
6883
|
templateUrl: "tiscope.html",
|
|
6975
6884
|
compile() {
|
|
6976
6885
|
return function (scope, element) {
|
|
@@ -6982,7 +6891,7 @@ describe("$compile", () => {
|
|
|
6982
6891
|
}));
|
|
6983
6892
|
module.directive(`stiscope${name.toUpperCase()}`, () => ({
|
|
6984
6893
|
scope: {},
|
|
6985
|
-
restrict: "
|
|
6894
|
+
restrict: "A",
|
|
6986
6895
|
template: "<span></span>",
|
|
6987
6896
|
compile() {
|
|
6988
6897
|
return function (scope, element) {
|
|
@@ -6994,7 +6903,7 @@ describe("$compile", () => {
|
|
|
6994
6903
|
}));
|
|
6995
6904
|
});
|
|
6996
6905
|
module.directive("log", () => ({
|
|
6997
|
-
restrict: "
|
|
6906
|
+
restrict: "A",
|
|
6998
6907
|
link: {
|
|
6999
6908
|
pre(scope) {
|
|
7000
6909
|
log.push(
|
|
@@ -7125,12 +7034,12 @@ describe("$compile", () => {
|
|
|
7125
7034
|
it("should correctly create the scope hierarchy", () => {
|
|
7126
7035
|
element = $compile(
|
|
7127
7036
|
"<div>" + // 1
|
|
7128
|
-
"<b
|
|
7129
|
-
"<b
|
|
7130
|
-
"<b
|
|
7037
|
+
"<b scope>" + // 2
|
|
7038
|
+
"<b scope><b log></b></b>" + // 3
|
|
7039
|
+
"<b log></b>" +
|
|
7131
7040
|
"</b>" +
|
|
7132
|
-
"<b
|
|
7133
|
-
"<b
|
|
7041
|
+
"<b scope>" + // 4
|
|
7042
|
+
"<b log></b>" +
|
|
7134
7043
|
"</b>" +
|
|
7135
7044
|
"</div>",
|
|
7136
7045
|
)($rootScope);
|
|
@@ -7138,19 +7047,19 @@ describe("$compile", () => {
|
|
|
7138
7047
|
});
|
|
7139
7048
|
|
|
7140
7049
|
it("should allow more than one new scope directives per element, but directives should share the scope", () => {
|
|
7141
|
-
element = $compile(
|
|
7050
|
+
element = $compile("<div scope-a scope-b></div>")($rootScope);
|
|
7142
7051
|
expect(log.length).toEqual(2);
|
|
7143
7052
|
});
|
|
7144
7053
|
|
|
7145
7054
|
it("should not allow more than one isolate scope creation per element", () => {
|
|
7146
7055
|
expect(() => {
|
|
7147
|
-
$compile(
|
|
7056
|
+
$compile("<div iscope-a scope-b></div>")($rootScope);
|
|
7148
7057
|
}).toThrowError(/multidir/);
|
|
7149
7058
|
});
|
|
7150
7059
|
|
|
7151
7060
|
it("should not allow more than one isolate/new scope creation per element regardless of `templateUrl`", () => {
|
|
7152
7061
|
$templateCache.put("tiscope.html", "<div>Hello, world !</div>");
|
|
7153
|
-
$compile(
|
|
7062
|
+
$compile("<div tiscope-a scope-b></div>")($rootScope);
|
|
7154
7063
|
$rootScope.$digest();
|
|
7155
7064
|
expect(log[0].match(/multidir/)).toBeTruthy();
|
|
7156
7065
|
});
|
|
@@ -7573,7 +7482,7 @@ describe("$compile", () => {
|
|
|
7573
7482
|
// .module("fakeIsoledScopeModule", [])
|
|
7574
7483
|
// .directive("fakeScope", () => ({
|
|
7575
7484
|
// scope: true,
|
|
7576
|
-
// restrict: "
|
|
7485
|
+
// restrict: "A",
|
|
7577
7486
|
// compile() {
|
|
7578
7487
|
// return {
|
|
7579
7488
|
// pre(scope, element) {
|
|
@@ -7585,7 +7494,7 @@ describe("$compile", () => {
|
|
|
7585
7494
|
// }))
|
|
7586
7495
|
// .directive("fakeIScope", () => ({
|
|
7587
7496
|
// scope: {},
|
|
7588
|
-
// restrict: "
|
|
7497
|
+
// restrict: "A",
|
|
7589
7498
|
// compile() {
|
|
7590
7499
|
// return function (scope, element) {
|
|
7591
7500
|
// iscope = scope;
|
|
@@ -7599,7 +7508,7 @@ describe("$compile", () => {
|
|
|
7599
7508
|
// module("fakeIsoledScopeModule", () => {
|
|
7600
7509
|
// directive("anonymModuleScopeDirective", () => ({
|
|
7601
7510
|
// scope: true,
|
|
7602
|
-
// restrict: "
|
|
7511
|
+
// restrict: "A",
|
|
7603
7512
|
// compile() {
|
|
7604
7513
|
// return {
|
|
7605
7514
|
// pre(scope, element) {
|
|
@@ -8128,169 +8037,6 @@ describe("$compile", () => {
|
|
|
8128
8037
|
});
|
|
8129
8038
|
});
|
|
8130
8039
|
|
|
8131
|
-
describe("collector", () => {
|
|
8132
|
-
let module;
|
|
8133
|
-
let collected;
|
|
8134
|
-
beforeEach(() => {
|
|
8135
|
-
log = [];
|
|
8136
|
-
collected = false;
|
|
8137
|
-
module = window.angular.module("test1", ["ng"]);
|
|
8138
|
-
module.directive("testCollect", () => ({
|
|
8139
|
-
restrict: "EA",
|
|
8140
|
-
link() {
|
|
8141
|
-
collected = true;
|
|
8142
|
-
},
|
|
8143
|
-
}));
|
|
8144
|
-
createInjector(["test1"]).invoke((_$compile_, _$rootScope_) => {
|
|
8145
|
-
$compile = _$compile_;
|
|
8146
|
-
$rootScope = _$rootScope_;
|
|
8147
|
-
});
|
|
8148
|
-
});
|
|
8149
|
-
|
|
8150
|
-
forEach(
|
|
8151
|
-
[
|
|
8152
|
-
{ commentEnabled: true, cssEnabled: true },
|
|
8153
|
-
{ commentEnabled: true, cssEnabled: false },
|
|
8154
|
-
{ commentEnabled: false, cssEnabled: true },
|
|
8155
|
-
{ commentEnabled: false, cssEnabled: false },
|
|
8156
|
-
],
|
|
8157
|
-
(config) => {
|
|
8158
|
-
describe(
|
|
8159
|
-
`commentDirectivesEnabled(${config.commentEnabled}) ` +
|
|
8160
|
-
`cssClassDirectivesEnabled(${config.cssEnabled})`,
|
|
8161
|
-
() => {
|
|
8162
|
-
let collected = false;
|
|
8163
|
-
beforeEach(() => {
|
|
8164
|
-
collected = false;
|
|
8165
|
-
module = window.angular.module("test1", ["ng"]);
|
|
8166
|
-
module.directive("testCollect", () => ({
|
|
8167
|
-
restrict: "EA",
|
|
8168
|
-
link() {
|
|
8169
|
-
collected = true;
|
|
8170
|
-
},
|
|
8171
|
-
}));
|
|
8172
|
-
createInjector([
|
|
8173
|
-
"test1",
|
|
8174
|
-
($compileProvider) => {
|
|
8175
|
-
$compileProvider.commentDirectivesEnabled(
|
|
8176
|
-
config.commentEnabled,
|
|
8177
|
-
);
|
|
8178
|
-
$compileProvider.cssClassDirectivesEnabled(
|
|
8179
|
-
config.cssEnabled,
|
|
8180
|
-
);
|
|
8181
|
-
},
|
|
8182
|
-
]).invoke((_$compile_, _$rootScope_) => {
|
|
8183
|
-
$compile = _$compile_;
|
|
8184
|
-
$rootScope = _$rootScope_;
|
|
8185
|
-
});
|
|
8186
|
-
});
|
|
8187
|
-
|
|
8188
|
-
it("should not prevent to compile entity directives", () => {
|
|
8189
|
-
element = $compile("<test-collect></test-collect>")($rootScope);
|
|
8190
|
-
expect(collected).toBe(true);
|
|
8191
|
-
});
|
|
8192
|
-
|
|
8193
|
-
it("should not prevent to compile attribute directives", () => {
|
|
8194
|
-
element = $compile("<span test-collect></span>")($rootScope);
|
|
8195
|
-
expect(collected).toBe(true);
|
|
8196
|
-
});
|
|
8197
|
-
|
|
8198
|
-
it("should not prevent to compile interpolated expressions", () => {
|
|
8199
|
-
element = $compile('<span>{{"text "+"interpolated"}}</span>')(
|
|
8200
|
-
$rootScope,
|
|
8201
|
-
);
|
|
8202
|
-
$rootScope.$apply();
|
|
8203
|
-
expect(element.text()).toBe("text interpolated");
|
|
8204
|
-
});
|
|
8205
|
-
|
|
8206
|
-
it("should interpolate expressions inside class attribute", () => {
|
|
8207
|
-
$rootScope.interpolateMe = "interpolated";
|
|
8208
|
-
const html = '<div class="{{interpolateMe}}"></div>';
|
|
8209
|
-
element = $compile(html)($rootScope);
|
|
8210
|
-
$rootScope.$apply();
|
|
8211
|
-
expect(
|
|
8212
|
-
element[0].classList.contains("interpolated"),
|
|
8213
|
-
).toBeTrue();
|
|
8214
|
-
});
|
|
8215
|
-
},
|
|
8216
|
-
);
|
|
8217
|
-
},
|
|
8218
|
-
);
|
|
8219
|
-
|
|
8220
|
-
it("should configure comment directives true by default", () => {
|
|
8221
|
-
createInjector([
|
|
8222
|
-
"ng",
|
|
8223
|
-
($compileProvider) => {
|
|
8224
|
-
const commentDirectivesEnabled =
|
|
8225
|
-
$compileProvider.commentDirectivesEnabled();
|
|
8226
|
-
expect(commentDirectivesEnabled).toBe(true);
|
|
8227
|
-
},
|
|
8228
|
-
]);
|
|
8229
|
-
});
|
|
8230
|
-
|
|
8231
|
-
it("should return self when setting commentDirectivesEnabled", () => {
|
|
8232
|
-
createInjector([
|
|
8233
|
-
"ng",
|
|
8234
|
-
($compileProvider) => {
|
|
8235
|
-
const self = $compileProvider.commentDirectivesEnabled(true);
|
|
8236
|
-
expect(self).toBe($compileProvider);
|
|
8237
|
-
},
|
|
8238
|
-
]);
|
|
8239
|
-
});
|
|
8240
|
-
|
|
8241
|
-
it("should cache commentDirectivesEnabled value when configure ends", () => {
|
|
8242
|
-
let $compileProvider;
|
|
8243
|
-
createInjector([
|
|
8244
|
-
"ng",
|
|
8245
|
-
(_$compileProvider_) => {
|
|
8246
|
-
$compileProvider = _$compileProvider_;
|
|
8247
|
-
$compileProvider.commentDirectivesEnabled(false);
|
|
8248
|
-
},
|
|
8249
|
-
]).invoke(($compile, $rootScope) => {
|
|
8250
|
-
$compileProvider.commentDirectivesEnabled(true);
|
|
8251
|
-
const html = "<!-- directive: test-collect -->";
|
|
8252
|
-
element = $compile(`<div>${html}</div>`)($rootScope);
|
|
8253
|
-
expect(collected).toBe(false);
|
|
8254
|
-
});
|
|
8255
|
-
});
|
|
8256
|
-
|
|
8257
|
-
it("should configure css class directives true by default", () => {
|
|
8258
|
-
createInjector([
|
|
8259
|
-
"ng",
|
|
8260
|
-
($compileProvider) => {
|
|
8261
|
-
const cssClassDirectivesEnabled =
|
|
8262
|
-
$compileProvider.cssClassDirectivesEnabled();
|
|
8263
|
-
expect(cssClassDirectivesEnabled).toBe(true);
|
|
8264
|
-
},
|
|
8265
|
-
]);
|
|
8266
|
-
});
|
|
8267
|
-
|
|
8268
|
-
it("should return self when setting cssClassDirectivesEnabled", () => {
|
|
8269
|
-
createInjector([
|
|
8270
|
-
"ng",
|
|
8271
|
-
($compileProvider) => {
|
|
8272
|
-
const self = $compileProvider.cssClassDirectivesEnabled(true);
|
|
8273
|
-
expect(self).toBe($compileProvider);
|
|
8274
|
-
},
|
|
8275
|
-
]);
|
|
8276
|
-
});
|
|
8277
|
-
|
|
8278
|
-
it("should cache cssClassDirectivesEnabled value when configure ends", () => {
|
|
8279
|
-
let $compileProvider;
|
|
8280
|
-
createInjector([
|
|
8281
|
-
"ng",
|
|
8282
|
-
(_$compileProvider_) => {
|
|
8283
|
-
$compileProvider = _$compileProvider_;
|
|
8284
|
-
$compileProvider.cssClassDirectivesEnabled(false);
|
|
8285
|
-
},
|
|
8286
|
-
]).invoke(($compile, $rootScope) => {
|
|
8287
|
-
$compileProvider.cssClassDirectivesEnabled(true);
|
|
8288
|
-
element = $compile('<div class="test-collect"></div>')($rootScope);
|
|
8289
|
-
expect(collected).toBe(false);
|
|
8290
|
-
});
|
|
8291
|
-
});
|
|
8292
|
-
});
|
|
8293
|
-
|
|
8294
8040
|
describe("link phase", () => {
|
|
8295
8041
|
let module, log;
|
|
8296
8042
|
beforeEach(() => {
|
|
@@ -8298,7 +8044,7 @@ describe("$compile", () => {
|
|
|
8298
8044
|
module = window.angular.module("test1", ["ng"]);
|
|
8299
8045
|
["a", "b", "c"].forEach((name) => {
|
|
8300
8046
|
module.directive(name, () => ({
|
|
8301
|
-
restrict: "
|
|
8047
|
+
restrict: "EA",
|
|
8302
8048
|
compile() {
|
|
8303
8049
|
log.push(`t${name.toUpperCase()}`);
|
|
8304
8050
|
return {
|
|
@@ -8415,7 +8161,7 @@ describe("$compile", () => {
|
|
|
8415
8161
|
let value;
|
|
8416
8162
|
module.directive({
|
|
8417
8163
|
input: valueFn({
|
|
8418
|
-
restrict: "
|
|
8164
|
+
restrict: "EA",
|
|
8419
8165
|
link(scope, element, attr) {
|
|
8420
8166
|
value = attr.required;
|
|
8421
8167
|
},
|
|
@@ -8435,7 +8181,7 @@ describe("$compile", () => {
|
|
|
8435
8181
|
let value;
|
|
8436
8182
|
module.directive({
|
|
8437
8183
|
div: valueFn({
|
|
8438
|
-
restrict: "
|
|
8184
|
+
restrict: "EA",
|
|
8439
8185
|
link(scope, element, attr) {
|
|
8440
8186
|
value = attr.required;
|
|
8441
8187
|
},
|
|
@@ -8571,7 +8317,7 @@ describe("$compile", () => {
|
|
|
8571
8317
|
module.directive(
|
|
8572
8318
|
tag,
|
|
8573
8319
|
valueFn({
|
|
8574
|
-
restrict: "
|
|
8320
|
+
restrict: "EA",
|
|
8575
8321
|
link(scope, element, attr) {
|
|
8576
8322
|
scope.attr = attr;
|
|
8577
8323
|
},
|
|
@@ -12391,7 +12137,7 @@ describe("$compile", () => {
|
|
|
12391
12137
|
if (element.parent().length) {
|
|
12392
12138
|
expect(expectedController).toBeDefined();
|
|
12393
12139
|
expect(controller).toBe(expectedController);
|
|
12394
|
-
expect(controller.foo).
|
|
12140
|
+
expect(controller.foo).toEqual("bar");
|
|
12395
12141
|
log.push("done");
|
|
12396
12142
|
}
|
|
12397
12143
|
},
|
|
@@ -13879,7 +13625,6 @@ describe("$compile", () => {
|
|
|
13879
13625
|
// destroyedScope.$destroy();
|
|
13880
13626
|
// const clone = template(destroyedScope, () => {});
|
|
13881
13627
|
// $rootScope.$digest();
|
|
13882
|
-
// debugger
|
|
13883
13628
|
// // expect(linkFn).not.toHaveBeenCalled();
|
|
13884
13629
|
// // clone.remove();
|
|
13885
13630
|
// });
|
|
@@ -15126,7 +14871,7 @@ describe("$compile", () => {
|
|
|
15126
14871
|
it("should terminate compilation only for element transclusion", () => {
|
|
15127
14872
|
module
|
|
15128
14873
|
.directive("log", () => ({
|
|
15129
|
-
restrict: "
|
|
14874
|
+
restrict: "A",
|
|
15130
14875
|
priority: 0,
|
|
15131
14876
|
compile: valueFn((scope, element, attrs) => {
|
|
15132
14877
|
log.push(attrs.log || "LOG");
|
|
@@ -17932,26 +17677,4 @@ describe("$compile", () => {
|
|
|
17932
17677
|
);
|
|
17933
17678
|
});
|
|
17934
17679
|
});
|
|
17935
|
-
|
|
17936
|
-
describe("$$createComment", () => {
|
|
17937
|
-
it("should create empty comments if `debugInfoEnabled` is false", () => {
|
|
17938
|
-
module.config(($compileProvider) => {
|
|
17939
|
-
$compileProvider.debugInfoEnabled(false);
|
|
17940
|
-
});
|
|
17941
|
-
initInjector("test1");
|
|
17942
|
-
|
|
17943
|
-
const comment = $compile.$$createComment("foo", "bar");
|
|
17944
|
-
expect(comment.data).toBe("");
|
|
17945
|
-
});
|
|
17946
|
-
|
|
17947
|
-
it("should create descriptive comments if `debugInfoEnabled` is true", () => {
|
|
17948
|
-
module.config(($compileProvider) => {
|
|
17949
|
-
$compileProvider.debugInfoEnabled(true);
|
|
17950
|
-
});
|
|
17951
|
-
|
|
17952
|
-
initInjector("test1");
|
|
17953
|
-
const comment = $compile.$$createComment("foo", "bar");
|
|
17954
|
-
expect(comment.data).toBe(" foo: bar ");
|
|
17955
|
-
});
|
|
17956
|
-
});
|
|
17957
17680
|
});
|