Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { REP_PEACEFUL_STRING } from '../consts/REG_EXP_PATTERNS';
|
|
|
|
|
|
|
|
import testNotBlank from './testNotBlank';
|
|
|
|
import { InlineMonoText } from '../../components/Text';
|
|
|
|
|
|
|
|
const buildPeacefulStringTestBatch: BuildInputTestBatchFunction = (
|
|
|
|
inputName,
|
|
|
|
onSuccess,
|
|
|
|
{ getValue } = {},
|
|
|
|
onTestPeacefulStringFailureAppend,
|
|
|
|
) => ({
|
|
|
|
defaults: { getValue, onSuccess },
|
|
|
|
tests: [
|
|
|
|
{
|
|
|
|
onFailure: (...args) => {
|
|
|
|
onTestPeacefulStringFailureAppend(
|
|
|
|
<>
|
|
|
|
{inputName} cannot contain single-quote (
|
|
|
|
<InlineMonoText text="'" />
|
|
|
|
), double-quote (<InlineMonoText text='"' />
|
|
|
|
), slash (<InlineMonoText text="/" />
|
|
|
|
), backslash (<InlineMonoText text="\" />
|
|
|
|
), angle brackets (<InlineMonoText text="<>" />
|
|
|
|
), curly brackets (<InlineMonoText text="{}" />
|
|
|
|
).
|
|
|
|
</>,
|
|
|
|
...args,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
test: ({ value }) => REP_PEACEFUL_STRING.test(value as string),
|
|
|
|
},
|
|
|
|
{ test: testNotBlank },
|
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
export default buildPeacefulStringTestBatch;
|