-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [WT-2150] Checkout Widget amount inputs correctly handle decimal…
… inputs (#1473)
- Loading branch information
1 parent
b143bc1
commit 304ec1a
Showing
5 changed files
with
67 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
44 changes: 44 additions & 0 deletions
44
...ges/checkout/widgets-lib/src/components/FormComponents/TextInputForm/TextInputForm.cy.tsx
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,44 @@ | ||
import { mount } from 'cypress/react18'; | ||
import { describe } from 'local-cypress'; | ||
import { ViewContextTestComponent } from 'context/view-context/test-components/ViewContextTestComponent'; | ||
import { cySmartGet } from '../../../lib/testUtils'; | ||
import { TextInputForm } from './TextInputForm'; | ||
|
||
describe('TextInputForm', () => { | ||
describe('type number', () => { | ||
it('should convert . into zero number when type is number input', () => { | ||
mount( | ||
<ViewContextTestComponent> | ||
<TextInputForm | ||
type="number" | ||
testId="text-input-form-test" | ||
value="" | ||
validator={() => true} | ||
onTextInputChange={() => {}} | ||
/> | ||
</ViewContextTestComponent>, | ||
); | ||
cySmartGet('text-input-form-test-select__input').type('.'); | ||
cySmartGet('text-input-form-test-select__input').trigger('change'); | ||
cySmartGet('text-input-form-test-select__target__controlledLabel').should('have.text', '0.'); | ||
}); | ||
}); | ||
|
||
describe('type text or no type', () => { | ||
it('should preserve . as .', () => { | ||
mount( | ||
<ViewContextTestComponent> | ||
<TextInputForm | ||
testId="text-input-form-test" | ||
value="" | ||
validator={() => true} | ||
onTextInputChange={() => {}} | ||
/> | ||
</ViewContextTestComponent>, | ||
); | ||
cySmartGet('text-input-form-test-select__input').type('.'); | ||
cySmartGet('text-input-form-test-select__input').trigger('change'); | ||
cySmartGet('text-input-form-test-select__target__controlledLabel').should('have.text', '.'); | ||
}); | ||
}); | ||
}); |
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
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