-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TECH] Passer la page de connexion à l'espace surveillant en .gjs (PIX-13332) #9469
Merged
pix-service-auto-merge
merged 1 commit into
dev
from
pix-13332-login-session-supervisor-from-hbs-to-gjs
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { LinkTo } from '@ember/routing'; | ||
import FaIcon from '@fortawesome/ember-fontawesome/components/fa-icon'; | ||
import { t } from 'ember-intl'; | ||
|
||
<template> | ||
<div class='login-session-supervisor-page-content__current-user-email'> | ||
<span><FaIcon @icon='user-circle' /> | ||
{{@currentUserEmail}} | ||
</span> | ||
<LinkTo class='login-session-supervisor-page-content__logout' @route='logout'> | ||
{{t 'pages.session-supervising.login.form.actions.switch-account'}} | ||
</LinkTo> | ||
</div> | ||
</template> |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import PixButton from '@1024pix/pix-ui/components/pix-button'; | ||
import PixInput from '@1024pix/pix-ui/components/pix-input'; | ||
import PixInputPassword from '@1024pix/pix-ui/components/pix-input-password'; | ||
import { on } from '@ember/modifier'; | ||
import { t } from 'ember-intl'; | ||
|
||
<template> | ||
<div class='login-session-supervisor-form'> | ||
<img src='/illu-espace-surveillant.svg' alt='' /> | ||
|
||
<h1 class='login-session-supervisor-form__title'>{{t 'pages.session-supervising.login.form.title'}}</h1> | ||
|
||
<h2 class='login-session-supervisor-form__subtitle'>{{t 'pages.session-supervising.login.form.sub-title'}}</h2> | ||
|
||
<p class='login-session-supervisor-form__required-fields-notice'>{{t 'common.form-errors.mandatory-all-fields'}}</p> | ||
|
||
{{#if @errorMessage}} | ||
<p | ||
id='login-session-supervisor-form-error-message' | ||
class='login-session-supervisor-form__error-message error-message' | ||
> | ||
{{@errorMessage}} | ||
</p> | ||
{{/if}} | ||
|
||
<form class='login-session-supervisor-form__form' {{on 'submit' @superviseSession}}> | ||
<PixInput @id='session-id' type='number' {{on 'input' @setSessionId}}> | ||
<:label>{{t 'pages.session-supervising.login.form.session-number'}}</:label> | ||
</PixInput> | ||
|
||
<PixInputPassword | ||
@id='session-password' | ||
@ariaLabel={{t 'pages.session-supervising.login.form.session-password.aria-label'}} | ||
@subLabel={{t 'pages.session-supervising.login.form.example'}} | ||
@prefix='C-' | ||
placeholder='XXXXXX' | ||
{{on 'input' @setSupervisorPassword}} | ||
> | ||
<:label>{{t 'pages.session-supervising.login.form.session-password.label'}}</:label> | ||
</PixInputPassword> | ||
|
||
<PixButton @type='submit'> | ||
{{t 'pages.session-supervising.login.form.actions.invigilate'}} | ||
</PixButton> | ||
</form> | ||
|
||
<p class='login-session-supervisor-form__description'> | ||
{{t 'pages.session-supervising.login.form.description'}} | ||
</p> | ||
</div> | ||
</template> |
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
File renamed without changes.
File renamed without changes.
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,15 +1,6 @@ | ||
{{page-title (t "pages.session-supervising.login.title")}} | ||
<div class="login-session-supervisor-page"> | ||
<div class="login-session-supervisor-page-content"> | ||
<LoginSessionSupervisorForm @onFormSubmit={{this.authenticateSupervisor}} /> | ||
|
||
<div class="login-session-supervisor-page-content__current-user-email"> | ||
<span><FaIcon @icon="user-circle" /> | ||
{{this.currentUserEmail}} | ||
</span> | ||
<LinkTo class="login-session-supervisor-page-content__logout" @route="logout"> | ||
{{t "pages.session-supervising.login.form.actions.switch-account"}} | ||
</LinkTo> | ||
</div> | ||
</div> | ||
</div> | ||
<LoginSessionSupervisor | ||
@authenticateSupervisor={{this.authenticateSupervisor}} | ||
@currentUserEmail={{this.currentUserEmail}} | ||
/> |
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,18 +1,27 @@ | ||
import { render as renderScreen } from '@1024pix/ember-testing-library'; | ||
import { click, fillIn } from '@ember/test-helpers'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
import LoginSessionSupervisor from 'pix-certif/components/login-session-supervisor'; | ||
import { module, test } from 'qunit'; | ||
import sinon from 'sinon'; | ||
|
||
import setupIntlRenderingTest from '../../helpers/setup-intl-rendering'; | ||
import setupIntlRenderingTest from '../../../helpers/setup-intl-rendering'; | ||
|
||
module('Integration | Component | login-session-supervisor-form', function (hooks) { | ||
module('Integration | Component | index', function (hooks) { | ||
setupIntlRenderingTest(hooks); | ||
|
||
test('it should render supervisor login form', async function (assert) { | ||
// when | ||
this.onFormSubmit = sinon.stub(); | ||
const screen = await renderScreen(hbs`<LoginSessionSupervisorForm @onFormSubmit={{this.onFormSubmit}}/>`); | ||
const authenticateSupervisor = sinon.stub(); | ||
const currentUserEmail = '[email protected]'; | ||
|
||
const screen = await renderScreen( | ||
<template> | ||
<LoginSessionSupervisor | ||
@authenticateSupervisor={{authenticateSupervisor}} | ||
@currentUserEmail={{currentUserEmail}} | ||
/> | ||
</template>, | ||
); | ||
|
||
// then | ||
assert.dom(screen.getByRole('heading', { name: 'Espace Surveillant' })).exists(); | ||
|
@@ -25,8 +34,18 @@ module('Integration | Component | login-session-supervisor-form', function (hook | |
module('On click on supervise button', function () { | ||
test('it should display an error message when the session id is empty', async function (assert) { | ||
// given | ||
this.onFormSubmit = sinon.stub(); | ||
const screen = await renderScreen(hbs`<LoginSessionSupervisorForm @onFormSubmit={{this.onFormSubmit}} />`); | ||
const authenticateSupervisor = sinon.stub(); | ||
const currentUserEmail = '[email protected]'; | ||
|
||
const screen = await renderScreen( | ||
<template> | ||
<LoginSessionSupervisor | ||
@authenticateSupervisor={{authenticateSupervisor}} | ||
@currentUserEmail={{currentUserEmail}} | ||
/> | ||
</template>, | ||
); | ||
|
||
await fillIn(screen.getByLabelText('Mot de passe de la session Exemple : C-12345'), '12345'); | ||
|
||
// when | ||
|
@@ -40,8 +59,18 @@ module('Integration | Component | login-session-supervisor-form', function (hook | |
|
||
test('it should display an error message when the supervisor password is empty', async function (assert) { | ||
// given | ||
this.onFormSubmit = sinon.stub(); | ||
const screen = await renderScreen(hbs`<LoginSessionSupervisorForm @onFormSubmit={{this.onFormSubmit}} />`); | ||
const authenticateSupervisor = sinon.stub(); | ||
const currentUserEmail = '[email protected]'; | ||
|
||
const screen = await renderScreen( | ||
<template> | ||
<LoginSessionSupervisor | ||
@authenticateSupervisor={{authenticateSupervisor}} | ||
@currentUserEmail={{currentUserEmail}} | ||
/> | ||
</template>, | ||
); | ||
|
||
await fillIn(screen.getByLabelText('Numéro de la session'), '12345'); | ||
|
||
// when | ||
|
@@ -55,16 +84,26 @@ module('Integration | Component | login-session-supervisor-form', function (hook | |
|
||
test('it should call onFormSubmit when all the fields are filled', async function (assert) { | ||
// given | ||
this.onFormSubmit = sinon.stub(); | ||
const screen = await renderScreen(hbs`<LoginSessionSupervisorForm @onFormSubmit={{this.onFormSubmit}} />`); | ||
const authenticateSupervisor = sinon.stub(); | ||
const currentUserEmail = '[email protected]'; | ||
|
||
const screen = await renderScreen( | ||
<template> | ||
<LoginSessionSupervisor | ||
@authenticateSupervisor={{authenticateSupervisor}} | ||
@currentUserEmail={{currentUserEmail}} | ||
/> | ||
</template>, | ||
); | ||
|
||
await fillIn(screen.getByRole('spinbutton', { name: 'Numéro de la session' }), '12345'); | ||
await fillIn(screen.getByLabelText('Mot de passe de la session Exemple : C-12345'), '6789'); | ||
|
||
// when | ||
await click(screen.getByRole('button', { name: 'Surveiller la session' })); | ||
|
||
// then | ||
sinon.assert.calledWith(this.onFormSubmit, { sessionId: '12345', supervisorPassword: '6789' }); | ||
sinon.assert.calledWith(authenticateSupervisor, { sessionId: '12345', supervisorPassword: '6789' }); | ||
assert.ok(true); | ||
}); | ||
}); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️