Core: Add "widgetRemoveEnd" event. Fixes #1430

This commit is contained in:
Rob Garrison 2017-08-02 00:09:39 -05:00
parent c108de305c
commit 8c2f14b8fd
2 changed files with 13 additions and 6 deletions

View File

@ -2130,6 +2130,7 @@
c.widgetInit[ name[ index ] ] = false;
}
}
c.$table.triggerHandler( 'widgetRemoveEnd', table );
},
refreshWidgets : function( table, doAll, dontapply ) {

View File

@ -982,13 +982,19 @@ jQuery(function($){
test has widget function
************************************************/
QUnit.test( 'has & remove zebra widget', function(assert) {
assert.expect(3);
var done = assert.async();
assert.expect(4);
c2.widgets = [ 'zebra' ];
$table2.trigger('applyWidgets');
$table2.trigger('applyWidgets', function() {
assert.equal( ts.hasWidget( table2, 'zebra'), true, 'table has zebra widget (using table element object)' );
assert.equal( ts.hasWidget( $table2, 'zebra'), true, 'table has zebra widget (using jQuery table object)' );
ts.removeWidget( table2, 'zebra' );
$table2.one( 'widgetRemoveEnd', function() {
assert.ok( true, 'widgetRemoveEnd fired');
assert.equal( zebra() && c2.widgets.length === 0, false, 'zebra removed' );
done();
});
ts.removeWidget( table2, 'zebra' );
});
});
/************************************************