File tree Expand file tree Collapse file tree 6 files changed +24
-12
lines changed
Expand file tree Collapse file tree 6 files changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -291,7 +291,8 @@ var Dataset = (function() {
291291 } ,
292292
293293 destroy : function destroy ( ) {
294- this . $el = null ;
294+ // #970
295+ this . $el = $ ( '<div>' ) ;
295296 }
296297 } ) ;
297298
Original file line number Diff line number Diff line change @@ -296,7 +296,8 @@ var Input = (function() {
296296 this . $input . off ( '.tt' ) ;
297297 this . $overflowHelper . remove ( ) ;
298298
299- this . $hint = this . $input = this . $overflowHelper = null ;
299+ // #970
300+ this . $hint = this . $input = this . $overflowHelper = $ ( '<div>' ) ;
300301 }
301302 } ) ;
302303
Original file line number Diff line number Diff line change @@ -204,7 +204,8 @@ var Menu = (function() {
204204 destroy : function destroy ( ) {
205205 this . $node . off ( '.tt' ) ;
206206
207- this . $node = null ;
207+ // #970
208+ this . $node = $ ( '<div>' ) ;
208209
209210 _ . each ( this . datasets , destroyDataset ) ;
210211
Original file line number Diff line number Diff line change @@ -421,10 +421,11 @@ describe('Dataset', function() {
421421 } ) ;
422422
423423 describe ( '#destroy' , function ( ) {
424- it ( 'should null out the reference to the dataset element' , function ( ) {
425- this . dataset . destroy ( ) ;
424+ it ( 'should set dataset element to dummy element' , function ( ) {
425+ var $prevEl = this . dataset . $el ;
426426
427- expect ( this . dataset . $el ) . toBeNull ( ) ;
427+ this . dataset . destroy ( ) ;
428+ expect ( this . dataset . $el ) . not . toBe ( $prevEl ) ;
428429 } ) ;
429430 } ) ;
430431
Original file line number Diff line number Diff line change @@ -475,12 +475,18 @@ describe('Input', function() {
475475 expect ( $input . off ) . toHaveBeenCalledWith ( '.tt' ) ;
476476 } ) ;
477477
478- it ( 'should null out its reference to DOM elements' , function ( ) {
478+ it ( 'should set references to DOM elements to dummy element' , function ( ) {
479+ var $hint , $input , $overflowHelper ;
480+
481+ $hint = this . view . $hint ;
482+ $input = this . view . $input ;
483+ $overflowHelper = this . view . $overflowHelper ;
484+
479485 this . view . destroy ( ) ;
480486
481- expect ( this . view . $hint ) . toBeNull ( ) ;
482- expect ( this . view . $input ) . toBeNull ( ) ;
483- expect ( this . view . $overflowHelper ) . toBeNull ( ) ;
487+ expect ( this . view . $hint ) . not . toBe ( $hint ) ;
488+ expect ( this . view . $input ) . not . toBe ( $input ) ;
489+ expect ( this . view . $overflowHelper ) . not . toBe ( $overflowHelper ) ;
484490 } ) ;
485491 } ) ;
486492
Original file line number Diff line number Diff line change @@ -322,9 +322,11 @@ describe('Menu', function() {
322322 expect ( this . dataset . destroy ) . toHaveBeenCalled ( ) ;
323323 } ) ;
324324
325- it ( 'should null out its reference to the node element' , function ( ) {
325+ it ( 'should set node element to dummy element' , function ( ) {
326+ var $node = this . view . $node ;
327+
326328 this . view . destroy ( ) ;
327- expect ( this . view . $node ) . toBeNull ( ) ;
329+ expect ( this . view . $node ) . not . toBe ( $node ) ;
328330 } ) ;
329331 } ) ;
330332} ) ;
You can’t perform that action at this time.
0 commit comments