2018-08-30 12:53:06 +00:00
|
|
|
import $ from 'jquery';
|
2022-05-13 12:08:49 +00:00
|
|
|
import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
|
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-26 16:03:28 +00:00
|
|
|
const FIXTURE = 'application_settings/accounts_and_limit.html';
|
2018-08-30 12:53:06 +00:00
|
|
|
let $userDefaultExternal;
|
|
|
|
let $userInternalRegex;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2022-05-13 12:08:49 +00:00
|
|
|
loadHTMLFixture(FIXTURE);
|
2018-08-30 12:53:06 +00:00
|
|
|
initUserInternalRegexPlaceholder();
|
|
|
|
$userDefaultExternal = $('#application_setting_user_default_external');
|
|
|
|
$userInternalRegex = document.querySelector('#application_setting_user_default_internal_regex');
|
|
|
|
});
|
|
|
|
|
2022-05-13 12:08:49 +00:00
|
|
|
afterEach(() => {
|
|
|
|
resetHTMLFixture();
|
|
|
|
});
|
|
|
|
|
2018-08-30 12:53:06 +00:00
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
2022-04-13 21:09:57 +00:00
|
|
|
it('is checked', () => {
|
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();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|