How to Cypress Component Test when Component template has ng-content

Discussão em 'Angular' iniciado por Fred2020, Janeiro 13, 2025.

  1. Fred2020

    Fred2020 Guest

    If I have a component whose associated template has ng-content in it, how do I provide a value for the content projection when I am in a Cypress Component test context?

    MyComponent template html

    Test value from parent component: <ng-content></ng-content>

    Cypress Component test

    describe('fixture description', () => {
    it('example test', () => {
    cy.mount(MyComponent, {}) // {} is a placeholder for further options
    }
    });


    I can provide some options in the empty braces but the documentation shows these options as being for input parameters, ie componentProperties but nothing about content projection

    How do I provide the value?

    Continue reading...

Compartilhe esta Página