Skip to content

Commit d100e69

Browse files
JeanMechethePunderWoman
authored andcommitted
refactor(core): extend tests for empty cases.
follow-up of angular#66372 to extend a bit our runtime test coverage for empty cases
1 parent 7003e8d commit d100e69

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

packages/core/test/acceptance/control_flow_switch_spec.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,18 @@ describe('control flow - switch', () => {
324324
});
325325

326326
it('should support an empty case block', () => {
327+
// prettier-ignore
327328
@Component({
328329
template: `
329330
@switch (case) {
330331
@case (0) {}
331-
@case (1) {
332-
case 1
332+
@case (1) { <!-- empty --> }
333+
@case (2) {
334+
335+
}
336+
@case(3)
337+
@case (4) {
338+
case 3-4
333339
}
334340
@default {
335341
default
@@ -348,7 +354,19 @@ describe('control flow - switch', () => {
348354

349355
fixture.componentInstance.case = 1;
350356
fixture.detectChanges();
351-
expect(fixture.nativeElement.textContent).toBe(' case 1 ');
357+
expect(fixture.nativeElement.textContent).toBe('');
358+
359+
fixture.componentInstance.case = 2;
360+
fixture.detectChanges();
361+
expect(fixture.nativeElement.textContent).toBe('');
362+
363+
fixture.componentInstance.case = 3;
364+
fixture.detectChanges();
365+
expect(fixture.nativeElement.textContent).toBe(' case 3-4 ');
366+
367+
fixture.componentInstance.case = 4;
368+
fixture.detectChanges();
369+
expect(fixture.nativeElement.textContent).toBe(' case 3-4 ');
352370

353371
fixture.componentInstance.case = 5;
354372
fixture.detectChanges();

0 commit comments

Comments
 (0)