mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Bug #18867: Fixed multiple issues with yii\grid\CheckboxColumn
- "check all" checkbox not being checked on page load when all data row checkboxes are initially checked - clicking checkboxes triggered "change" event for other checkboxes that do not change their state - "check all" checkbox not being checked when disabled checkboxes are present and clicking last non-checked data row checkbox
This commit is contained in:
@ -658,8 +658,8 @@ describe('yii.gridView', function () {
|
||||
click($checkAllCheckbox);
|
||||
assert.lengthOf($checkRowCheckboxes.filter(':checked'), 3);
|
||||
assert.isTrue($checkAllCheckbox.prop('checked'));
|
||||
// "change" should be called 3 times, 1 time per each row, no matter what state it has
|
||||
assert.equal(changedSpy.callCount, 3);
|
||||
// "change" should be called 2 more times for the remaining 2 unchecked rows
|
||||
assert.equal(changedSpy.callCount, 2);
|
||||
|
||||
// Uncheck first row
|
||||
changedSpy.reset();
|
||||
@ -711,12 +711,12 @@ describe('yii.gridView', function () {
|
||||
checkAll: 'selection_all'
|
||||
});
|
||||
|
||||
// Check first row ("prop" should be called once)
|
||||
// Click first row checkbox ("prop" on "check all" checkbox should not be called)
|
||||
click($gridView.find('input[name="selection[]"][value="1"]'));
|
||||
// Check all rows ("prop" should be called 2 times, 1 time for each row)
|
||||
// Click "check all" checkbox ("prop" should be called once on the remaining unchecked row)
|
||||
click($gridView.find('input[name="selection_all"]'));
|
||||
|
||||
assert.equal(jQueryPropStub.callCount, 3);
|
||||
assert.equal(jQueryPropStub.callCount, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -831,9 +831,9 @@ describe('yii.gridView', function () {
|
||||
click($gridView2.find('input[name="selection[]"][value="1"]'));
|
||||
assert.equal(jQueryPropStub.callCount, 0);
|
||||
|
||||
click($checkRowCheckboxes.filter('[value="1"]')); // Check first row ("prop" should be called once)
|
||||
click($checkAllCheckbox); // Check all rows ("prop" should be called 3 times, 1 time for each row)
|
||||
assert.equal(jQueryPropStub.callCount, 4);
|
||||
click($checkRowCheckboxes.filter('[value="1"]')); // Click first row checkbox ("prop" on "check all" checkbox should not be called)
|
||||
click($checkAllCheckbox); // Click "check all" checkbox ("prop" should be called 2 times on the remaining unchecked rows)
|
||||
assert.equal(jQueryPropStub.callCount, 2);
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user