Skip to content

Commit 0061846

Browse files
committed
Added title prop test
1 parent e1d522b commit 0061846

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

test/unit/specs/misc_spec.js

+44
Original file line numberDiff line numberDiff line change
@@ -269,4 +269,48 @@ describe('Misc', function () {
269269
})
270270
expect(hasWarned(__, 'Unknown custom element')).toBe(true)
271271
})
272+
273+
it('prefer bound title over static title', function (done) {
274+
var el = document.createElement('div')
275+
var count = 0
276+
var expected = [
277+
'bound',
278+
'bound',
279+
'static',
280+
'bound',
281+
'bound'
282+
]
283+
function check (title) {
284+
expect(title).toBe(expected[count])
285+
count++
286+
if (count === 4) {
287+
done()
288+
}
289+
}
290+
291+
document.body.appendChild(el)
292+
293+
new Vue({
294+
el: el,
295+
template:
296+
'<div>\
297+
<comp v-bind:title="title"></comp>\
298+
<comp title="static" v-bind:title="title"></comp>\
299+
<comp title="static"></comp>\
300+
<comp :title="title"></comp>\
301+
<comp title="static" :title="title"></comp>\
302+
</div>',
303+
data: {
304+
title: 'bound'
305+
},
306+
components: {
307+
comp: {
308+
props: ['title'],
309+
ready: function () {
310+
check(this.title)
311+
}
312+
}
313+
}
314+
})
315+
})
272316
})

0 commit comments

Comments
 (0)