Skip to content

Commit

Permalink
fix #1044
Browse files Browse the repository at this point in the history
  • Loading branch information
uNmAnNeR committed Oct 11, 2024
1 parent d1fe83e commit efdb875
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
23 changes: 6 additions & 17 deletions packages/imask/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,14 @@ <h1>IMask Core Demo</h1>
<!-- <script src="https://unpkg.com/imask"></script> -->
<script type="text/javascript">
const opts = {
mask: 'VLv\\alue MM',
lazy: false, // make placeholder always visible

blocks: {
YY: {
mask: '00',
},

VL: {
mask: IMask.MaskedEnum,
enum: ['TV', 'HD', 'VR'],
mask: [
{
mask: '000.000.000-00',
},

MM: {
mask: IMask.MaskedRange,
from: 1,
to: 12,
{
mask: '00.000.000/0000-00',
},
},
],
};

const input = document.getElementById('input');
Expand Down
2 changes: 1 addition & 1 deletion packages/imask/src/masked/pattern/fixed-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class PatternFixedDefinition implements PatternBlock {
rawInserted: isResolved ? this.char: '',
})
this._value = this.char;
this._isRawInput = isResolved && (flags.raw || flags.input);
this._isRawInput = isResolved && flags.raw;

return details;
}
Expand Down
12 changes: 12 additions & 0 deletions packages/imask/test/masked/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ describe('MaskedDynamic', function () {
assert.equal(masked.value, '12__5_');
});

it('should consider only raw input', function () {
masked.updateOptions({
mask: [
{ mask: '000.000.000-00' },
{ mask: '00.000.000/0000-00' },
],
});

masked.resolve('123.456.789-012');
assert.equal(masked.value, '12.345.678/9012');
});

describe('expose', function () {
it('should expose number', function () {
const mask = new MaskedDynamic<number>({
Expand Down

0 comments on commit efdb875

Please sign in to comment.