コード例 #1
0
 it('should switch the option template to the one provided in the partial', () => {
   Vue.partial('customPartial', '<span>test_test</span>')
   const vm = new Vue({
     template: '<multiselect :selected="value" :searchable="true" :options="source" :multiple="true" :limit="1" option-partial="customPartial"></multiselect>',
     components: { Multiselect },
     data: {
       value: ['1', '2', '3'],
       source: ['1', '2', '3', '4', '5']
     }
   }).$mount()
   vm.$children[0].activate()
   expect(vm.$children[0].$els.list.children[0].children[0].textContent).to.equal('test_test')
 })
コード例 #2
0
ファイル: errors.js プロジェクト: EagleSmith/WebApp
 beforeEach((done) => {
   el.innerHTML = '<validator name="validation">'
     + '<input type="text" v-validate:field1="field1">'
     + '<input type="text" v-validate:field2="field2">'
     + '<validator-errors :partial="\'custom-error\'":validation="$validation"></validator-errors>'
     + '</validator>'
   Vue.partial('custom-error', '<span>{{field}}:{{validator}}:{{message}}</span>')
   vm = new Vue({
     el: el,
     data: {
       field1: { pattern: { rule: '/foo/', message: 'field1 pattern error' } },
       field2: { 
         required: { rule: true, message: 'field2 required' },
         minlength: { rule: 2, message: 'field2 short too' }
       }
     }
   })
   vm.$nextTick(done)
 })