Skip to content

Commit da84f1b

Browse files
lmiller1990eddyerburgh
authored andcommitted
docs: fix code samples in using-with-vuex (#82)
* Fix incorrect code in example code * Remove whitespace * Update sample code
1 parent df1974a commit da84f1b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/en/guides/using-with-vuex.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,23 @@ describe('Actions.vue', () => {
6767

6868
it('calls store action actionInput when input value is input and an input even is fired', () => {
6969
const wrapper = mount(Actions, { store })
70-
const input = wrapper.find('input')[0]
70+
const input = wrapper.find('input')
7171
input.element.value = 'input'
7272
input.trigger('input')
7373
expect(actions.actionInput.calledOnce).toBe(true)
7474
})
7575

7676
it('does not call store action actionInput when input value is not input and an input even is fired', () => {
7777
const wrapper = mount(Actions, { store })
78-
const input = wrapper.find('input')[0]
78+
const input = wrapper.find('input')
7979
input.element.value = 'not input'
8080
input.trigger('input')
8181
expect(actions.actionInput.calledOnce).toBe(false)
8282
})
8383

8484
it('calls store action actionClick when button is clicked', () => {
8585
const wrapper = mount(Actions, { store })
86-
wrapper.find('button')[0].trigger('click')
86+
wrapper.find('button').trigger('click')
8787
expect(actions.actionClick.calledOnce).toBe(true)
8888
})
8989
})
@@ -159,13 +159,13 @@ describe('Getters.vue', () => {
159159

160160
it('Renders state.inputValue in first p tag', () => {
161161
const wrapper = mount(Actions, { store })
162-
const p = wrapper.find('p')[0]
162+
const p = wrapper.find('p')
163163
expect(p.text()).toBe(getters.inputValue())
164164
})
165165

166166
it('Renders state.clicks in second p tag', () => {
167167
const wrapper = mount(Actions, { store })
168-
const p = wrapper.find('p')[1]
168+
const p = wrapper.findAll('p').at(1)
169169
expect(p.text()).toBe(getters.clicks().toString())
170170
})
171171
})
@@ -245,14 +245,14 @@ describe('Modules.vue', () => {
245245

246246
it('calls store action moduleActionClick when button is clicked', () => {
247247
const wrapper = mount(Modules, { store })
248-
const button = wrapper.find('button')[0]
248+
const button = wrapper.find('button')
249249
button.trigger('click')
250250
expect(actions.moduleActionClick.calledOnce).toBe(true)
251251
})
252252

253253
it('Renders state.inputValue in first p tag', () => {
254254
const wrapper = mount(Modules, { store })
255-
const p = wrapper.find('p')[0]
255+
const p = wrapper.find('p')
256256
expect(p.text()).toBe(state.module.clicks.toString())
257257
})
258258
})

0 commit comments

Comments
 (0)