File tree Expand file tree Collapse file tree 2 files changed +2
-19
lines changed Expand file tree Collapse file tree 2 files changed +2
-19
lines changed Original file line number Diff line number Diff line change 728728 link : function ( $scope , $elm , $attrs , uiGridCtrl ) {
729729 var grid ;
730730
731- var handleFileSelect = function ( event ) {
731+ function handleFileSelect ( event ) {
732732 var target = event . srcElement || event . target ;
733733
734734 if ( target && target . files && target . files . length === 1 ) {
744744 gridUtil . logError ( 'Could not import file because UI Grid was not found.' ) ;
745745 }
746746 }
747- } ;
747+ }
748748
749749 var fileChooser = $elm [ 0 ] . querySelectorAll ( '.ui-grid-importer-file-chooser' ) ;
750750
753753 } else {
754754 fileChooser [ 0 ] . addEventListener ( 'change' , handleFileSelect , false ) ;
755755 }
756-
757- $scope . $on ( '$destroy' , function unbindEvents ( ) {
758- // unbind jquery events to prevent memory leaks
759- fileChooser [ 0 ] . removeEventListener ( 'change' , handleFileSelect , false ) ;
760- } ) ;
761756 }
762757 } ;
763758 }
Original file line number Diff line number Diff line change @@ -54,16 +54,4 @@ describe('ui.grid.importer uiGridImporterMenuItem', function() {
5454
5555 expect ( gridUtil . logError ) . toHaveBeenCalledWith ( 'Found > 1 or < 1 file choosers within the menu item, error, cannot continue' ) ;
5656 } ) ;
57- describe ( 'on $destroy' , function ( ) {
58- beforeEach ( function ( ) {
59- spyOn ( fileChooser [ 0 ] , 'removeEventListener' ) . and . callThrough ( ) ;
60- $scope . $broadcast ( '$destroy' ) ;
61- } ) ;
62- afterEach ( function ( ) {
63- fileChooser [ 0 ] . removeEventListener . calls . reset ( ) ;
64- } ) ;
65- it ( 'should remove all event handlers' , function ( ) {
66- expect ( fileChooser [ 0 ] . removeEventListener ) . toHaveBeenCalled ( ) ;
67- } ) ;
68- } ) ;
6957} ) ;
You can’t perform that action at this time.
0 commit comments