File tree 2 files changed +16
-1
lines changed
app/components/authentication/password-reset-demand
tests/integration/components/authentication/password-reset-demand
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,15 @@ export default class PasswordResetDemandForm extends Component {
18
18
@service requestManager;
19
19
@service storage;
20
20
@service url;
21
+ @service router;
21
22
22
23
@tracked globalError = this .errors .hasErrors && this .errors .shift ();
23
24
@tracked isLoading = false ;
24
25
@tracked isPasswordResetDemandReceived = false ;
25
26
26
27
constructor () {
27
28
super (... arguments );
28
- this .email = this .storage .getLogin ();
29
+ this .email = this .storage .getLogin () || this . router . currentRoute . queryParams ? . email ;
29
30
}
30
31
31
32
validation = new FormValidation ({
Original file line number Diff line number Diff line change @@ -55,6 +55,20 @@ module('Integration | Component | Authentication | PasswordResetDemand | passwor
55
55
assert .strictEqual (link .getAttribute (' href' ), ' https://pix.fr/support' );
56
56
});
57
57
58
+ module (' when the email to reset is passed in query parameters' , function () {
59
+ test (' it displays the given email address in email input' , async function (assert ) {
60
+ // given
61
+ const routerService = this .owner .lookup (' service:router' );
62
+ sinon .stub (routerService, ' router' );
63
+
64
+ // when
65
+ const screen = await render (<template ><PasswordResetDemandForm /></template >);
66
+
67
+ // then
68
+ assert .dom (screen .queryByRole (' textbox' , { name: ' Adresse e-mail' })).exists ();
69
+ });
70
+ });
71
+
58
72
module (' email input validation' , function () {
59
73
module (' when the email input is valid' , function () {
60
74
test (' it doesn’t display any error message' , async function (assert ) {
You can’t perform that action at this time.
0 commit comments