Comments (6)
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.
You have problems using it with Angular 5, or you are just assuming?
from spectator.
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.
I think you can use the newer version even with Angular 5, can you try it, please?
from spectator.
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.
It's only a peer dependency; you can use it with Angular 5 with no problem.
from spectator.
Related Issues (20)
- dispatchKeyboardEvent keydown Control event.ctrlKey is not true
- Angular (v16) + Spectator/Jest reports "NG0912 Component ID generation collision detected" in basic component test HOT 3
- Using SIFERS pattern to setup test in spectator
- `change` event is never fired when faking a file drop on custom input
- { shallow: true } doesn't mock standalone components/directives/pipes HOT 3
- inject does not find directive provider
- Support Angular 17 HOT 2
- Cannot resolve "styleUrl"
- Add support for input signals HOT 14
- Do not import `@jest/globals` outside of the Jest test environment
- Testing for functional guards HOT 2
- Spectator#setInput does not to update UI Elements for Components with changeDetectionStrategy OnPush HOT 6
- TypeError: Cannot read properties of undefined (reading 'Playthrough') HOT 1
- Support of Web Test Runner HOT 1
- setInput doesn't respect the alias names HOT 7
- Spectator is forcing to add a transform explicitly if input() has got a transform function HOT 4
- Cannot pass props which are not input() type in createComponent() HOT 7
- Angular 17 - input with transform HOT 8
- Angular 17 signal required input
- Host component's `ngOnChanges` is not called when testing directive using `createDirectiveFactory`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spectator.