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 [ ] {
@@ -166,17 +165,15 @@ export class Button extends InfernoWrapperComponent<ButtonProps> {
166165 if ( result ?. cancel ) {
167166 return result ;
168167 }
168+
169169 if ( keyName === 'space' || which === 'space' || keyName === 'enter' || which === 'enter' ) {
170170 originalEvent . preventDefault ( ) ;
171- this . emitClickEvent ( ) ;
171+
172+ this . onWidgetClick ( originalEvent ) ;
172173 }
173174 return undefined ;
174175 }
175176
176- emitClickEvent ( ) : void {
177- this . contentRef . current ! . click ( ) ;
178- }
179-
180177 get aria ( ) : Record < string , string > {
181178 const {
182179 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