-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Ajout de la modal de suppression de compte (PIX-14908)
- Loading branch information
Showing
10 changed files
with
185 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.user-account { | ||
margin-bottom: var(--pix-spacing-8x); | ||
|
||
.pix-background-header__content { | ||
max-width: 1280px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { render } from '@1024pix/ember-testing-library'; | ||
import { clickByName, render, within } from '@1024pix/ember-testing-library'; | ||
import { t } from 'ember-intl/test-support'; | ||
import DeleteAccountSection from 'mon-pix/components/user-account/delete-account-section'; | ||
import { module, test } from 'qunit'; | ||
|
||
import setupIntlRenderingTest from '../../../helpers/setup-intl-rendering'; | ||
import { waitForDialog, waitForDialogClose } from '../../../helpers/wait-for.js'; | ||
|
||
const I18N_KEYS = { | ||
title: 'pages.user-account.delete-account.title', | ||
|
@@ -34,15 +35,43 @@ module('Integration | Component | UserAccount | DeleteAccountSection', function | |
const pixScore = screen.getByText(/42 pix/i); | ||
assert.dom(pixScore).exists(); | ||
|
||
const email = screen.getByText(/john.doe@email.com/i); | ||
assert.dom(email).exists(); | ||
const emails = screen.getAllByText(/john.doe@email.com/i); | ||
assert.strictEqual(emails.length, 2); | ||
|
||
const supportLink = screen.getByRole('link', { name: t(I18N_KEYS.contactSupport) }); | ||
assert.dom(supportLink).hasAttribute('href', 'https://pix.org/fr/support'); | ||
|
||
const button = screen.getByRole('button', { name: t(I18N_KEYS.buttonLabel) }); | ||
assert.dom(button).exists(); | ||
}); | ||
|
||
test('it opens and close the modal', async function (assert) { | ||
//given | ||
const user = { | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
email: '[email protected]', | ||
profile: { pixScore: 42 }, | ||
}; | ||
const screen = await render(<template><DeleteAccountSection @user={{user}} /></template>); | ||
|
||
// when | ||
await clickByName(t('pages.user-account.delete-account.actions.delete')); | ||
|
||
// then | ||
await waitForDialog(); | ||
const dialog = screen.getByRole('dialog'); | ||
|
||
assert.dom(within(dialog).getByText('[email protected]')).exists(); | ||
|
||
// when | ||
await clickByName(t('common.actions.cancel')); | ||
|
||
// then | ||
await waitForDialogClose(); | ||
|
||
assert.ok(true); | ||
}); | ||
}); | ||
|
||
module('when user does not have an email', function () { | ||
|
@@ -65,8 +94,36 @@ module('Integration | Component | UserAccount | DeleteAccountSection', function | |
const pixScore = screen.getByText(/42 pix/i); | ||
assert.dom(pixScore).exists(); | ||
|
||
const fullname = screen.getByText(/John Doe/i); | ||
assert.dom(fullname).exists(); | ||
const fullnames = screen.getAllByText(/John Doe/i); | ||
assert.strictEqual(fullnames.length, 2); | ||
}); | ||
|
||
test('it opens and close the modal', async function (assert) { | ||
//given | ||
const user = { | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
email: null, | ||
profile: { pixScore: 42 }, | ||
}; | ||
const screen = await render(<template><DeleteAccountSection @user={{user}} /></template>); | ||
|
||
// when | ||
await clickByName(t('pages.user-account.delete-account.actions.delete')); | ||
|
||
// then | ||
await waitForDialog(); | ||
const dialog = screen.getByRole('dialog'); | ||
|
||
assert.dom(within(dialog).getByText('John Doe')).exists(); | ||
|
||
// when | ||
await clickByName(t('common.actions.cancel')); | ||
|
||
// then | ||
await waitForDialogClose(); | ||
|
||
assert.ok(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters