Skip to content

Commit dc28b47

Browse files
committed
update tests
1 parent ee0d883 commit dc28b47

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/specs/vue-numeric.spec.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,26 @@ describe('vue-numeric.vue', () => {
184184
const wrapper = mount(VueNumeric, { propsData: { value: 2000, placeholder: 'number here' }})
185185
expect(wrapper.data().amount).to.equal('')
186186
})
187+
188+
it('apply min props value if user input negative value when minus props disabled', () => {
189+
const component = Vue.extend({
190+
data: () => ({ total: -200 }),
191+
template: '<div><vue-numeric v-model="total" :min="150" :minus="false"></vue-numeric></div>',
192+
components: { VueNumeric }
193+
})
194+
195+
const wrapper = mount(component)
196+
expect(wrapper.data().total).to.equal(150)
197+
})
198+
199+
it('apply 0 value if user input negative value when minus props disabled and min props is negative too', () => {
200+
const component = Vue.extend({
201+
data: () => ({ total: -200 }),
202+
template: '<div><vue-numeric v-model="total" :min="-150" :minus="false"></vue-numeric></div>',
203+
components: { VueNumeric }
204+
})
205+
206+
const wrapper = mount(component)
207+
expect(wrapper.data().total).to.equal(0)
208+
})
187209
})

0 commit comments

Comments
 (0)