-
Notifications
You must be signed in to change notification settings - Fork 668
feat: Store selector in Wrapper.find() / .findAll() #1248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f156698
46f884e
4ec04f0
aab0bf5
ff4e0fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -69,6 +69,7 @@ interface BaseWrapper { | |||||
|
||||||
trigger (eventName: string, options?: object): void | ||||||
destroy (): void | ||||||
selector: Selector | void | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't actually a Selector type, it's an object with a value and type: https://github.com/vuejs/vue-test-utils/blob/dev/packages/test-utils/src/get-selector.js#L38 Because the library isn't written in TS, we have tests (https://github.com/vuejs/vue-test-utils/blob/dev/packages/test-utils/types/test/wrapper.ts) that access and set the wrapper options using the types. Can you write a test that accesses selector.value and selector.type and update this types file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@eddyerburgh Thank you for catching this! 👍 It actually is of type Selector for the ErrorWrapper:
I will update the other places to use
Sure, I can add tests there! 👍 Right now I'm a little confused by the structure of that file though because it has neither test cases in the usual style (no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ah, it turns out this was wrong actually—but the Selector type is currently vue-test-utils/flow/wrapper.flow.js Line 6 in 70ac83a
I will adjust the places that create ErrorWrapper instances to use the rawSelector as well then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, the test script just compiles the file to make sure there aren't any compiler errors when using the Vue Test Utils API, caused by incorrect typing. A test would look something like this: let s: string = wrapper.selector.value There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! 🙇♂️ I'll add the tests and ping you again once they are ready. |
||||||
} | ||||||
|
||||||
export interface Wrapper<V extends Vue | null> extends BaseWrapper { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that we could use the component name at least in some cases here. However I'd like to keep that as a follow-up.