-
Notifications
You must be signed in to change notification settings - Fork 668
fix #1377 string stubs dropping props #1473
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 4 commits
aebcc13
68640c1
34aadf2
30428b4
2bd67b6
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 |
---|---|---|
|
@@ -208,10 +208,13 @@ const wrapper = mount(WrapperComp).find(ComponentUnderTest) | |
|
||
## stubs | ||
|
||
- type: `{ [name: string]: Component | boolean } | Array<string>` | ||
- type: `{ [name: string]: Component | string | boolean } | Array<string>` | ||
|
||
Stubs child components. Can be an Array of component names to stub, or an object. If `stubs` is an Array, every stub is `<${component name}-stub>`. | ||
|
||
Depercation note: | ||
If declaring an object, string stubs are now deprecated and will be removed in a future version. | ||
|
||
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. I think we can just drop it entirely 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. Because we dont have versioned docs, I think it makes sense to leave it. We are deprecating, but have not yet removed it. (We saw what removing Maybe we can add an example what is now deprecated? |
||
Example: | ||
|
||
```js | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<div> | ||
<span> | ||
<slot-component prop1="foobar" prop2="fizzbuzz" /> | ||
<child-component prop1="foobar" prop2="fizzbuzz" /> | ||
<original-component prop1="foobar" prop2="fizzbuzz" /> | ||
</span> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import ComponentWithProps from './component-with-props.vue' | ||
|
||
export default { | ||
name: 'component-with-nested-children', | ||
components: { | ||
ChildComponent: ComponentWithProps, | ||
SlotComponent: ComponentWithProps, | ||
OriginalComponent: ComponentWithProps | ||
} | ||
} | ||
</script> |
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.
if it is deprecated should we just nuke it from the docs?
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'd make an argument against that as the typescript definitions show strings as a valid option. It's very frustrating when you see something in the code, but missing in the documentation. Is there a better place to indicate that strings are deprecated?
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.
Right, makes sense. Not sure.... strings aren't really deprecated, just ones that are valid HTML. Could we just add a check and throw and error if the string includes
<
or>
, since you can still pass something like "Text". Or are we dropping that entirely too? In that case we would change the definitions and removestring
?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.
If you were to just pass text then the vue template compiler will complain about it not being a valid template.
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.
Right, I wasn't thinking. You'd need to pass
h('text')
.Let's just drop it, and remove
string
from the TS definitions if it's not longer valid? Or am I missing something 🤔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 think making breaking changes before 1.0 make a lot more sense - once we hit 1.0, deprecating things becomes a lot more difficult.
What do you think if we just deprecate it right now and add a check + warning "This is now deprecated"?
Either way let's make a decision and get this merged up! I'll leave it up to you to make the final call.
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.
Deprecated as in still works for maybe the next release or two. then rip it out? I'm good with that. Really it's just to give people a chance to migrate without completely breaking any of these stubs.
Completely agree with after 1.0 it's a pain to get something out. I'd suggest that we remove this completely before 1.0 final release. Any idea on how many more beta's there will be?
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.
Just show the right methods here, and add a note below, of what used to work, but is now deprecated.
New users get to read the valid syntax, and those that are searching will find why its erroring out when they update :)
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.
Sounds good. Can we get this added and merge this @Stoom , thanks for sticking with this PR for so long
I have no idea about the number of betas, since I think are unclear on what constitutes a 1.0, I think we should get Vue 3 support working (it's WIP, hopefully public alpha soon) and call whatever we have at that point the 1.0 release.
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.
Uh are we dropping string templates entirely...?