Giter Club home page Giter Club logo

Comments (6)

jpascual-pm avatar jpascual-pm commented on June 14, 2024 1

Hello, sorry for the delay in responding. I saw you've closed this issue, but I still want to comment to confirm that it works on angular@5. As you said, it is after all a peerDependency.

Edit: I realized I'm commenting from my other account.

from spectator.

NetanelBasal avatar NetanelBasal commented on June 14, 2024

You have problems using it with Angular 5, or you are just assuming?

from spectator.

jeekapascual avatar jeekapascual commented on June 14, 2024

When I am mocking components via the MockComponent function, I am required to pass in the template. For example:

parent.component.html

<card>
  <heading>
    <div class="header-text">{{ header }}</div>
  </heading>
  <body>
    <div class="body-text">
       ...etc
    </div>
  </body>
</card>

card.component.html

<ng-content></ng-content>
etc..
...

Instead of being able to do this:

createHostComponentFactory({
  declarations: [
    MockComponent({ selector: 'card' }),
    MockComponent({ selector: 'body' }),
    MockComponent({ selector: 'heading' })
  ]
});

I have to pass in template in order for .header-text and .body-text to be taken into account:

createHostComponentFactory({
  declarations: [
    MockComponent({ selector: 'card', template: '<ng-content></ng-content>' }),
    MockComponent({ selector: 'body', template: '<ng-content></ng-content>'  }),
    MockComponent({ selector: 'heading', template: '<ng-content></ng-content>'  })
  ]
});

If I am working with multiple nested components, I have to explicitly state the template for each. This fix where a default template is set by createHostComponentFactory is available in v1.13.1.

from spectator.

NetanelBasal avatar NetanelBasal commented on June 14, 2024

I think you can use the newer version even with Angular 5, can you try it, please?

from spectator.

jeekapascual avatar jeekapascual commented on June 14, 2024

Sorry for the delay in responding.

I've tested v2 of spectator and it does work, however it explicitly requiring angular@6 makes it difficult on my side. I'm working on a library that it set to use angular@5 (won't be able to upgrade soon). Unfortunately, this library is a dependency of other libraries I'm working with that do not support >angular@5. So for the meantime, I am blocked to angular@5.

v1.13.1 is the latest tag I could work with angular@5.

from spectator.

NetanelBasal avatar NetanelBasal commented on June 14, 2024

It's only a peer dependency; you can use it with Angular 5 with no problem.

from spectator.

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.