debian-mirror-gitlab/spec/javascripts/pages/admin/application_settings/account_and_limits_spec.js

37 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-11-20 20:47:30 +05:30
import $ from 'jquery';
2018-12-13 13:39:08 +05:30
import initUserInternalRegexPlaceholder, {
PLACEHOLDER_USER_EXTERNAL_DEFAULT_FALSE,
PLACEHOLDER_USER_EXTERNAL_DEFAULT_TRUE,
} from '~/pages/admin/application_settings/account_and_limits';
2018-11-20 20:47:30 +05:30
describe('AccountAndLimits', () => {
2019-07-07 11:18:12 +05:30
const FIXTURE = 'application_settings/accounts_and_limit.html';
2018-11-20 20:47:30 +05:30
let $userDefaultExternal;
let $userInternalRegex;
preloadFixtures(FIXTURE);
beforeEach(() => {
loadFixtures(FIXTURE);
initUserInternalRegexPlaceholder();
$userDefaultExternal = $('#application_setting_user_default_external');
$userInternalRegex = document.querySelector('#application_setting_user_default_internal_regex');
});
describe('Changing of userInternalRegex when userDefaultExternal', () => {
it('is unchecked', () => {
expect($userDefaultExternal.prop('checked')).toBeFalsy();
expect($userInternalRegex.placeholder).toEqual(PLACEHOLDER_USER_EXTERNAL_DEFAULT_FALSE);
expect($userInternalRegex.readOnly).toBeTruthy();
});
2018-12-13 13:39:08 +05:30
it('is checked', done => {
2018-11-20 20:47:30 +05:30
if (!$userDefaultExternal.prop('checked')) $userDefaultExternal.click();
2018-12-13 13:39:08 +05:30
2018-11-20 20:47:30 +05:30
expect($userDefaultExternal.prop('checked')).toBeTruthy();
expect($userInternalRegex.placeholder).toEqual(PLACEHOLDER_USER_EXTERNAL_DEFAULT_TRUE);
expect($userInternalRegex.readOnly).toBeFalsy();
done();
});
});
});