X Tutup
Skip to content

TestComponentBuilder needs common directives referenced in @View #6195

@matthewdenobrega

Description

@matthewdenobrega

Currently the common directives (CORE_DIRECTIVES and FORM_DIRECTIVES) are included automatically and do not need to be manually referenced in a component's @view annotation. However this is not the case for the TestComponentBuilder, which fails to build the component if the component uses unreferenced common directives. An example error message is:

{"message":"Template parse errors: Can't bind to 'ngFormControl' since it isn't a known native property...

It's possible to add these references in to the component definition, but ideally the TCB should be able to build whatever Angular builds normally. Also the way the TCB handles errors (calling the onrejected callback of the promise, which I seldom see anyone binding to) means that tests can be regarded as passing if the component fails to build:

tcb.createAsync(testComponent).then((fixture: ComponentFixture) => {
    expect(true).toBe(false)
})

Will pass if the TCB fails to create the component.

So proposed solution would be to make the common directives available to the TCB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup