File tree Expand file tree Collapse file tree 2 files changed +23
-13
lines changed
contentcuration/contentcuration/frontend/settings/pages Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Original file line number Diff line number Diff line change 20
20
@input =" deletionEmailInvalidMessage = ''"
21
21
/>
22
22
</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 >
28
32
</div >
29
33
30
34
</template >
33
37
<script >
34
38
35
39
import { mapActions , mapState } from ' vuex' ;
36
- import Alert from ' shared/views/Alert' ;
37
40
38
41
export default {
39
42
name: ' DeleteAccountForm' ,
40
- components: {
41
- Alert,
42
- },
43
43
props: {
44
44
value: {
45
45
type: Boolean ,
98
98
deletionFailed: ' Failed to delete account' ,
99
99
deletionFailedText:
100
100
' Failed to delete your account. Please contact us here: https://community.learningequality.org.' ,
101
+ ok: ' OK' ,
101
102
},
102
103
};
103
104
Original file line number Diff line number Diff line change @@ -42,11 +42,20 @@ describe('deleteAccountForm', () => {
42
42
wrapper . vm . deleteUserAccount ( ) ;
43
43
expect ( deleteAccount ) . toHaveBeenCalled ( ) ;
44
44
} ) ;
45
- it ( 'should show alert if account deletion fails' , async ( ) => {
45
+ it ( 'should show KModal if account deletion fails' , async ( ) => {
46
46
await wrapper . setData ( { accountDeletionEmail : email } ) ;
47
47
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
+ ) ;
51
60
} ) ;
52
61
} ) ;
You can’t perform that action at this time.
0 commit comments