diff --git a/system-tests/projects/angular-signals/src/control-flow/control-flow.component.cy.ts b/system-tests/projects/angular-signals/src/control-flow/control-flow.component.cy.ts new file mode 100644 index 000000000000..f8a663cda8f7 --- /dev/null +++ b/system-tests/projects/angular-signals/src/control-flow/control-flow.component.cy.ts @@ -0,0 +1,38 @@ +import { ControlFlowComponent, SuperHero } from './control-flow.component' + +// @see https://angular.dev/guide/templates/control-flow +it('works with basic control flow', () => { + const superHeroes: SuperHero[] = [ + { + name: 'Clark Kent', + nickname: 'Man of Steel', + age: 28, + isMortal: true, + }, + { + name: 'Wade T. Wilson', + nickname: 'Deadpool', + age: 43, + isMortal: false, + }, + ] + + cy.mount(ControlFlowComponent, { + componentProperties: { + superHeroes, + }, + }) + + cy.get('[data-index="0"]').as('superman') + cy.get('[data-index="1"]').as('deadpool') + + cy.get('@superman').find('[data-cy="name"]').should('contain.text', 'Clark Kent') + cy.get('@superman').find('[data-cy="nickname"]').should('contain.text', 'Man of Steel') + cy.get('@superman').find('[data-cy="age"]').should('contain.text', '28 is younger than 30') + cy.get('@superman').find('[data-cy="mortality"]').should('contain.text', 'I am mortal. I will eventually die') + + cy.get('@deadpool').find('[data-cy="name"]').should('contain.text', 'Wade T. Wilson') + cy.get('@deadpool').find('[data-cy="nickname"]').should('contain.text', 'Deadpool') + cy.get('@deadpool').find('[data-cy="age"]').should('contain.text', '43 is older than 30') + cy.get('@deadpool').find('[data-cy="mortality"]').should('contain.text', 'I am immortal and will live forever') +}) diff --git a/system-tests/projects/angular-signals/src/control-flow/control-flow.component.html b/system-tests/projects/angular-signals/src/control-flow/control-flow.component.html new file mode 100644 index 000000000000..628c7dd6099e --- /dev/null +++ b/system-tests/projects/angular-signals/src/control-flow/control-flow.component.html @@ -0,0 +1,36 @@ + +
Name: {{ superHero.name }}
+Nickname: {{ superHero.nickname }}
++ @if (superHero.age > 30) { + {{ superHero.age }} is older than 30 + } @else if (30 > superHero.age) { + {{ superHero.age }} is younger than 30 + } @else { + Age is unknown + } +
++ @switch (superHero.isMortal) { + @case (true) { + I am mortal. I will eventually die + } + @case (false) { + I am immortal and will live forever + } + @default { + Mortality status unknown + } + } +
+