Skip to content

Commit 65c20a4

Browse files
committed
fix(profile): allow to reset phone number
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 561775d commit 65c20a4

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

apps/settings/src/components/PersonalInfo/PhoneSection.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export default {
3939
4040
methods: {
4141
onValidate(value) {
42+
if (value === '') {
43+
return true
44+
}
45+
4246
if (defaultPhoneRegion) {
4347
return isValidPhoneNumber(value, defaultPhoneRegion)
4448
}

cypress/e2e/settings/personal-info.cy.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,40 @@ describe('Settings: Change personal information', { testIsolation: true }, () =>
336336
cy.get('a[href="tel:+498972101099701"]').should('be.visible')
337337
})
338338

339+
it('Can set phone number with phone region', () => {
340+
cy.contains('label', 'Phone number').scrollIntoView()
341+
inputForLabel('Phone number').type('{selectAll}0 40 428990')
342+
inputForLabel('Phone number').should('have.attr', 'class').and('contain', '--error')
343+
344+
cy.runOccCommand('config:system:set default_phone_region --value DE')
345+
cy.reload()
346+
347+
cy.contains('label', 'Phone number').scrollIntoView()
348+
inputForLabel('Phone number').type('{selectAll}0 40 428990')
349+
handlePasswordConfirmation(user.password)
350+
351+
cy.wait('@submitSetting')
352+
cy.reload()
353+
inputForLabel('Phone number').should('have.value', '+4940428990')
354+
})
355+
356+
it('Can reset phone number', () => {
357+
cy.contains('label', 'Phone number').scrollIntoView()
358+
inputForLabel('Phone number').type('{selectAll}+49 40 428990')
359+
handlePasswordConfirmation(user.password)
360+
361+
cy.wait('@submitSetting')
362+
cy.reload()
363+
inputForLabel('Phone number').should('have.value', '+4940428990')
364+
365+
inputForLabel('Phone number').clear()
366+
handlePasswordConfirmation(user.password)
367+
368+
cy.wait('@submitSetting')
369+
cy.reload()
370+
inputForLabel('Phone number').should('have.value', '')
371+
})
372+
339373
it('Can set Website and change its visibility', () => {
340374
cy.contains('label', 'Website').scrollIntoView()
341375
// Check invalid input

0 commit comments

Comments
 (0)