Skip to content

Commit d2ed25d

Browse files
susnuxAndyScherzinger
authored andcommitted
fix(profile): allow to reset phone number
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 8141521 commit d2ed25d

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ export default {
5656
5757
methods: {
5858
onValidate(value) {
59+
if (value === '') {
60+
return true
61+
}
62+
5963
if (defaultPhoneRegion) {
6064
return isValidPhoneNumber(value, defaultPhoneRegion)
6165
}

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

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

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

0 commit comments

Comments
 (0)