gitlab-org--gitlab-foss/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

import $ from 'jquery';
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import '~/commons/bootstrap';
2016-07-24 16:45:11 -04:00
describe('Bootstrap jQuery extensions', () => {
describe('disable', () => {
beforeEach(() => {
setHTMLFixture('<input type="text" />');
});
afterEach(() => {
resetHTMLFixture();
2016-07-24 16:45:11 -04:00
});
2018-10-17 03:13:26 -04:00
it('adds the disabled attribute', () => {
const $input = $('input').first();
2018-10-17 03:13:26 -04:00
$input.disable();
expect($input).toHaveAttr('disabled', 'disabled');
});
it('adds the disabled class', () => {
const $input = $('input').first();
2018-10-17 03:13:26 -04:00
$input.disable();
expect($input).toHaveClass('disabled');
});
});
describe('enable', () => {
beforeEach(() => {
setHTMLFixture('<input type="text" disabled="disabled" class="disabled" />');
});
afterEach(() => {
resetHTMLFixture();
2018-10-17 03:13:26 -04:00
});
it('removes the disabled attribute', () => {
const $input = $('input').first();
2018-10-17 03:13:26 -04:00
$input.enable();
expect($input).not.toHaveAttr('disabled');
});
it('removes the disabled class', () => {
const $input = $('input').first();
2018-10-17 03:13:26 -04:00
$input.enable();
expect($input).not.toHaveClass('disabled');
2016-07-24 16:45:11 -04:00
});
});
2018-10-17 03:13:26 -04:00
});