-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: input currency decimals rounding and trim zero (#361)
# Motivation While testing the new `currency` mode of the `Input` property in Oisy, I noticed two issues which are corrected by this PR. Leading zeros were added to the binded property (entering 0. lead to 0.000000000000) and JS was rounding the number imprecisely even though this mode requires a string as output. # Changes - use internationalization to wrap the decimals of the "currency"
- Loading branch information
1 parent
5e5752b
commit 3ba8a56
Showing
4 changed files
with
51 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
const testUrl = "/components/input"; | ||
|
||
test("should trim zero", async ({ page }) => { | ||
await page.goto(testUrl); | ||
|
||
const input = page.getByTestId("amount-decimals"); | ||
await input.fill("0."); | ||
|
||
const output = page.getByTestId("amount-decimals-output"); | ||
await expect(output).toHaveText("0", { timeout: 500 }); | ||
}); |
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