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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import $ from 'jquery';
2022-07-16 23:28:13 +05:30
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
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(() => {
2022-07-16 23:28:13 +05:30
setHTMLFixture('<input type="text" />');
});
afterEach(() => {
resetHTMLFixture();
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(() => {
2022-07-16 23:28:13 +05:30
setHTMLFixture('<input type="text" disabled="disabled" class="disabled" />');
});
afterEach(() => {
resetHTMLFixture();
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
});