org.dojo.dijit.tests.i18n.currency.html Maven / Gradle / Ivy
Test CurrencyTextBox
Dijit TextBox Globalization Test for Currency
Before start this test, make sure the dojo/cldr/nls contains the data for "zh-cn", "fr-fr", "ja-jp" and "ar-eg"
and currencies CNY, EGP, EUR, JPY. If not, convert these CLDR data and put them there.
Issues & Comments
Issue #1Fixed
Some browsers like FireFox have a bug on the non-breaking space character (U+00A0, or   or
  in HTML).
They always convert the NBSP character to a normal space (U+0020,   in HTML) automatically in the following circumstances:
- Copy text from the page
- Use innerHTML to get the content of a certain element
- Use value to get an INPUT element's value
You cannot read a real NBSP character from an INPUT element on these browsers. It causes issues when some formatting data in CLDR
contains an NBSP character. For example,
- Many locales like French use an NBSP character as a group separator in numbers
- French and Finnish use NBSP characters in their percentage and currency format patterns respectively
- Russian uses NBSP characters in their date format pattern (see test_validateDate.html)
So Dojo may generate formatted data with NBSP characters in it but cannot read NBSP charaters from user's input in some browser.
Issue #2Fixed: the CLDR data generator should be fixed by adding code to convert U+200F to "\u200F" in nls JS files.
Most Bidi currency symbols contain an LTR-MARK (U+200F) character at the very beginning.
But Firefox ignores it when it is not in any escaping form. This should be a bug of Firefox.
For example, click alert(''.indexOf('\u+200F'))
(there is a U+200F in the empty-looking string):
- In Firefox, shows "-1" -- no U+200F found
- In IE & Opera, shows "0" -- the U+200F is found
But if the U+200F is in some escaping form, Firefox will work as well as other browsers.
Click alert('\u200F'.indexOf('\u+200F'))
to see the same result both in Firefox and IE:
Issue #3Fixed: added a "localeDigit" to the options
Strictly speaking, the data conversion must support non-European number characters in some locales like Arabic and Hindi.
For example, ICU formats a number data into Indic number characters by default in the Arabic locale.
However, currently Dojo does not support this feature (Dojo uses the default number conversion of the browser).