Skip to content

Clarify docs on how to mock $root #1437

Closed
@aantipov

Description

@aantipov

What problem does this feature solve?

The docs say that I can use mocks mounting option to mock "global injections" like $route.

I considered $root as a "global injection" and that I can use mocks to mock it. Unfortunately it didn't work for me, I spent lots of time trying to make it working, without any success. In the end I came up with a solution to use parentComponent option to mock $root.

As far as I understood it's not possible to mock $root using mocks and it's not considered as a bug.

If I'm right, then the docs for mocks need clarification stating that clearly and providing a way to mock $root

What does the proposed API look like?

The docs should say smth like this:

"One can't use mocks to mock $root though. If you need to mock $root, use "parentComponent" option instead."

And provide "parentComponent" section with an example how to mock $root

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions