2018-05-09 12:01:36 +05:30
|
|
|
import $ from 'jquery';
|
2017-08-17 22:00:37 +05:30
|
|
|
import '~/commons/bootstrap';
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
describe('Bootstrap jQuery extensions', function() {
|
|
|
|
describe('disable', function() {
|
|
|
|
beforeEach(function() {
|
|
|
|
return setFixtures('<input type="text" />');
|
2016-09-13 17:45:13 +05:30
|
|
|
});
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
it('adds the disabled attribute', function() {
|
2019-12-26 22:10:19 +05:30
|
|
|
const $input = $('input').first();
|
2018-12-13 13:39:08 +05:30
|
|
|
$input.disable();
|
|
|
|
|
|
|
|
expect($input).toHaveAttr('disabled', 'disabled');
|
|
|
|
});
|
|
|
|
return it('adds the disabled class', function() {
|
2019-12-26 22:10:19 +05:30
|
|
|
const $input = $('input').first();
|
2018-12-13 13:39:08 +05:30
|
|
|
$input.disable();
|
|
|
|
|
|
|
|
expect($input).toHaveClass('disabled');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return describe('enable', function() {
|
|
|
|
beforeEach(function() {
|
|
|
|
return setFixtures('<input type="text" disabled="disabled" class="disabled" />');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('removes the disabled attribute', function() {
|
2019-12-26 22:10:19 +05:30
|
|
|
const $input = $('input').first();
|
2018-12-13 13:39:08 +05:30
|
|
|
$input.enable();
|
|
|
|
|
|
|
|
expect($input).not.toHaveAttr('disabled');
|
|
|
|
});
|
|
|
|
return it('removes the disabled class', function() {
|
2019-12-26 22:10:19 +05:30
|
|
|
const $input = $('input').first();
|
2018-12-13 13:39:08 +05:30
|
|
|
$input.enable();
|
|
|
|
|
|
|
|
expect($input).not.toHaveClass('disabled');
|
2016-09-13 17:45:13 +05:30
|
|
|
});
|
|
|
|
});
|
2018-12-13 13:39:08 +05:30
|
|
|
});
|