@@ -190,6 +190,78 @@ describe('vue-numeric', () => {
190190 } )
191191 } )
192192
193+ it ( 'allow minus value when minus props is true' , done => {
194+ const vm = new Vue ( {
195+ el,
196+ data ( ) {
197+ return {
198+ total : - 100
199+ }
200+ } ,
201+ template : '<div><vue-numeric v-model="total" :minus="true"></vue-numeric></div>' ,
202+ components : { VueNumeric }
203+ } ) . $mount ( )
204+
205+ Vue . nextTick ( ( ) => {
206+ expect ( vm . $el . firstChild . value . trim ( ) ) . toEqual ( '-100' )
207+ done ( )
208+ } )
209+ } )
210+
211+ it ( 'disallow minus value when minus props is false' , done => {
212+ const vm = new Vue ( {
213+ el,
214+ data ( ) {
215+ return {
216+ total : - 100
217+ }
218+ } ,
219+ template : '<div><vue-numeric v-model="total" :minus="false"></vue-numeric></div>' ,
220+ components : { VueNumeric }
221+ } ) . $mount ( )
222+
223+ Vue . nextTick ( ( ) => {
224+ expect ( vm . $el . firstChild . value . trim ( ) ) . toEqual ( '100' )
225+ done ( )
226+ } )
227+ } )
228+
229+ it ( 'value cannot exceed max props' , done => {
230+ const vm = new Vue ( {
231+ el,
232+ data ( ) {
233+ return {
234+ total : 150
235+ }
236+ } ,
237+ template : '<div><vue-numeric v-model="total" :max="100"></vue-numeric></div>' ,
238+ components : { VueNumeric }
239+ } ) . $mount ( )
240+
241+ Vue . nextTick ( ( ) => {
242+ expect ( vm . $el . firstChild . value . trim ( ) ) . toEqual ( '100' )
243+ done ( )
244+ } )
245+ } )
246+
247+ it ( 'value cannot below min props' , done => {
248+ const vm = new Vue ( {
249+ el,
250+ data ( ) {
251+ return {
252+ total : 150
253+ }
254+ } ,
255+ template : '<div><vue-numeric v-model="total" :min="200"></vue-numeric></div>' ,
256+ components : { VueNumeric }
257+ } ) . $mount ( )
258+
259+ Vue . nextTick ( ( ) => {
260+ expect ( vm . $el . firstChild . value . trim ( ) ) . toEqual ( '200' )
261+ done ( )
262+ } )
263+ } )
264+
193265 it ( 'updates value with currency symbol' , done => {
194266 const vm = new Vue ( {
195267 el,
@@ -210,5 +282,4 @@ describe('vue-numeric', () => {
210282 done ( )
211283 } )
212284 } )
213-
214285} )
0 commit comments