Skip to content

Commit 0d1712a

Browse files
committed
labeled the description field so that users will know what to enter
1 parent 8c8494d commit 0d1712a

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,22 @@ test('should display the name placeholder', () => {
285285
```
286286
- 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.
287287

288-
[Code for this section](https://github.com/pairing4good/tdd-amplify-react/commit/b8c8a84a9b70ce70cc2317e09adc15e2f03b8345)
288+
[Code for this section](https://github.com/pairing4good/tdd-amplify-react/commit/b8c8a84a9b70ce70cc2317e09adc15e2f03b8345)
289+
290+
### Description Input Test
291+
- Test drive the label for the description input.
292+
```js
293+
test('should display the description placeholder', () => {
294+
render(<NoteForm />)
295+
const input = screen.getByTestId('note-description-field');
296+
297+
expect(input).toHaveAttribute('placeholder', 'Note Description');
298+
});
299+
```
300+
- Make this red test go green
301+
```js
302+
<input data-testid="note-description-field" placeholder="Note Description"/>
303+
```
304+
- Commit on Green.
305+
306+
[Code for this section]()

src/NoteForm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function NoteForm(props) {
22
return (
33
<div>
44
<input data-testid="note-name-field" placeholder="Note Name"/>
5-
<input data-testid="note-description-field"/>
5+
<input data-testid="note-description-field" placeholder="Note Description"/>
66
<button data-testid="note-form-submit">Create Note</button>
77
<p data-testid="test-name-0">test note</p>
88
<p data-testid="test-description-0">test note description</p>

src/test/NoteForm.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,11 @@ test('should display the name placeholder', () => {
1313
const input = screen.getByTestId('note-name-field');
1414

1515
expect(input).toHaveAttribute('placeholder', 'Note Name');
16+
});
17+
18+
test('should display the description placeholder', () => {
19+
render(<NoteForm />)
20+
const input = screen.getByTestId('note-description-field');
21+
22+
expect(input).toHaveAttribute('placeholder', 'Note Description');
1623
});

0 commit comments

Comments
 (0)