Skip to content

Commit efb74db

Browse files
authored
Merge pull request #5079 from Abhishek-Punhani/Issue5062
Migrate 'Failed to delete account' alert from Vuetify to Kolibri Des…
2 parents 04e15ad + f6d92af commit efb74db

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

contentcuration/contentcuration/frontend/settings/pages/Account/DeleteAccountForm.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@
2020
@input="deletionEmailInvalidMessage = ''"
2121
/>
2222
</KModal>
23-
<Alert
24-
v-model="deletionFailed"
25-
:header="$tr('deletionFailed')"
26-
:text="$tr('deletionFailedText')"
27-
/>
23+
24+
<KModal
25+
v-if="deletionFailed"
26+
:title="$tr('deletionFailed')"
27+
:submitText="$tr('ok')"
28+
@submit="deletionFailed = false"
29+
>
30+
<p>{{ $tr('deletionFailedText') }}</p>
31+
</KModal>
2832
</div>
2933

3034
</template>
@@ -33,13 +37,9 @@
3337
<script>
3438
3539
import { mapActions, mapState } from 'vuex';
36-
import Alert from 'shared/views/Alert';
3740
3841
export default {
3942
name: 'DeleteAccountForm',
40-
components: {
41-
Alert,
42-
},
4343
props: {
4444
value: {
4545
type: Boolean,
@@ -98,6 +98,7 @@
9898
deletionFailed: 'Failed to delete account',
9999
deletionFailedText:
100100
'Failed to delete your account. Please contact us here: https://community.learningequality.org.',
101+
ok: 'OK',
101102
},
102103
};
103104

contentcuration/contentcuration/frontend/settings/pages/__tests__/deleteAccountForm.spec.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,20 @@ describe('deleteAccountForm', () => {
4242
wrapper.vm.deleteUserAccount();
4343
expect(deleteAccount).toHaveBeenCalled();
4444
});
45-
it('should show alert if account deletion fails', async () => {
45+
it('should show KModal if account deletion fails', async () => {
4646
await wrapper.setData({ accountDeletionEmail: email });
4747
deleteAccount.mockImplementation(() => Promise.reject('error'));
48-
wrapper.vm.deleteUserAccount().catch(() => {
49-
expect(wrapper.vm.deletionFailed).toBe(true);
50-
});
48+
try {
49+
await wrapper.vm.deleteUserAccount();
50+
} catch (e) {
51+
throw new Error(e);
52+
}
53+
await wrapper.vm.$nextTick();
54+
const modals = wrapper.findAllComponents({ name: 'KModal' });
55+
const errorModal = modals.at(1);
56+
expect(errorModal.exists()).toBe(true);
57+
expect(errorModal.text()).toContain(
58+
'Failed to delete your account. Please contact us here: https://community.learningequality.org.',
59+
);
5160
});
5261
});

0 commit comments

Comments
 (0)