From 6025b5dcd61562dcb370ba49fe9a206ec323d8a5 Mon Sep 17 00:00:00 2001 From: Neil Lee Date: Thu, 7 Feb 2013 12:22:34 +0800 Subject: [PATCH 1/2] Fix bug: B65-ZK-1585 - Cannot reproduce - temporarily save the testcase --- zktest/src/archive/test2/B65-ZK-1585.zul | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 zktest/src/archive/test2/B65-ZK-1585.zul diff --git a/zktest/src/archive/test2/B65-ZK-1585.zul b/zktest/src/archive/test2/B65-ZK-1585.zul new file mode 100644 index 00000000000..5ce7af118c4 --- /dev/null +++ b/zktest/src/archive/test2/B65-ZK-1585.zul @@ -0,0 +1,23 @@ + + + + + + Result = + + + Decimalbox = + + + + + + + + \ No newline at end of file From ab2396188e1811888ef3d40d7f27b06121247175 Mon Sep 17 00:00:00 2001 From: Neil Lee Date: Thu, 11 Apr 2013 15:21:18 +0800 Subject: [PATCH 2/2] Bug fixed: B65-ZK-1585 - http://tracker.zkoss.org/browse/ZK-1585 - Mobile browsers don't handle l10n properly for input type="number" --- zkdoc/release-note | 1 + zktest/src/archive/test2/B65-ZK-1585.zul | 59 ++++++++++++------- zktest/src/archive/test2/config.properties | 1 + .../test2/B65_ZK_1585_TestDecimalbox.java | 23 ++++++++ .../web/js/zul/inp/NumberInputWidget.js | 8 ++- 5 files changed, 69 insertions(+), 23 deletions(-) create mode 100644 zktest/src/org/zkoss/zktest/test2/B65_ZK_1585_TestDecimalbox.java diff --git a/zkdoc/release-note b/zkdoc/release-note index 4cf617f6d98..d4efba3f3dc 100644 --- a/zkdoc/release-note +++ b/zkdoc/release-note @@ -11,6 +11,7 @@ ZK 6.5.3 ZK-1701: Message for file upload is not good enough in German ZK-1708: Clients.showNotification doesn't work when using auto mode include component ZK-1699: Performance issue ZK-Bind getters are called multiple times + ZK-1585: Strange behavior of decimalbox on iOS and Android -------- ZK 6.5.2 diff --git a/zktest/src/archive/test2/B65-ZK-1585.zul b/zktest/src/archive/test2/B65-ZK-1585.zul index 5ce7af118c4..3032e670bbc 100644 --- a/zktest/src/archive/test2/B65-ZK-1585.zul +++ b/zktest/src/archive/test2/B65-ZK-1585.zul @@ -1,23 +1,40 @@ - + + + Testing instruction (iOS/Android Only): + + 1. Change locale to Italian + 2. Enter '123,45' into the first decimalbox + 3. Change focus to the second decimalbox - - - Result = - - - Decimalbox = - - - - - - - - \ No newline at end of file + Expected result: + 1. The value of the first decimalbox should stay as '123,45'. + 2. It shouldn't be trimmed to display as '123'. + 3. Repeat for '123.45' + 4. The result should be '12345' since '.' is now considered as 'thousands grouping delimiter' + + + + + + + diff --git a/zktest/src/archive/test2/config.properties b/zktest/src/archive/test2/config.properties index c04b4c60b9b..315befa6599 100644 --- a/zktest/src/archive/test2/config.properties +++ b/zktest/src/archive/test2/config.properties @@ -1546,6 +1546,7 @@ B65-ZK-1622.zul=B,M,Window,overlapped,onFloatUp ##ztl##B65-ZK-1693.zul=B,M,Chart,Dial,DialModel ##ztl##B65-ZK-1692.zul=A,M,Widget,ClientEngine B65-ZK-1708.zul=A,M,AuResponse,Include,defer +B65-ZK-1585.zul=B,E,NumberInputElment,localization,Tablet ## # Features - 3.0.x version diff --git a/zktest/src/org/zkoss/zktest/test2/B65_ZK_1585_TestDecimalbox.java b/zktest/src/org/zkoss/zktest/test2/B65_ZK_1585_TestDecimalbox.java new file mode 100644 index 00000000000..2efa75e37d6 --- /dev/null +++ b/zktest/src/org/zkoss/zktest/test2/B65_ZK_1585_TestDecimalbox.java @@ -0,0 +1,23 @@ +package org.zkoss.zktest.test2; +import java.math.BigDecimal; + +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.ext.AfterCompose; +import org.zkoss.zk.ui.util.ConventionWires; +import org.zkoss.zul.Decimalbox; +import org.zkoss.zul.Window; + +@SuppressWarnings("serial") +public class B65_ZK_1585_TestDecimalbox extends Window implements AfterCompose { + private Window finestraIndex; + private Decimalbox decimal; + + public void onCreate$finestraIndex(Event event) { + decimal.setValue(new BigDecimal("125.76")); + } + + public void afterCompose() { + ConventionWires.wireVariables(this, this); + ConventionWires.addForwards(this, this); + } +} diff --git a/zul/src/archive/web/js/zul/inp/NumberInputWidget.js b/zul/src/archive/web/js/zul/inp/NumberInputWidget.js index 6b42aef8431..544e8721bef 100644 --- a/zul/src/archive/web/js/zul/inp/NumberInputWidget.js +++ b/zul/src/archive/web/js/zul/inp/NumberInputWidget.js @@ -80,14 +80,18 @@ zul.inp.NumberInputWidget = zk.$extends(zul.inp.FormatWidget, { return this._allowKeys || _allowKeys; }, doKeyPress_: function(evt){ - //Bug ZK-1373: ALTGR + 3 key in Spanish keyboard is a combination of Ctrl + Alt + 3 for £á sign. + //Bug ZK-1373: ALTGR + 3 key in Spanish keyboard is a combination of Ctrl + Alt + 3 for £á sign. if (evt.ctrlKey && evt.altKey) evt.stop(); if (!this._shallIgnore(evt, this.getAllowedKeys_())) this.$supers('doKeyPress_', arguments); }, getType: function () { - return zk.mobile ? 'number' : this._type; + // ZK-1585: Strange behavior of decimalbox on iOS and Android + // European locale (e.g. Italian) uses ',' for decimal point. + // However, Safari Mobile would trim the number string '123,45' to '123' + // if that string is entered into input type='number'. + return zk.mobile ? ((zk.DECIMAL == '.') ? 'number' : 'text') : this._type; } }); })();