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

44 lines
1.3 KiB
JavaScript
Raw Normal View History

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
(function() {
2017-08-17 22:00:37 +05:30
describe('Bootstrap jQuery extensions', function() {
2016-09-13 17:45:13 +05:30
describe('disable', function() {
beforeEach(function() {
2017-08-17 22:00:37 +05:30
return setFixtures('<input type="text" />');
2016-09-13 17:45:13 +05:30
});
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() {
2017-08-17 22:00:37 +05:30
return setFixtures('<input type="text" disabled="disabled" class="disabled" />');
2016-09-13 17:45:13 +05:30
});
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-08-17 22:00:37 +05:30
}).call(window);