8000 fix(stubs): function in props should be rendered as a deterministic string by briwa · Pull Request #1237 · vuejs/vue-test-utils · GitHub
[go: up one dir, main page]

Skip to content

fix(stubs): function in props should be rendered as a deterministic string #1237

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
8000 Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: npm run format
  • Loading branch information
briwa committed May 20, 2019
commit 4d3dbf8db55e67d86fdc4223ef507945a31b9e6b
2 changes: 1 addition & 1 deletion packages/create-instance/create-component-stubs.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function shapeStubProps(props) {
}

if (Array.isArray(props[propName])) {
shapedProps[propName] = props[propName].map((value) => {
shapedProps[propName] = props[propName].map(value => {
return typeof value === 'function' ? FUNCTION_PLACEHOLDER : value
})
continue
Expand Down
8 changes: 4 additions & 4 deletions test/specs/mounting-options/stubs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ describeWithShallowAndMount('options.stub', mountingMethod => {
:qux="qux" />
</div>
`,
data () {
data() {
return {
foo: () => 42,
bar: [1, 'string', () => true],
Expand All @@ -606,9 +606,9 @@ describeWithShallowAndMount('options.stub', mountingMethod => {

expect(wrapper.html()).to.equal(
`<div>\n` +
` <child-component-stub foo="[Function]" bar="1,string,[Function]" qux="qux"></child-component-stub>\n` +
` <functional-child-component-stub foo="[Function]" bar="1,string,[Function]" qux="qux"></functional-child-component-stub>\n` +
`</div>`
` <child-component-stub foo="[Function]" bar="1,string,[Function]" qux="qux"></child-component-stub>\n` +
` <functional-child-component-stub foo="[Function]" bar="1,string,[Function]" qux="qux"></functional-child-component-stub>\n` +
`</div>`
)
})
})
0