Skip to content

Commit

Permalink
labeled the description field so that users will know what to enter
Browse files Browse the repository at this point in the history
  • Loading branch information
kesslerpillar committed May 22, 2021
1 parent 8c8494d commit 0d1712a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,22 @@ test('should display the name placeholder', () => {
```
- Commit on Green. And always be looking for ways to refactor your code. Small improvements over time are easier to make than large changes when your code is a mess.

[Code for this section](https://github.com/pairing4good/tdd-amplify-react/commit/b8c8a84a9b70ce70cc2317e09adc15e2f03b8345)
[Code for this section](https://github.com/pairing4good/tdd-amplify-react/commit/b8c8a84a9b70ce70cc2317e09adc15e2f03b8345)

### Description Input Test
- Test drive the label for the description input.
```js
test('should display the description placeholder', () => {
render(<NoteForm />)
const input = screen.getByTestId('note-description-field');

expect(input).toHaveAttribute('placeholder', 'Note Description');
});
```
- Make this red test go green
```js
<input data-testid="note-description-field" placeholder="Note Description"/>
```
- Commit on Green.

[Code for this section]()
2 changes: 1 addition & 1 deletion src/NoteForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function NoteForm(props) {
return (
<div>
<input data-testid="note-name-field" placeholder="Note Name"/>
<input data-testid="note-description-field"/>
<input data-testid="note-description-field" placeholder="Note Description"/>
<button data-testid="note-form-submit">Create Note</button>
<p data-testid="test-name-0">test note</p>
<p data-testid="test-description-0">test note description</p>
Expand Down
7 changes: 7 additions & 0 deletions src/test/NoteForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@ test('should display the name placeholder', () => {
const input = screen.getByTestId('note-name-field');

expect(input).toHaveAttribute('placeholder', 'Note Name');
});

test('should display the description placeholder', () => {
render(<NoteForm />)
const input = screen.getByTestId('note-description-field');

expect(input).toHaveAttribute('placeholder', 'Note Description');
});

0 comments on commit 0d1712a

Please sign in to comment.