debian-mirror-gitlab/spec/frontend/bootstrap_jquery_spec.js

45 lines
1 KiB
JavaScript
Raw Normal View History

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
2020-03-13 15:44:24 +05:30
describe('Bootstrap jQuery extensions', () => {
describe('disable', () => {
beforeEach(() => {
setFixtures('<input type="text" />');
2016-09-13 17:45:13 +05:30
});
2018-12-13 13:39:08 +05:30
2020-03-13 15:44:24 +05:30
it('adds the disabled attribute', () => {
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');
});
2020-03-13 15:44:24 +05:30
it('adds the disabled class', () => {
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');
});
});
2020-03-13 15:44:24 +05:30
describe('enable', () => {
beforeEach(() => {
setFixtures('<input type="text" disabled="disabled" class="disabled" />');
2018-12-13 13:39:08 +05:30
});
2020-03-13 15:44:24 +05:30
it('removes the disabled attribute', () => {
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');
});
2020-03-13 15:44:24 +05:30
it('removes the disabled class', () => {
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
});