Skip to content

Commit 7e3de5f

Browse files
committed
feat: add short prop as option to the component
1 parent 928fdb0 commit 7e3de5f

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/component.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,21 @@ export default {
5757
default: false
5858
},
5959
/**
60-
* If the mask value starts with static charaters, prefill it with the static charecters at load.
61-
\ * @since v1.3
60+
* If the mask starts with static charaters, prefill the field with said characters
61+
* @since v1.3
6262
*/
6363
prefill: {
6464
type: Boolean,
6565
default: false
6666
},
67+
/**
68+
* Keep the value short by not showing static characters until after typing
69+
* @since v1.3
70+
*/
71+
short: {
72+
type: Boolean,
73+
default: false
74+
},
6775
/**
6876
* Token object to override the defaults with
6977
*/
@@ -106,7 +114,8 @@ export default {
106114
mask: this.mask,
107115
tokens: this.tokens,
108116
formatter: this.formatter,
109-
prefill: this.prefill
117+
prefill: this.prefill,
118+
short: this.short
110119
}
111120
},
112121
emittedValue() {

tests/directive.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ describe('Directive', () => {
7979
test('Should honor short modifier', async () => {
8080
buildWrapper({ modifiers: 'short', value: '12' })
8181
expect(wrapper.element.value).toBe('12')
82-
82+
8383
wrapper.element.value = '1234'
8484
wrapper.find('input').trigger('input')
85-
85+
8686
expect(wrapper.element.value).toBe('12.34')
8787
expect(wrapper.element.unmaskedValue).toBe('1234')
8888
})

0 commit comments

Comments
 (0)