gitlab-org--gitlab-foss/spec/javascripts/bootstrap_jquery_spec.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-06-16 13:20:30 +00:00
/* eslint-disable no-var */
2016-07-24 20:45:11 +00:00
import $ from 'jquery';
import '~/commons/bootstrap';
2016-07-24 20:45:11 +00:00
2018-10-17 07:13:26 +00:00
describe('Bootstrap jQuery extensions', function() {
describe('disable', function() {
beforeEach(function() {
return setFixtures('<input type="text" />');
2016-07-24 20:45:11 +00:00
});
2018-10-17 07:13:26 +00:00
it('adds the disabled attribute', function() {
var $input;
$input = $('input').first();
$input.disable();
expect($input).toHaveAttr('disabled', 'disabled');
});
return it('adds the disabled class', function() {
var $input;
$input = $('input').first();
$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() {
var $input;
$input = $('input').first();
$input.enable();
expect($input).not.toHaveAttr('disabled');
});
return it('removes the disabled class', function() {
var $input;
$input = $('input').first();
$input.enable();
expect($input).not.toHaveClass('disabled');
2016-07-24 20:45:11 +00:00
});
});
2018-10-17 07:13:26 +00:00
});