File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,10 @@ var Typeahead = (function() {
162162 var $selectable ;
163163
164164 if ( $selectable = this . menu . getActiveSelectable ( ) ) {
165- this . select ( $selectable ) && $e . preventDefault ( ) ;
165+ if ( this . select ( $selectable ) ) {
166+ $e . preventDefault ( ) ;
167+ $e . stopPropagation ( ) ;
168+ }
166169 }
167170 } ,
168171
Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ describe('Typeahead', function() {
284284
285285 beforeEach ( function ( ) {
286286 eventName = 'enterKeyed' ;
287- payload = jasmine . createSpyObj ( 'event' , [ 'preventDefault' ] ) ;
287+ payload = jasmine . createSpyObj ( 'event' , [ 'preventDefault' , 'stopPropagation' ] ) ;
288288 } ) ;
289289
290290 describe ( 'when idle' , function ( ) {
@@ -330,7 +330,7 @@ describe('Typeahead', function() {
330330 expect ( this . view . select ) . toHaveBeenCalledWith ( $el ) ;
331331 } ) ;
332332
333- it ( 'should prevent default if active selectale ' , function ( ) {
333+ it ( 'should prevent default and stop propagation if active selectable ' , function ( ) {
334334 var $el ;
335335
336336 $el = $ ( '<bah>' ) ;
@@ -340,6 +340,7 @@ describe('Typeahead', function() {
340340 this . input . trigger ( eventName , payload ) ;
341341
342342 expect ( payload . preventDefault ) . toHaveBeenCalled ( ) ;
343+ expect ( payload . stopPropagation ) . toHaveBeenCalled ( ) ;
343344 } ) ;
344345
345346 it ( 'should not select selectable if there is no active one' , function ( ) {
You can’t perform that action at this time.
0 commit comments