Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/gh-7-key-press' into gh-7-key-press
Browse files Browse the repository at this point in the history
  • Loading branch information
K-itKat20 authored and K-itKat20 committed Oct 23, 2020
2 parents 799496d + c4cf4d7 commit 0b0d21c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ui/src/components/login/login-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export default class LoginForm extends React.Component<IProps, IState> {

public render() {
return (
<<<<<<< HEAD
<main id='login-form'>
=======
<main id="login-form">
>>>>>>> gh-07-key-press
<Container component="main" maxWidth="xs">
{this.state.outcome && (
<NotificationAlert alertType={this.state.outcome} message={this.state.outcomeMessage} />
Expand Down
16 changes: 16 additions & 0 deletions ui/test/components/login/temp-password-login-form.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('On Render', () => {
it('should render Update Password button', () => {
expect(component.find('button#update-button')).toHaveLength(1);
});
<<<<<<< HEAD
it('should submit the form if all 3 textfields have text and the enter key is pressed ', () => {
//given that i have inputted my details in the text field
//when I press the enter key
Expand All @@ -35,6 +36,21 @@ describe('On Render', () => {
//given that i have inputted my details in the text field
//when I click the submit button
//the form should submit
=======
it('should submit the form when all three fields have text and the Enter key is pressed', () => {
//given I have entered details in the 3 textfields
//when I press the enter key
//then it should submit the form
inputUsername('testUsername');
inputTempPassword('testTempPassword');
inputNewPassword('testNewPassword');

const textField = component.find('input#username');
ReactTestUtils.Simulate.keyDown(textField, {key: "Enter", keyCode: 13, which: 13});
// component.find('input#username').simulate('keyDown', { key: 'Enter', keyCode: 13, which: 13 });
// expect(component.find('input#username').props().onKeyPress).toBeTruthy();
expect(component.find('div#notification-alert').text()).toBe('Login failed: User does not exist.');
>>>>>>> gh-07-key-press
});
});

Expand Down

0 comments on commit 0b0d21c

Please sign in to comment.