Skip to content

Commit 7d250f8

Browse files
committed
test: fix unit tests for renderer
1 parent e1a21e9 commit 7d250f8

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

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

+24-23
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ describe("Renderer E2E", () => {
291291
it("ngIf hides component when false", () => {
292292
return testApp.loadComponent(NgIfLabel).then((componentRef) => {
293293
const componentRoot = componentRef.instance.elementRef.nativeElement;
294-
assert.equal("(ProxyViewContainer (CommentNode))", dumpView(componentRoot));
294+
assert.equal("(ProxyViewContainer)", dumpView(componentRoot));
295295
});
296296
});
297297

@@ -302,7 +302,7 @@ describe("Renderer E2E", () => {
302302

303303
component.show = true;
304304
testApp.appRef.tick();
305-
assert.equal("(ProxyViewContainer (CommentNode), (Label))", dumpView(componentRoot));
305+
assert.equal("(ProxyViewContainer (Label))", dumpView(componentRoot));
306306
});
307307
});
308308

@@ -314,12 +314,11 @@ describe("Renderer E2E", () => {
314314
component.show = true;
315315
testApp.appRef.tick();
316316
assert.equal(
317-
"(ProxyViewContainer (StackLayout (CommentNode), (Label), (Button)))",
317+
"(ProxyViewContainer (StackLayout (Label), (Button)))",
318318
dumpView(componentRoot));
319319
});
320320
});
321321

322-
323322
it("ngIf shows elements in correct order when multiple are rendered and there's *ngIf", () => {
324323
return testApp.loadComponent(NgIfMultiple).then((componentRef) => {
325324
const component = <NgIfMultiple>componentRef.instance;
@@ -333,8 +332,7 @@ describe("Renderer E2E", () => {
333332
"(Label[text=1]), " +
334333
"(Label[text=2]), " +
335334
"(Label[text=3]), " +
336-
"(CommentNode), " + // ng-reflect comment
337-
"(Label[text=4]), " + // the content to be displayed and its anchor
335+
"(Label[text=4]), " + // the content to be conditionally displayed
338336
"(Label[text=5])" +
339337
")" +
340338
")",
@@ -348,13 +346,15 @@ describe("Renderer E2E", () => {
348346
const componentRoot = component.elementRef.nativeElement;
349347

350348
testApp.appRef.tick();
349+
351350
assert.equal(
352351
"(ProxyViewContainer " +
353352
"(StackLayout " +
354-
"(CommentNode), " + // ng-reflect comment
355-
"(Label[text=If]), (CommentNode)))", // the content to be displayed and its anchor
353+
"(Label[text=If])" +
354+
")" +
355+
")",
356356

357-
dumpView(componentRoot, true));
357+
dumpView(componentRoot, true));
358358
});
359359
});
360360

@@ -368,10 +368,11 @@ describe("Renderer E2E", () => {
368368
assert.equal(
369369
"(ProxyViewContainer " +
370370
"(StackLayout " +
371-
"(CommentNode), " + // ng-reflect comment
372-
"(Label[text=Else]), (CommentNode)))", // the content to be displayed and its anchor
371+
"(Label[text=Else])" +
372+
")" +
373+
")",
373374

374-
dumpView(componentRoot, true));
375+
dumpView(componentRoot, true));
375376
});
376377
});
377378

@@ -384,11 +385,11 @@ describe("Renderer E2E", () => {
384385
assert.equal(
385386
"(ProxyViewContainer " +
386387
"(StackLayout " +
387-
"(CommentNode), " + // ng-reflect comment
388-
"(Label[text=Then]), (CommentNode), " + // the content to be displayed and its anchor
389-
"(CommentNode)))", // the anchor for the else template
388+
"(Label[text=Then])" +
389+
")" +
390+
")",
390391

391-
dumpView(componentRoot, true));
392+
dumpView(componentRoot, true));
392393
});
393394
});
394395

@@ -403,19 +404,19 @@ describe("Renderer E2E", () => {
403404
assert.equal(
404405
"(ProxyViewContainer " +
405406
"(StackLayout " +
406-
"(CommentNode), " + // the content to be displayed
407-
"(Label[text=Else]), (CommentNode), " + // the content to be displayed
408-
"(CommentNode)))", // the content to be displayed
407+
"(Label[text=Else])" +
408+
")" +
409+
")",
409410

410-
dumpView(componentRoot, true));
411+
dumpView(componentRoot, true));
411412
});
412413
});
413414

414415
it("ngFor creates element for each item", () => {
415416
return testApp.loadComponent(NgForLabel).then((componentRef) => {
416417
const componentRoot = componentRef.instance.elementRef.nativeElement;
417418
assert.equal(
418-
"(ProxyViewContainer (CommentNode), (Label[text=one]), (Label[text=two]), (Label[text=three]))",
419+
"(ProxyViewContainer (Label[text=one]), (Label[text=two]), (Label[text=three]))",
419420
dumpView(componentRoot, true));
420421
});
421422
});
@@ -429,7 +430,7 @@ describe("Renderer E2E", () => {
429430
testApp.appRef.tick();
430431

431432
assert.equal(
432-
"(ProxyViewContainer (CommentNode), (Label[text=one]), (Label[text=three]))",
433+
"(ProxyViewContainer (Label[text=one]), (Label[text=three]))",
433434
dumpView(componentRoot, true));
434435
});
435436
});
@@ -443,7 +444,7 @@ describe("Renderer E2E", () => {
443444
testApp.appRef.tick();
444445

445446
assert.equal(
446-
"(ProxyViewContainer (CommentNode), " +
447+
"(ProxyViewContainer " +
447448
"(Label[text=one]), (Label[text=new]), (Label[text=two]), (Label[text=three]))",
448449
dumpView(componentRoot, true));
449450
});

0 commit comments

Comments
 (0)