generated from Tinkoff/angular-open-source-starter
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(kit):
Number
+ postfix (with leading space) adds unnecessary sp…
…aces on paste value with trailing spaces (#1865)
- Loading branch information
1 parent
073f93c
commit c37b1d6
Showing
4 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
projects/demo-integrations/src/tests/component-testing/number/mirrored-value-postfix.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {maskitoNumberOptionsGenerator} from '@maskito/kit'; | ||
|
||
import {TestInput} from '../utils'; | ||
|
||
describe('Number | [postfix]=" EUR" (no initial value & no caret guard)', () => { | ||
beforeEach(() => { | ||
cy.mount(TestInput, { | ||
componentProperties: { | ||
initialValue: '', | ||
maskitoOptions: maskitoNumberOptionsGenerator({ | ||
postfix: ' EUR', | ||
precision: 2, | ||
}), | ||
}, | ||
}); | ||
cy.get('input').focus().should('have.value', '').as('input'); | ||
}); | ||
|
||
it('Empty input => Paste "11.22 " => 11.22 |EUR', () => { | ||
cy.get('input') | ||
.paste('11.22 ') | ||
.should('have.value', '11.22 EUR') | ||
.should('have.prop', 'selectionStart', '11.22 '.length) | ||
.should('have.prop', 'selectionEnd', '11.22 '.length); | ||
}); | ||
|
||
it('Empty input => Paste "11.22 " (with two trailing spaces) => 11.22 |EUR', () => { | ||
cy.get('input') | ||
.paste('11.22 ') | ||
.should('have.value', '11.22 EUR') | ||
.should('have.prop', 'selectionStart', '11.22 '.length) | ||
.should('have.prop', 'selectionEnd', '11.22 '.length); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters