Skip to content

data should be a function #812

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 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/specs/mounting-options/localVue.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ describeWithMountingMethods('options.localVue', mountingMethod => {
template: `
<div>{{test}}</div>
`,
data: { test: '' }
data: () => ({ test: '' })
}
const localVue = Vue.extend()
localVue.version = '2.3'
const wrapper = mountingMethod(TestComponent, {
localVue: localVue,
mocks: { test: 'some value' }
localVue: localVue
})
wrapper.vm.test = 'some value'
Copy link
Member Author

@LinusBorg LinusBorg Jul 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddyerburgh I had to remove the mocks: { test: 'some value'} and replace it with this, otherwise the test woudl fail.

I suspect that this is because you can't actually mock properties for proxied data properties, but that didn't fail before because the data: { test: '' } itself failed?

Did my change break the intended goal of the test?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is the first one written for localVue, and itcould be rewritten. The intent is to check that VTU mounts using the localVue constructor, so a better test would create a localVue constructor with createLocalVue, add a property to the localVue prototype, and mount a component that relies on that property existing.

Would you be able to rewrite it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will try tomorrow

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might take a few days until I really have the time :/

const HTML =
mountingMethod.name === 'renderToString' ? wrapper : wrapper.html()
expect(HTML).to.contain('some value')
Expand Down