File tree Expand file tree Collapse file tree 2 files changed +3
-24
lines changed
testing/tests/DevExpress.ui.widgets Expand file tree Collapse file tree 2 files changed +3
-24
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,6 @@ export class Button extends InfernoWrapperComponent<ButtonProps> {
8080 this . onInactive = this . onInactive . bind ( this ) ;
8181 this . onWidgetClick = this . onWidgetClick . bind ( this ) ;
8282 this . keyDown = this . keyDown . bind ( this ) ;
83- this . emitClickEvent = this . emitClickEvent . bind ( this ) ;
8483 }
8584
8685 createEffects ( ) : InfernoEffect [ ] {
@@ -165,17 +164,15 @@ export class Button extends InfernoWrapperComponent<ButtonProps> {
165164 if ( result ?. cancel ) {
166165 return result ;
167166 }
167+
168168 if ( keyName === 'space' || which === 'space' || keyName === 'enter' || which === 'enter' ) {
169169 originalEvent . preventDefault ( ) ;
170- this . emitClickEvent ( ) ;
170+
171+ this . onWidgetClick ( originalEvent ) ;
171172 }
172173 return undefined ;
173174 }
174175
175- emitClickEvent ( ) : void {
176- this . contentRef . current ! . click ( ) ;
177- }
178-
179176 get aria ( ) : Record < string , string > {
180177 const {
181178 icon,
Original file line number Diff line number Diff line change @@ -401,24 +401,6 @@ QUnit.module('Button', function() {
401401 assert . equal ( clickFired , 2 , 'press space on button call click action' ) ;
402402 } ) ;
403403
404- QUnit . test ( 'click event is fired on "enter" press' , function ( assert ) {
405- const $element = $ ( '#button' ) . dxButton ( {
406- focusStateEnabled : true
407- } ) ;
408- const handler = sinon . spy ( ) ;
409-
410- $element . on ( 'click' , handler ) ;
411-
412- const keyboard = keyboardMock ( $element ) ;
413-
414- $element . trigger ( 'focusin' ) ;
415- keyboard . keyDown ( 'enter' ) ;
416- assert . strictEqual ( handler . callCount , 1 , 'press enter on button call click action' ) ;
417-
418- keyboard . keyDown ( 'space' ) ;
419- assert . strictEqual ( handler . callCount , 2 , 'press space on button call click action' ) ;
420- } ) ;
421-
422404 QUnit . test ( 'arguments on key press' , function ( assert ) {
423405 const clickHandler = sinon . spy ( ) ;
424406
You can’t perform that action at this time.
0 commit comments