2018-03-09 20:18:59 +00:00
|
|
|
import $ from 'jquery';
|
2017-03-13 21:48:32 +00:00
|
|
|
import '~/commons/bootstrap';
|
2016-07-24 20:45:11 +00:00
|
|
|
|
2019-12-20 15:07:34 +00:00
|
|
|
describe('Bootstrap jQuery extensions', () => {
|
|
|
|
describe('disable', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
setFixtures('<input type="text" />');
|
2016-07-24 20:45:11 +00:00
|
|
|
});
|
2018-10-17 07:13:26 +00:00
|
|
|
|
2019-12-20 15:07:34 +00:00
|
|
|
it('adds the disabled attribute', () => {
|
2019-11-15 12:06:12 +00:00
|
|
|
const $input = $('input').first();
|
2018-10-17 07:13:26 +00:00
|
|
|
$input.disable();
|
|
|
|
|
|
|
|
expect($input).toHaveAttr('disabled', 'disabled');
|
|
|
|
});
|
2019-12-20 15:07:34 +00:00
|
|
|
|
|
|
|
it('adds the disabled class', () => {
|
2019-11-15 12:06:12 +00:00
|
|
|
const $input = $('input').first();
|
2018-10-17 07:13:26 +00:00
|
|
|
$input.disable();
|
|
|
|
|
|
|
|
expect($input).toHaveClass('disabled');
|
|
|
|
});
|
|
|
|
});
|
2019-12-20 15:07:34 +00:00
|
|
|
|
|
|
|
describe('enable', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
setFixtures('<input type="text" disabled="disabled" class="disabled" />');
|
2018-10-17 07:13:26 +00:00
|
|
|
});
|
|
|
|
|
2019-12-20 15:07:34 +00:00
|
|
|
it('removes the disabled attribute', () => {
|
2019-11-15 12:06:12 +00:00
|
|
|
const $input = $('input').first();
|
2018-10-17 07:13:26 +00:00
|
|
|
$input.enable();
|
|
|
|
|
|
|
|
expect($input).not.toHaveAttr('disabled');
|
|
|
|
});
|
2019-12-20 15:07:34 +00:00
|
|
|
|
|
|
|
it('removes the disabled class', () => {
|
2019-11-15 12:06:12 +00:00
|
|
|
const $input = $('input').first();
|
2018-10-17 07:13:26 +00:00
|
|
|
$input.enable();
|
|
|
|
|
|
|
|
expect($input).not.toHaveClass('disabled');
|
2016-07-24 20:45:11 +00:00
|
|
|
});
|
|
|
|
});
|
2018-10-17 07:13:26 +00:00
|
|
|
});
|