Skip to content

Commit

Permalink
added a header for usability
Browse files Browse the repository at this point in the history
  • Loading branch information
kesslerpillar committed May 24, 2021
1 parent f08a7c5 commit 4f4defe
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -755,4 +755,51 @@ test('should throw an exception the note array is undefined', () => {
- Don't forget to rerun your Cypress tests. Green!
- Commit on Green.

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

## Usability
Customers rarely ask explicitly for a usable product. In this application rich world that we live in it's assumed that applications will be delivered with common sense usability baked-in. When I look at the application as it stands, a few things pop out at me.
1. Header - there's no heading telling you what this application does
1. Validation - there's no form field validation
1. Reset Form - after a note is created the form fields are not reset

### Header
- Create a new file `Header.js` in the `src` directory
```js
function Header() {

return (

);
}

export
```
- Let's test drive this component
- Create a new file `Header.test.js` in the `src/test` directory
```js
import { render, screen } from '@testing-library/react';
import Header from '../Header';

test('should display header', () => {
render(<Header />);
const heading = screen.getByRole('heading', { level: 1 });
expect(heading).toHaveTextContent('My Notes App')
});
```
- We have a failing test.
- Let's make it pass
```js
function Header() {

return (
<h1>My Notes App</h1>
);
}

export default Header;
```
- It's Green!
- Commit your code!

[Code for this section]()
8 changes: 8 additions & 0 deletions src/Header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function Header() {

return (
<h1>My Notes App</h1>
);
}

export default Header;
8 changes: 8 additions & 0 deletions src/test/Header.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { render, screen } from '@testing-library/react';
import Header from '../Header';

test('should display header', () => {
render(<Header />);
const heading = screen.getByRole('heading', { level: 1 });
expect(heading).toHaveTextContent('My Notes App')
});

0 comments on commit 4f4defe

Please sign in to comment.