Skip to content

Commit a1ff6c7

Browse files
committed
fix(renderer): stop attaching comments to visual tree
1 parent e60b7e9 commit a1ff6c7

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

Diff for: nativescript-angular/element-registry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,5 @@ registerElement("DetachedText", () => require("ui/placeholder").Placeholder,
115115
{ skipAddToDom: true });
116116

117117
registerElement("Comment", () => require("ui/placeholder").Placeholder,
118-
{ skipAddToDom: false });
118+
{ skipAddToDom: true });
119119

Diff for: tests/app/tests/renderer-tests.ts

+9-15
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe("Renderer E2E", () => {
256256
it("ngIf hides component when false", () => {
257257
return testApp.loadComponent(NgIfLabel).then((componentRef) => {
258258
const componentRoot = componentRef.instance.elementRef.nativeElement;
259-
assert.equal("(ProxyViewContainer (#comment))", dumpView(componentRoot));
259+
assert.equal("(ProxyViewContainer)", dumpView(componentRoot));
260260
});
261261
});
262262

@@ -267,7 +267,7 @@ describe("Renderer E2E", () => {
267267

268268
component.show = true;
269269
testApp.appRef.tick();
270-
assert.equal("(ProxyViewContainer (#comment), (Label))", dumpView(componentRoot));
270+
assert.equal("(ProxyViewContainer (Label))", dumpView(componentRoot));
271271
});
272272
});
273273

@@ -280,8 +280,7 @@ describe("Renderer E2E", () => {
280280
assert.equal(
281281
"(ProxyViewContainer " +
282282
"(StackLayout " +
283-
"(#comment), " + // ng-reflect comment
284-
"(Label[text=If]), (#comment)))", // the content to be displayed and its anchor
283+
"(Label[text=If])))", // the content to be displayed
285284

286285
dumpView(componentRoot, true));
287286
});
@@ -297,8 +296,7 @@ describe("Renderer E2E", () => {
297296
assert.equal(
298297
"(ProxyViewContainer " +
299298
"(StackLayout " +
300-
"(#comment), " + // ng-reflect comment
301-
"(Label[text=Else]), (#comment)))", // the content to be displayed and its anchor
299+
"(Label[text=Else])))", // the content to be displayed
302300

303301
dumpView(componentRoot, true));
304302
});
@@ -313,9 +311,7 @@ describe("Renderer E2E", () => {
313311
assert.equal(
314312
"(ProxyViewContainer " +
315313
"(StackLayout " +
316-
"(#comment), " + // ng-reflect comment
317-
"(Label[text=Then]), (#comment), " + // the content to be displayed and its anchor
318-
"(#comment)))", // the anchor for the else template
314+
"(Label[text=Then])))", // the content to be displayed
319315
dumpView(componentRoot, true));
320316
});
321317
});
@@ -331,9 +327,7 @@ describe("Renderer E2E", () => {
331327
assert.equal(
332328
"(ProxyViewContainer " +
333329
"(StackLayout " +
334-
"(#comment), " + // ng-reflect comment
335-
"(Label[text=Else]), (#comment), " + // the content to be displayed and its anchor
336-
"(#comment)))", // the anchor for the else template
330+
"(Label[text=Else])))", // the content to be displayed
337331

338332
dumpView(componentRoot, true));
339333
});
@@ -343,7 +337,7 @@ describe("Renderer E2E", () => {
343337
return testApp.loadComponent(NgForLabel).then((componentRef) => {
344338
const componentRoot = componentRef.instance.elementRef.nativeElement;
345339
assert.equal(
346-
"(ProxyViewContainer (#comment), (Label[text=one]), (Label[text=two]), (Label[text=three]))",
340+
"(ProxyViewContainer (Label[text=one]), (Label[text=two]), (Label[text=three]))",
347341
dumpView(componentRoot, true));
348342
});
349343
});
@@ -357,7 +351,7 @@ describe("Renderer E2E", () => {
357351
testApp.appRef.tick();
358352

359353
assert.equal(
360-
"(ProxyViewContainer (#comment), (Label[text=one]), (Label[text=three]))",
354+
"(ProxyViewContainer (Label[text=one]), (Label[text=three]))",
361355
dumpView(componentRoot, true));
362356
});
363357
});
@@ -371,7 +365,7 @@ describe("Renderer E2E", () => {
371365
testApp.appRef.tick();
372366

373367
assert.equal(
374-
"(ProxyViewContainer (#comment), " +
368+
"(ProxyViewContainer " +
375369
"(Label[text=one]), (Label[text=new]), (Label[text=two]), (Label[text=three]))",
376370
dumpView(componentRoot, true));
377371
});

0 commit comments

Comments
 (0)