feat(AddressEdit): remove confirm delete dialog (#9671)

* feat(AddressEdit): remove confirm delete dialog

* test: update test case
This commit is contained in:
neverland 2021-10-13 10:11:02 +08:00 committed by GitHub
parent b79e59ccef
commit 09f9fa31e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 3 additions and 49 deletions

View File

@ -31,7 +31,6 @@ import { Field } from '../field';
import { Popup } from '../popup';
import { Toast } from '../toast';
import { Button } from '../button';
import { Dialog } from '../dialog';
import { Switch } from '../switch';
import AddressEditDetail from './AddressEditDetail';
@ -105,7 +104,6 @@ export default defineComponent({
'click-area',
'change-area',
'change-detail',
'cancel-delete',
'select-search',
'change-default',
],
@ -232,13 +230,7 @@ export default defineComponent({
emit('change-area', values);
};
const onDelete = () => {
Dialog.confirm({
title: t('confirmDelete'),
})
.then(() => emit('delete', state.data))
.catch(() => emit('cancel-delete', state.data));
};
const onDelete = () => emit('delete', state.data);
// get values of area component
const getArea = () => (areaRef.value ? areaRef.value.getValues() : []);

View File

@ -105,7 +105,6 @@ export default {
| save | Emitted when the save button is clicked | contentform content |
| focus | Emitted when field is focused | key: field name |
| delete | Emitted when confirming delete | contentform content |
| cancel-delete | Emitted when canceling delete | contentform content |
| select-search | Emitted when a search result is selected | value: search content |
| click-area | Emitted when the area field is clicked | - |
| change-area | Emitted when area changed | values: area values |

View File

@ -105,7 +105,6 @@ export default {
| save | 点击保存按钮时触发 | content表单内容 |
| focus | 输入框聚焦时触发 | key: 聚焦的输入框对应的 key |
| delete | 确认删除地址时触发 | content表单内容 |
| cancel-delete | 取消删除地址时触发 | content表单内容 |
| select-search | 选中搜索结果时触发 | value: 搜索结果 |
| click-area | 点击收件地区时触发 | - |
| change-area | 修改收件地区时触发 | values: 地区信息 |

View File

@ -207,28 +207,10 @@ test('should emit delete event after clicking the delete button', async () => {
});
const deleteButton = wrapper.findAll('.van-button')[1];
deleteButton.trigger('click');
await later();
document.querySelector('.van-dialog__confirm').click();
await later();
await deleteButton.trigger('click');
expect(wrapper.emitted('delete')).toBeTruthy();
});
test('should emit cancel-delete event after canceling deletion', async () => {
const wrapper = mount(AddressEdit, {
props: {
showDelete: true,
},
});
const deleteButton = wrapper.findAll('.van-button')[1];
deleteButton.trigger('click');
await later();
document.querySelector('.van-dialog__cancel').click();
await later();
expect(wrapper.emitted('cancel-delete')).toBeTruthy();
});
test('should update address detail after calling the setAddressDetail method', async () => {
const { vm, wrapper } = createComponent();
const textarea = wrapper.find('.van-address-edit-detail').find('textarea');

View File

@ -8,7 +8,6 @@ import { Cell } from '../cell';
import { Form } from '../form';
import { Field } from '../field';
import { Button } from '../button';
import { Dialog } from '../dialog';
import { Switch } from '../switch';
const [name, bem, t] = createNamespace('contact-edit');
@ -54,10 +53,7 @@ export default defineComponent({
}
};
const onDelete = () =>
Dialog.confirm({
title: t('confirmDelete'),
}).then(() => emit('delete', contact));
const onDelete = () => emit('delete', contact);
const renderButtons = () => (
<div class={bem('buttons')}>

View File

@ -8,7 +8,6 @@ export default {
loading: 'Laden...',
noCoupon: 'Keine Coupons',
nameEmpty: 'Bitte geben Sie den Name an',
confirmDelete: 'Sind Sie sicher, dass Sie löschen möchten?',
telInvalid: 'Ungültige Telefonnummer',
vanCalendar: {
end: 'Ende',

View File

@ -8,7 +8,6 @@ export default {
loading: 'Laden...',
noCoupon: 'Keine Coupons',
nameEmpty: 'Bitte den Name angeben',
confirmDelete: 'Bist du sicher, dass du löschen möchtest?',
telInvalid: 'Ungültige Telefonnummer',
vanCalendar: {
end: 'Ende',

View File

@ -8,7 +8,6 @@ export default {
loading: 'Loading...',
noCoupon: 'No coupons',
nameEmpty: 'Please fill in the name',
confirmDelete: 'Are you sure you want to delete?',
telInvalid: 'Malformed phone number',
vanCalendar: {
end: 'End',

View File

@ -8,7 +8,6 @@ export default {
loading: 'Cargando...',
noCoupon: 'Sin cupones',
nameEmpty: 'Por favor rellena el nombre',
confirmDelete: 'Estás seguro de eliminarlo?',
telInvalid: 'Teléfono inválido',
vanCalendar: {
end: 'Fin',

View File

@ -8,7 +8,6 @@ export default {
loading: 'Chargement...',
noCoupon: 'Pas de coupons',
nameEmpty: 'Veuillez remplir le nom',
confirmDelete: 'Êtes-vous sûr de vouloir supprimer?',
telInvalid: 'Numéro de téléphone incorrect',
vanCalendar: {
end: 'Fin',

View File

@ -8,7 +8,6 @@ export default {
loading: '読み込み中...',
noCoupon: 'クーポンはありません',
nameEmpty: '名前を入力してください',
confirmDelete: '本当に削除しますか',
telInvalid: '正しい電話番号を入力してください',
vanCalendar: {
end: '終了',

View File

@ -8,7 +8,6 @@ export default {
loading: 'Laster...',
noCoupon: 'Ingen kuponger',
nameEmpty: 'Vennligst fyll inn navn',
confirmDelete: 'Er du sikker på at du vil slette?',
telInvalid: 'Ugyldig telefonnummer',
vanCalendar: {
end: 'Slutt',

View File

@ -8,7 +8,6 @@ export default {
loading: 'Încărcare...',
noCoupon: 'Fără cupoane',
nameEmpty: 'Te rugăm să completezi numele',
confirmDelete: 'Ești sigur ca vrei sa stergi?',
telInvalid: 'Număr de telefon invalid',
vanCalendar: {
end: 'Sfârșit',

View File

@ -8,7 +8,6 @@ export default {
loading: 'Загрузка...',
noCoupon: 'Нет купонов',
nameEmpty: 'Пожалуйста укажите имя',
confirmDelete: 'Вы уверены, что хотите удалить?',
telInvalid: 'Некорректный номер телефона',
vanCalendar: {
end: 'Конец',

View File

@ -8,7 +8,6 @@ export default {
loading: 'กำลังโหลด...',
noCoupon: 'ไม่มีคูปอง',
nameEmpty: 'กรุณากรอกชื่อของคุณ',
confirmDelete: 'คุณแน่ใจว่าต้องการลบ',
telInvalid: 'กรุณากรอกหมายเลขโทรศัพท์ที่ถูกต้อง',
vanCalendar: {
end: 'จบ',

View File

@ -8,7 +8,6 @@ export default {
loading: 'Yükleniyor...',
noCoupon: 'Kupon yok',
nameEmpty: 'Lütfen isim giriniz',
confirmDelete: 'Silmek istediğinize emin misiniz?',
telInvalid: 'Geçersiz tel. numarası',
vanCalendar: {
end: 'Son',

View File

@ -8,7 +8,6 @@ export default {
loading: '加载中...',
noCoupon: '暂无优惠券',
nameEmpty: '请填写姓名',
confirmDelete: '确定要删除吗',
telInvalid: '请填写正确的电话',
vanCalendar: {
end: '结束',

View File

@ -8,7 +8,6 @@ export default {
loading: '加載中...',
noCoupon: '暫無優惠券',
nameEmpty: '請填寫姓名',
confirmDelete: '確定要刪除嗎',
telInvalid: '請填寫正確的電話',
vanCalendar: {
end: '結束',

View File

@ -8,7 +8,6 @@ export default {
loading: '載入中...',
noCoupon: '暫無優惠券',
nameEmpty: '請填寫姓名',
confirmDelete: '確定要刪除嗎',
telInvalid: '請填寫正確的電話',
vanCalendar: {
end: '結束',