Skip to content

Commit

Permalink
Improved code
Browse files Browse the repository at this point in the history
  • Loading branch information
calebeoliveira committed Aug 9, 2018
1 parent d7dbca2 commit 41faea5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/flutter_masked_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class MaskedTextController extends TextEditingController {
}

void updateMask(String mask) {
this.text = this._applyMask(mask, this.text);
this.mask = mask;
this.updateText(this.text);
}

@override
Expand Down
4 changes: 2 additions & 2 deletions test/flutter_masked_text_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ void main() {

expect(cpfController.text, '123.456.789-01');

cpfController.updateMask('000.000.000.00');
cpfController.updateMask('000.000.0000-0');

expect(cpfController.text, '123.456.789.01');
expect(cpfController.text, '123.456.7890-1');
});

test('abc123 with mask AAA results abc', () {
Expand Down

0 comments on commit 41faea5

Please sign in to comment.