2018-08-30 12:53:06 +00:00
|
|
|
import $ from 'jquery';
|
2018-10-17 07:13:26 +00:00
|
|
|
import initUserInternalRegexPlaceholder, {
|
|
|
|
PLACEHOLDER_USER_EXTERNAL_DEFAULT_FALSE,
|
|
|
|
PLACEHOLDER_USER_EXTERNAL_DEFAULT_TRUE,
|
|
|
|
} from '~/pages/admin/application_settings/account_and_limits';
|
2018-08-30 12:53:06 +00:00
|
|
|
|
|
|
|
describe('AccountAndLimits', () => {
|
2019-03-22 11:03:15 +00:00
|
|
|
const FIXTURE = 'application_settings/accounts_and_limit.html.raw';
|
2018-08-30 12:53:06 +00:00
|
|
|
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-10-17 07:13:26 +00:00
|
|
|
it('is checked', done => {
|
2018-08-30 12:53:06 +00:00
|
|
|
if (!$userDefaultExternal.prop('checked')) $userDefaultExternal.click();
|
2018-10-09 18:03:09 +00:00
|
|
|
|
2018-08-30 12:53:06 +00:00
|
|
|
expect($userDefaultExternal.prop('checked')).toBeTruthy();
|
|
|
|
expect($userInternalRegex.placeholder).toEqual(PLACEHOLDER_USER_EXTERNAL_DEFAULT_TRUE);
|
|
|
|
expect($userInternalRegex.readOnly).toBeFalsy();
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|