Skip to content

Ambient directives and unit tests with TestComponentBuilder #5433

Closed

Description

@pkozlowski-opensource

Spotted by @teropa and confirmed on my side in the ng2 directives for Bootstrap project (see: ng-bootstrap/ng-bootstrap#115):

I'm getting errors about platform directives like ng-for when using TestComponentBuilder. Seems like they're not "ambient" in the unit tests like they are during normal execution. I can fix it by including CORE_DIRECTIVES in the component, but that seems backward. Any ideas how to make them available?

Activity

  1. changed the title [-]Ambient and unit tests with TestComponentBuilder[/-] [+]Ambient directives and unit tests with TestComponentBuilder[/+] on Nov 24, 2015
  2. tbosch commented on Dec 3, 2015

    @tbosch
    Contributor

    Same is true for platform pipes

  3. added
    area: testingIssues related to Angular testing features, such as TestBed
    on Dec 16, 2015
  4. self-assigned this
    on Dec 16, 2015
  5. juliemr commented on Dec 16, 2015

    @juliemr
    Member

    Related to #5351

    There's a fix in #5937

  6. added this to the milestone on Dec 16, 2015
  7. juliemr commented on Dec 17, 2015

    @juliemr
    Member

    Note the design at #5351

    I'm not closing this as a duplicate since it's a more precise issue than the one that #5351 tries to solve, and is easier to search for.

  8. stefanocke commented on Jan 15, 2016

    @stefanocke

    As a workaround, the following worked for me:

    beforeEachProviders(() => [  provide(PLATFORM_DIRECTIVES, {useValue: CORE_DIRECTIVES, multi: true})]);
    

    So one can at least avoid to add the core directives in the components and keep the workaround in the test scripts.

  9. juliemr commented on Jan 15, 2016

    @juliemr
    Member

    This is fixed with b0cebdb

  10. Foxandxss commented on Jan 16, 2016

    @Foxandxss
    Member

    That is not released yet, right?

  11. pkozlowski-opensource commented on Jan 16, 2016

    @pkozlowski-opensource
    MemberAuthor

    That is not released yet, right?

    Nope, just landed in master, will be part of beta.2

  12. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  13. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: testingIssues related to Angular testing features, such as TestBed

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions