Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions docs/.vitepress/theme/components/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,28 @@ export default defineComponent({
value: 1234.5,
localeEnabled: false,
locale: 'de-DE',
locales: ['de-DE', 'de-CH', 'en-US', 'en-IN', 'nl-NL', 'sv-SE', 'fr-FR', 'es-ES', 'pt-PT', 'pt-BR', 'zh-ZH', 'ja-JP', 'ar-SA', 'fa-IR', 'bg-BG'],
locales: [
'ar-SA',
'bg-BG',
'cs-CZ',
'de-CH',
'de-DE',
'en-IN',
'en-US',
'es-ES',
'fa-IR',
'fr-FR',
'ja-JP',
'nl-NL',
'pl-PL',
'pt-BR',
'pt-PT',
'sv-SE',
'zh-ZH'
],
currency: 'EUR',
currencyDisplay: 'symbol',
currencies: ['EUR', 'USD', 'JPY', 'GBP', 'BRL', 'INR', 'CNY', 'JPY', 'SAR', 'IRR', 'BGN'],
currencies: ['EUR', 'USD', 'BGN', 'BRL', 'CNY', 'CZK', 'GBP', 'INR', 'IRR', 'JPY', 'PLN', 'SAR'],
currencyDisplays: [
{ value: 'symbol', label: 'Symbol' },
{ value: 'narrowSymbol', label: 'Narrow symbol' },
Expand All @@ -281,11 +299,11 @@ export default defineComponent({
hideNegligibleDecimalDigitsOnFocus: true,
precisionEnabled: false,
precisionRangeEnabled: false,
precisionRangeMinValue: 2,
precisionRangeMinValue: 1,
precisionRangeMaxValue: 5,
precision: 2,
precisionOptions: computed(() => range(1, 16)),
precisionRangeMinOptions: computed(() => range(1, state.precisionRangeMaxValue + 1)),
precisionOptions: computed(() => range(0, 16)),
precisionRangeMinOptions: computed(() => range(0, state.precisionRangeMaxValue + 1)),
precisionRangeMaxOptions: computed(() => range(state.precisionRangeMinValue, 16)),
valueRangeEnabled: false,
minValue: undefined,
Expand Down
1 change: 1 addition & 0 deletions tests/unit/currencyFormat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ describe('CurrencyFormat', () => {
expect(new CurrencyFormat({ locale: 'de-AT', currency: 'EUR' }).parse('€ 66.668')).toBe(66668)
expect(new CurrencyFormat({ locale: 'de-DE', currency: 'USD', currencyDisplay: CurrencyDisplay.name }).parse('1.234,50 US-Dollar')).toBe(1234.5)
expect(new CurrencyFormat({ locale: 'en', currency: 'USD', accountingSign: true }).parse('(1,234.50)')).toBe(-1234.5)
expect(new CurrencyFormat({ locale: 'pl-PL', currency: 'PLN' }).parse('1234,50 zł')).toBe(-1234.5)
})

it('should return null if the value does not conform to the currency format', () => {
Expand Down