Comments (15)
lol, that's precisely what I did right now.
from spectator.
Thank you. Feel free to give more feedback or issues. :)
from spectator.
Isn't it simply just a question of changing Element
to R
here? https://github.com/NetanelBasal/spectator/blob/master/src/lib/src/internals.ts#L69
from spectator.
In general, you are right. It's a question of what is the more common case? If you most of the times query for DOM element it's more convenient. Don't you think so?
from spectator.
Then perhaps change the return value to HTMLElement
instead of Element
so common things like .click()
work without having to cast the return value?
from spectator.
BTW, Why are you not using the built-in click method?
spectator.click('button');
from spectator.
Because i didn't know that API existed 😁
from spectator.
It will click and trigger change detection for you.
from spectator.
Excellent! Just changed my test to use that API :)
from spectator.
https://netbasal.gitbooks.io/spectator/api.html
from spectator.
I guess we can close this issue then.
from spectator.
I love your idea, but it means that if I changed it, everyone would get the any
type. It means that you must pass a type.
spectator.query<HTMLButtonElement>("button");
from spectator.
You could do query<R = Element>(directiveOrSelector: string, options?: { read }): R;
from spectator.
I'm releasing a new version with this change for all queries methods.
from spectator.
Great, thanks!
from spectator.
Related Issues (20)
- Adding logging hint "Did you mean to use `componentProviders` instead of `providers`" when `createComponentFactory` is misconfigured in jest tests HOT 1
- Angular 16 | Transform Input Values HOT 3
- 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 6
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.