Browse Source

fix coverage

dev
Evan You 8 years ago
parent
commit
cc4c066989
  1. 7
      src/core/util/props.js
  2. 5
      test/unit/features/component/component-slot.spec.js
  3. 24
      test/unit/features/directives/for.spec.js

7
src/core/util/props.js

@ -162,15 +162,14 @@ function getType (fn) {
}
function isBooleanType (fn) {
const isBoolean = (fnItem) => getType(fnItem) === 'Boolean'
if (!Array.isArray(fn)) {
return isBoolean(fn)
return getType(fn) === 'Boolean'
}
for (let i = 0, len = fn.length; i < len; i++) {
if (isBoolean(fn[i])) {
if (getType(fn[i]) === 'Boolean') {
return true
}
}
/* istanbul ignore next */
return false
}

5
test/unit/features/component/component-slot.spec.js

@ -565,7 +565,10 @@ describe('Component slot', () => {
template: `<div><slot name="a"></slot><slot></slot></div>`
},
child: {
template: '<div><slot></slot></div>'
functional: true,
render (h, { slots }) {
return h('div', slots().default)
}
}
}
}).$mount()

24
test/unit/features/directives/for.spec.js

@ -404,4 +404,28 @@ describe('Directive v-for', () => {
expect(vm.$el.innerHTML).toContain('<div>Two!</div><p>One!</p>')
}).then(done)
})
it('multi nested array reactivity', done => {
const vm = new Vue({
data: {
list: [[['foo']]]
},
template: `
<div>
<div v-for="i in list">
<div v-for="j in i">
<div v-for="k in j">
{{ k }}
</div>
</div>
</div>
</div>
`
}).$mount()
expect(vm.$el.textContent).toMatch(/\s+foo\s+/)
vm.list[0][0].push('bar')
waitForUpdate(() => {
expect(vm.$el.textContent).toMatch(/\s+foo\s+bar\s+/)
}).then(done)
})
})

Loading…
Cancel
Save