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
@ -8,18 +8,18 @@
|
||||
<span :title="name">{{ textureName }} <small>({{ type }})</small></span>
|
||||
</p>
|
||||
|
||||
<a
|
||||
:href="linkToSkinlib"
|
||||
:title="$t('user.viewInSkinlib')"
|
||||
class="more"
|
||||
data-toggle="tooltip"
|
||||
<a
|
||||
:href="linkToSkinlib"
|
||||
:title="$t('user.viewInSkinlib')"
|
||||
class="more"
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
><i class="fa fa-share"></i></a>
|
||||
<span
|
||||
:title="$t('general.more')"
|
||||
class="more"
|
||||
data-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
<span
|
||||
:title="$t('general.more')"
|
||||
class="more"
|
||||
data-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
id="more-button"
|
||||
><i class="fa fa-cog"></i></span>
|
||||
|
||||
@ -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