Skip to content

Instantly share code, notes, and snippets.

@mantaroh
Last active September 6, 2018 08:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Bug534628
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/fixture/TestUtil.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/fixture/TestUtil.js
index 138591b29..9d80afa23 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/fixture/TestUtil.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/fixture/TestUtil.js
@@ -350,10 +350,7 @@ org.eclipse.rwt.test.fixture.TestUtil = {
"Pause" : 19,
"Win" : 91,
"Apps" : 93,
- "Enter" : rwt.util.Variant.select("qx.client", {
- "default" : null,
- "gecko" : 13
- } ),
+ "Enter" : null,
"Escape" : 27
},
@@ -362,10 +359,7 @@ org.eclipse.rwt.test.fixture.TestUtil = {
"Tab" : 9,
"Escape" : 27,
"Space" : 32,
- "Enter" : rwt.util.Variant.select("qx.client", {
- "default" : 13,
- "gecko" : null
- } )
+ "Enter" : 13
},
pressOnce : function( target, key, mod ) {
@@ -399,9 +393,6 @@ org.eclipse.rwt.test.fixture.TestUtil = {
var wasStopped = keyDownEvent
? rwt.event.EventHandlerUtil.wasStopped( keyDownEvent )
: false;
- if( rwt.client.Client.isGecko() ) {
- return !this._isModifier( key ) && !wasStopped;
- }
return this._isPrintable( key ) && !wasStopped;
},
@@ -422,26 +413,23 @@ org.eclipse.rwt.test.fixture.TestUtil = {
return domEvent;
},
- _getKeyCode : rwt.util.Variant.select("qx.client", {
- "default" : function( type, stringOrKeyCode ) {
- var result;
- if( type === "keypress" && this._isPrintable( stringOrKeyCode ) ) {
- result = this._convertToCharCode( stringOrKeyCode );
- } else {
- result = this._convertToKeyCode( stringOrKeyCode );
- }
- return result;
- },
- "gecko" : function( type, stringOrKeyCode ) {
- var result;
- if( type === "keypress" && this._isPrintable( stringOrKeyCode ) ) {
- result = this._isEscape( stringOrKeyCode ) ? 27 : 0;
+ _getKeyCode : function( type, stringOrKeyCode ) {
+ var result;
+ if( type === "keypress" && this._isPrintable( stringOrKeyCode ) ) {
+ if (rwt.client.Client.isGecko() ) {
+ if ( stringOrKeyCode === 13 || stringOrKeyCode === "Enter") {
+ result = this._convertToKeyCode( stringOrKeyCode);
+ } else {
+ result = this._isEscape( stringOrKeyCode ) ? 27 : 0;
+ }
} else {
- result = this._convertToKeyCode( stringOrKeyCode );
+ result = this._convertToCharCode( stringOrKeyCode );
}
- return result;
+ } else {
+ result = this._convertToKeyCode( stringOrKeyCode );
}
- } ),
+ return result;
+ },
_getCharCode : rwt.util.Variant.select("qx.client", {
"default" : function() {
@@ -454,7 +442,12 @@ org.eclipse.rwt.test.fixture.TestUtil = {
&& this._isPrintable( stringOrKeyCode )
&& !this._isEscape( stringOrKeyCode )
) {
- result = this._convertToCharCode( stringOrKeyCode );
+ if (rwt.client.Client.isGecko() &&
+ ( stringOrKeyCode === 13 || stringOrKeyCode === "Enter") ) {
+ result = 0;
+ } else {
+ result = this._convertToCharCode( stringOrKeyCode );
+ }
} else {
result = 0;
}
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TestUtilTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TestUtilTest.js
index 3c9416240..fb892677c 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TestUtilTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TestUtilTest.js
@@ -405,71 +405,40 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.TestUtilTest", {
widget.destroy();
},
- testSendKeyPress : rwt.util.Variant.select("qx.client", {
- "gecko" : function() {
- assertTrue( TestUtil._sendKeyPress( "a" ) );
- assertTrue( TestUtil._sendKeyPress( "A" ) );
- assertTrue( TestUtil._sendKeyPress( 65 ) );
- assertTrue( TestUtil._sendKeyPress( "Enter" ) );
- assertTrue( TestUtil._sendKeyPress( 13 ) );
- assertTrue( TestUtil._sendKeyPress( "F1" ) );
- assertTrue( TestUtil._sendKeyPress( 112 ) );
- assertTrue( TestUtil._sendKeyPress( "Space" ) );
- assertTrue( TestUtil._sendKeyPress( 32 ) );
+ testSendKeyPress : function() {
+ assertTrue( TestUtil._sendKeyPress( "a" ) );
+ assertTrue( TestUtil._sendKeyPress( "A" ) );
+ assertTrue( TestUtil._sendKeyPress( 65 ) );
+ assertTrue( TestUtil._sendKeyPress( "Enter" ) );
+ assertTrue( TestUtil._sendKeyPress( 13 ) );
+ assertFalse( TestUtil._sendKeyPress( "F1" ) );
+ assertFalse( TestUtil._sendKeyPress( 112 ) );
+ assertTrue( TestUtil._sendKeyPress( "Space" ) );
+ assertTrue( TestUtil._sendKeyPress( 32 ) );
+ if( rwt.client.Client.isWebkit() || rwt.client.Client.isBlink() ) {
+ assertFalse( TestUtil._sendKeyPress( "Escape" ) );
+ assertFalse( TestUtil._sendKeyPress( 27 ) );
+ } else {
assertTrue( TestUtil._sendKeyPress( "Escape" ) );
assertTrue( TestUtil._sendKeyPress( 27 ) );
- assertTrue( TestUtil._sendKeyPress( "Tab" ) );
- assertTrue( TestUtil._sendKeyPress( 9 ) );
- assertTrue( TestUtil._sendKeyPress( "Backspace" ) );
- assertTrue( TestUtil._sendKeyPress( 8 ) );
- assertTrue( TestUtil._sendKeyPress( "Win" ) );
- assertTrue( TestUtil._sendKeyPress( 91 ) );
- assertTrue( TestUtil._sendKeyPress( "Left" ) );
- assertTrue( TestUtil._sendKeyPress( 37 ) );
- assertTrue( TestUtil._sendKeyPress( "Apps" ) );
- assertTrue( TestUtil._sendKeyPress( 93 ) );
- assertFalse( TestUtil._sendKeyPress( "Shift" ) );
- assertFalse( TestUtil._sendKeyPress( 16 ) );
- assertFalse( TestUtil._sendKeyPress( "Control" ) );
- assertFalse( TestUtil._sendKeyPress( 17 ) );
- assertFalse( TestUtil._sendKeyPress( "Alt" ) );
- assertFalse( TestUtil._sendKeyPress( 18 ) );
- },
- "default" : function() {
- assertTrue( TestUtil._sendKeyPress( "a" ) );
- assertTrue( TestUtil._sendKeyPress( "A" ) );
- assertTrue( TestUtil._sendKeyPress( 65 ) );
- assertTrue( TestUtil._sendKeyPress( "Enter" ) );
- assertTrue( TestUtil._sendKeyPress( 13 ) );
- assertFalse( TestUtil._sendKeyPress( "F1" ) );
- assertFalse( TestUtil._sendKeyPress( 112 ) );
- assertTrue( TestUtil._sendKeyPress( "Space" ) );
- assertTrue( TestUtil._sendKeyPress( 32 ) );
- if( rwt.client.Client.isWebkit() || rwt.client.Client.isBlink() ) {
- assertFalse( TestUtil._sendKeyPress( "Escape" ) );
- assertFalse( TestUtil._sendKeyPress( 27 ) );
- } else {
- assertTrue( TestUtil._sendKeyPress( "Escape" ) );
- assertTrue( TestUtil._sendKeyPress( 27 ) );
- }
- assertFalse( TestUtil._sendKeyPress( "Tab" ) );
- assertFalse( TestUtil._sendKeyPress( 9 ) );
- assertFalse( TestUtil._sendKeyPress( "Backspace" ) );
- assertFalse( TestUtil._sendKeyPress( 8 ) );
- assertFalse( TestUtil._sendKeyPress( "Win" ) );
- assertFalse( TestUtil._sendKeyPress( 91 ) );
- assertFalse( TestUtil._sendKeyPress( "Left" ) );
- assertFalse( TestUtil._sendKeyPress( 37 ) );
- assertFalse( TestUtil._sendKeyPress( "Apps" ) );
- assertFalse( TestUtil._sendKeyPress( 93 ) );
- assertFalse( TestUtil._sendKeyPress( "Shift" ) );
- assertFalse( TestUtil._sendKeyPress( 16 ) );
- assertFalse( TestUtil._sendKeyPress( "Control" ) );
- assertFalse( TestUtil._sendKeyPress( 17 ) );
- assertFalse( TestUtil._sendKeyPress( "Alt" ) );
- assertFalse( TestUtil._sendKeyPress( 18 ) );
}
- } ),
+ assertFalse( TestUtil._sendKeyPress( "Tab" ) );
+ assertFalse( TestUtil._sendKeyPress( 9 ) );
+ assertFalse( TestUtil._sendKeyPress( "Backspace" ) );
+ assertFalse( TestUtil._sendKeyPress( 8 ) );
+ assertFalse( TestUtil._sendKeyPress( "Win" ) );
+ assertFalse( TestUtil._sendKeyPress( 91 ) );
+ assertFalse( TestUtil._sendKeyPress( "Left" ) );
+ assertFalse( TestUtil._sendKeyPress( 37 ) );
+ assertFalse( TestUtil._sendKeyPress( "Apps" ) );
+ assertFalse( TestUtil._sendKeyPress( 93 ) );
+ assertFalse( TestUtil._sendKeyPress( "Shift" ) );
+ assertFalse( TestUtil._sendKeyPress( 16 ) );
+ assertFalse( TestUtil._sendKeyPress( "Control" ) );
+ assertFalse( TestUtil._sendKeyPress( 17 ) );
+ assertFalse( TestUtil._sendKeyPress( "Alt" ) );
+ assertFalse( TestUtil._sendKeyPress( 18 ) );
+ },
testPressPrintable : function() {
var widget = new rwt.widgets.base.Terminator();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment