File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 3
3
v-if =" !readOnly"
4
4
ref =" numeric"
5
5
:placeholder =" placeholder"
6
+ :disabled =" disabled"
6
7
v-model =" amount"
7
8
type =" tel"
8
9
@blur =" onBlurHandler"
@@ -154,6 +155,12 @@ export default {
154
155
required: false
155
156
},
156
157
158
+ disabled: {
159
+ type: Boolean ,
160
+ default: false ,
161
+ required: false ,
162
+ },
163
+
157
164
/**
158
165
* Position of currency symbol
159
166
* Symbol position props accept either 'suffix' or 'prefix' (default).
@@ -162,7 +169,7 @@ export default {
162
169
type: String ,
163
170
default: ' prefix' ,
164
171
required: false
165
- }
172
+ },
166
173
},
167
174
168
175
data : () => ({
Original file line number Diff line number Diff line change @@ -109,6 +109,28 @@ describe('vue-numeric.vue', () => {
109
109
} )
110
110
} )
111
111
112
+ it ( 'is is not disabled when disabled mode is disabled' , done => {
113
+ const propsData = { value : 3000 , disabled : true }
114
+ const wrapper = mount ( VueNumeric , { propsData } )
115
+
116
+ wrapper . setProps ( { disabled : false } )
117
+ wrapper . instance ( ) . $nextTick ( ( ) => {
118
+ expect ( wrapper . instance ( ) . $el . hasAttribute ( 'disabled' ) ) . to . equal ( false )
119
+ done ( )
120
+ } )
121
+ } )
122
+
123
+ it ( 'is disabled in disabled mode' , done => {
124
+ const propsData = { value : 3000 , disabled : false }
125
+ const wrapper = mount ( VueNumeric , { propsData } )
126
+
127
+ wrapper . setProps ( { disabled : true } )
128
+ wrapper . instance ( ) . $nextTick ( ( ) => {
129
+ expect ( wrapper . instance ( ) . $el . hasAttribute ( 'disabled' ) ) . to . equal ( true )
130
+ done ( )
131
+ } )
132
+ } ) ;
133
+
112
134
it ( 'cannot exceed max props' , ( ) => {
113
135
const component = Vue . extend ( {
114
136
data : ( ) => ( { total : 150 } ) ,
You can’t perform that action at this time.
0 commit comments