Code Monkey home page Code Monkey logo

Comments (4)

ike18t avatar ike18t commented on May 13, 2024

The main question I have is why would you want to? It seems like this request stems from a deeper issue of the parent component having too much context on what is going on under the hood of the child component.

For something like a provider where it is a singleton, it would make more sense to DI it into the parent and use the provider that way which would cut out the middle-man of the child component.

from ng-mocks.

Lonli-Lokli avatar Lonli-Lokli commented on May 13, 2024

In our case Child is a Grid and Parent is a View. Service inside Child is not a Singleton, it's a instance-related and provided with bunch of other services via providers for Child component declaration.
EG we have DaatsourceService and displaying somewhere in Parent number of loaded rows.

from ng-mocks.

ike18t avatar ike18t commented on May 13, 2024

Gotcha.

MockedComponents are intended to be shallow and only consist of inputs and outputs. When I've encountered similar issues to this in the past where I need the mocked component to have additional implementation detail I typically query for the component and extend it (via a mocking lib or just assignment) prior to the behavior that has the expectation of the additional implementation existing.

from ng-mocks.

satanTime avatar satanTime commented on May 13, 2024

Hi everybody, possible fix #88
@Lonli-Lokli, could you check whether it solves your issue?
There's no spy on it, but at least it shouldn't fail.

from ng-mocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.