File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,10 @@ var Typeahead = (function() {
162
162
var $selectable ;
163
163
164
164
if ( $selectable = this . menu . getActiveSelectable ( ) ) {
165
- this . select ( $selectable ) && $e . preventDefault ( ) ;
165
+ if ( this . select ( $selectable ) ) {
166
+ $e . preventDefault ( ) ;
167
+ $e . stopPropagation ( ) ;
168
+ }
166
169
}
167
170
} ,
168
171
Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ describe('Typeahead', function() {
284
284
285
285
beforeEach ( function ( ) {
286
286
eventName = 'enterKeyed' ;
287
- payload = jasmine . createSpyObj ( 'event' , [ 'preventDefault' ] ) ;
287
+ payload = jasmine . createSpyObj ( 'event' , [ 'preventDefault' , 'stopPropagation' ] ) ;
288
288
} ) ;
289
289
290
290
describe ( 'when idle' , function ( ) {
@@ -330,7 +330,7 @@ describe('Typeahead', function() {
330
330
expect ( this . view . select ) . toHaveBeenCalledWith ( $el ) ;
331
331
} ) ;
332
332
333
- it ( 'should prevent default if active selectale ' , function ( ) {
333
+ it ( 'should prevent default and stop propagation if active selectable ' , function ( ) {
334
334
var $el ;
335
335
336
336
$el = $ ( '<bah>' ) ;
@@ -340,6 +340,7 @@ describe('Typeahead', function() {
340
340
this . input . trigger ( eventName , payload ) ;
341
341
342
342
expect ( payload . preventDefault ) . toHaveBeenCalled ( ) ;
343
+ expect ( payload . stopPropagation ) . toHaveBeenCalled ( ) ;
343
344
} ) ;
344
345
345
346
it ( 'should not select selectable if there is no active one' , function ( ) {
You can’t perform that action at this time.
0 commit comments