🌐 AI搜索 & 代理 主页
Skip to content

Commit 38cec46

Browse files
authored
Update table-provider.spec.js
1 parent cc16030 commit 38cec46

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/components/table/table-provider.spec.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,21 @@ describe('table > provider functions', () => {
318318

319319
it('provider is called when filter object child property is changed', async () => {
320320
let lastProviderContext = null
321-
const filter = {
322-
a: '123'
323-
}
324321
const provider = ctx => {
325322
lastProviderContext = ctx
326323
return testItems.slice()
327324
}
328-
const wrapper = mount(BTable, {
329-
propsData: {
330-
filter,
331-
items: provider
325+
const app = {
326+
data() {
327+
// We use `this.$data` to get around a "bug" in Vue test utils that
328+
// doesn't let us change a child property in an object and update
329+
//that prop with the same object reference
330+
return {
331+
a: '123'
332+
}
333+
},
334+
render(h) {
335+
h(BTable, { props: { filter: this.$data, items: provider } })
332336
}
333337
})
334338

@@ -340,9 +344,8 @@ describe('table > provider functions', () => {
340344
})
341345

342346
// Change the filter criteria child property, but not the object reference
343-
filter.a = '456'
344-
wrapper.setProps({
345-
filter: filter
347+
wrapper.setData({
348+
a: '456'
346349
})
347350

348351
await waitNT(wrapper.vm)

0 commit comments

Comments
 (0)