mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-21 06:19:38 +08:00
Simplify input validator
This commit is contained in:
parent
33de864504
commit
a2e6315198
@ -74,9 +74,7 @@ export default {
|
||||
input: 'text',
|
||||
inputValue: this.textureName,
|
||||
showCancelButton: true,
|
||||
inputValidator: value => (new Promise(resolve => {
|
||||
value ? resolve() : resolve(this.$t('skinlib.emptyNewTextureName'));
|
||||
}))
|
||||
inputValidator: value => !value && this.$t('skinlib.emptyNewTextureName')
|
||||
});
|
||||
if (dismiss) {
|
||||
return;
|
||||
|
@ -40,10 +40,10 @@ test('rename texture', async () => {
|
||||
axios.post
|
||||
.mockResolvedValueOnce({ data: { errno: 0 } })
|
||||
.mockResolvedValueOnce({ data: { errno: 1 } });
|
||||
swal.mockImplementationOnce(() => Promise.resolve({ dismiss: 'cancel' }))
|
||||
.mockImplementation(async options => {
|
||||
swal.mockImplementationOnce(() => ({ dismiss: 'cancel' }))
|
||||
.mockImplementation(options => {
|
||||
options.inputValidator('name');
|
||||
options.inputValidator().catch(() => {});
|
||||
options.inputValidator();
|
||||
return { value: 'new-name' };
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user