2018-06-16 09:20:30 -04:00
|
|
|
/* eslint-disable no-var */
|
2016-07-24 16:45:11 -04:00
|
|
|
|
2018-03-09 15:18:59 -05:00
|
|
|
import $ from 'jquery';
|
2017-03-13 17:48:32 -04:00
|
|
|
import '~/commons/bootstrap';
|
2016-07-24 16:45:11 -04:00
|
|
|
|
|
|
|
(function() {
|
2017-03-13 17:48:32 -04:00
|
|
|
describe('Bootstrap jQuery extensions', function() {
|
2016-07-24 16:45:11 -04:00
|
|
|
describe('disable', function() {
|
|
|
|
beforeEach(function() {
|
2016-12-30 19:14:33 -05:00
|
|
|
return setFixtures('<input type="text" />');
|
2016-07-24 16:45:11 -04:00
|
|
|
});
|
|
|
|
it('adds the disabled attribute', function() {
|
|
|
|
var $input;
|
|
|
|
$input = $('input').first();
|
|
|
|
$input.disable();
|
|
|
|
return expect($input).toHaveAttr('disabled', 'disabled');
|
|
|
|
});
|
|
|
|
return it('adds the disabled class', function() {
|
|
|
|
var $input;
|
|
|
|
$input = $('input').first();
|
|
|
|
$input.disable();
|
|
|
|
return expect($input).toHaveClass('disabled');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return describe('enable', function() {
|
|
|
|
beforeEach(function() {
|
2016-12-30 19:14:33 -05:00
|
|
|
return setFixtures('<input type="text" disabled="disabled" class="disabled" />');
|
2016-07-24 16:45:11 -04:00
|
|
|
});
|
|
|
|
it('removes the disabled attribute', function() {
|
|
|
|
var $input;
|
|
|
|
$input = $('input').first();
|
|
|
|
$input.enable();
|
|
|
|
return expect($input).not.toHaveAttr('disabled');
|
|
|
|
});
|
|
|
|
return it('removes the disabled class', function() {
|
|
|
|
var $input;
|
|
|
|
$input = $('input').first();
|
|
|
|
$input.enable();
|
|
|
|
return expect($input).not.toHaveClass('disabled');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-02-10 02:29:41 -05:00
|
|
|
}).call(window);
|