2018-11-08 19:23:39 +05:30
|
|
|
/* eslint-disable no-var */
|
2016-09-13 17:45:13 +05:30
|
|
|
|
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
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
describe('Bootstrap jQuery extensions', function() {
|
|
|
|
describe('disable', function() {
|
|
|
|
beforeEach(function() {
|
|
|
|
return setFixtures('<input type="text" />');
|
2016-09-13 17:45:13 +05:30
|
|
|
});
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
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-09-13 17:45:13 +05:30
|
|
|
});
|
|
|
|
});
|
2018-12-13 13:39:08 +05:30
|
|
|
});
|