1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-16 02:24:19 +02:00

Remove IE support and button bsChecked hack

This commit is contained in:
Alessandro Chitolina
2018-09-25 20:06:09 +02:00
committed by XhmikosR
parent e866b1ae43
commit 6cfc78f2d9
8 changed files with 8 additions and 133 deletions

View File

@@ -130,21 +130,21 @@ $(function () {
assert.ok($btn1.hasClass('active'), 'btn1 has active class')
assert.ok($btn1.find('input').prop('checked'), 'btn1 is checked')
assert.ok(!$btn2.hasClass('active'), 'btn2 does not have active class')
assert.ok(!(inputBtn2.bsChecked || inputBtn2.checked), 'btn2 is not checked')
assert.ok(!inputBtn2.checked, 'btn2 is not checked')
inputBtn2.dispatchEvent(new Event('click'))
assert.ok(!$btn1.hasClass('active'), 'btn1 does not have active class')
assert.ok(!$btn1.find('input').prop('checked'), 'btn1 is not checked')
assert.ok($btn2.hasClass('active'), 'btn2 has active class')
assert.ok(inputBtn2.bsChecked || inputBtn2.checked, 'btn2 is checked')
assert.ok(inputBtn2.checked, 'btn2 is checked')
inputBtn2.dispatchEvent(new Event('click')) // clicking an already checked radio should not un-check it
assert.ok(!$btn1.hasClass('active'), 'btn1 does not have active class')
assert.ok(!$btn1.find('input').prop('checked'), 'btn1 is not checked')
assert.ok($btn2.hasClass('active'), 'btn2 has active class')
assert.ok(inputBtn2.bsChecked || inputBtn2.checked, 'btn2 is checked')
assert.ok(inputBtn2.checked, 'btn2 is checked')
})
QUnit.test('should only toggle selectable inputs', function (assert) {

View File

@@ -8,52 +8,6 @@ $(function () {
assert.ok(Manipulator, 'Manipulator is defined')
})
QUnit.test('should set checked for input', function (assert) {
assert.expect(2)
var $input = $('<input type="checkbox" />').appendTo('#qunit-fixture')
Manipulator.setChecked($input[0], true)
assert.ok($input[0].checked)
Manipulator.setChecked($input[0], false)
assert.ok(!$input[0].checked)
})
QUnit.test('should not set checked for non input element', function (assert) {
assert.expect(1)
var $div = $('<div />').appendTo('#qunit-fixture')
Manipulator.setChecked($div[0], true)
assert.ok(typeof $div[0].checked === 'undefined')
})
QUnit.test('should verify if an element is checked', function (assert) {
assert.expect(2)
var $input = $('<input type="checkbox" />').appendTo('#qunit-fixture')
Manipulator.setChecked($input[0], true)
assert.ok(Manipulator.isChecked($input[0]))
Manipulator.setChecked($input[0], false)
assert.ok(!Manipulator.isChecked($input[0]))
})
QUnit.test('should throw an error when the element is not an input', function (assert) {
assert.expect(1)
var $div = $('<div />').appendTo('#qunit-fixture')
try {
Manipulator.isChecked($div[0])
} catch (e) {
assert.strictEqual(e.message, 'INPUT parameter is not an HTMLInputElement')
}
})
QUnit.test('should set data attribute', function (assert) {
assert.expect(1)