Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ampers: Alex; #32

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 25 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,37 @@ import './App.css';
import Board from './components/Board';

class App extends Component {
constructor() {
super(); {

this.state = {};
}
}

setNotifications = (messages) => {
if (messages.message || messages.error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting way to pass notifications back up

this.setState(messages)
this.displayNotifications();
}
}

displayNotifications = () => {
if (this.state.message) {
return <p>{this.state.message}</p>
}
if (this.state.error) {
return <p>{this.state.error}</p>
}
}

render() {
return (
<section>
{this.displayNotifications()}
<header className="header">
<h1 className="header__h1"><span className="header__text">Inspiration Board</span></h1>
</header>
<Board
url="https://inspiration-board.herokuapp.com/boards/"
boardName={`Ada-Lovelace`}
/>
<Board notificationCallback={this.setNotifications} />
</section>
);
}
Expand Down
8 changes: 8 additions & 0 deletions src/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ describe('App', () => {
ReactDOM.unmountComponentAtNode(div);
});

describe('App', () => {
test('that it renders App with shallow rendering', () => {
const wrapper = shallow(<App />);
expect(wrapper).toMatchSnapshot();
wrapper.unmount();
})
})

});
201 changes: 201 additions & 0 deletions src/__snapshots__/App.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`App App that it renders App with shallow rendering 1`] = `
ShallowWrapper {
"length": 1,
Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <App />,
Symbol(enzyme.__renderer__): Object {
"batchedUpdates": [Function],
"getNode": [Function],
"render": [Function],
"simulateEvent": [Function],
"unmount": [Function],
},
Symbol(enzyme.__node__): Object {
"instance": null,
"key": undefined,
"nodeType": "host",
"props": Object {
"children": Array [
undefined,
<header
className="header"
>
<h1
className="header__h1"
>
<span
className="header__text"
>
Inspiration Board
</span>
</h1>
</header>,
<Board
notificationCallback={[Function]}
/>,
],
},
"ref": null,
"rendered": Array [
undefined,
Object {
"instance": null,
"key": undefined,
"nodeType": "host",
"props": Object {
"children": <h1
className="header__h1"
>
<span
className="header__text"
>
Inspiration Board
</span>
</h1>,
"className": "header",
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "host",
"props": Object {
"children": <span
className="header__text"
>
Inspiration Board
</span>,
"className": "header__h1",
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "host",
"props": Object {
"children": "Inspiration Board",
"className": "header__text",
},
"ref": null,
"rendered": "Inspiration Board",
"type": "span",
},
"type": "h1",
},
"type": "header",
},
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"notificationCallback": [Function],
},
"ref": null,
"rendered": null,
"type": [Function],
},
],
"type": "section",
},
Symbol(enzyme.__nodes__): Array [
Object {
"instance": null,
"key": undefined,
"nodeType": "host",
"props": Object {
"children": Array [
undefined,
<header
className="header"
>
<h1
className="header__h1"
>
<span
className="header__text"
>
Inspiration Board
</span>
</h1>
</header>,
<Board
notificationCallback={[Function]}
/>,
],
},
"ref": null,
"rendered": Array [
undefined,
Object {
"instance": null,
"key": undefined,
"nodeType": "host",
"props": Object {
"children": <h1
className="header__h1"
>
<span
className="header__text"
>
Inspiration Board
</span>
</h1>,
"className": "header",
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "host",
"props": Object {
"children": <span
className="header__text"
>
Inspiration Board
</span>,
"className": "header__h1",
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "host",
"props": Object {
"children": "Inspiration Board",
"className": "header__text",
},
"ref": null,
"rendered": "Inspiration Board",
"type": "span",
},
"type": "h1",
},
"type": "header",
},
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"notificationCallback": [Function],
},
"ref": null,
"rendered": null,
"type": [Function],
},
],
"type": "section",
},
],
Symbol(enzyme.__options__): Object {
"adapter": ReactSixteenAdapter {
"options": Object {
"enableComponentDidUpdateOnSetState": true,
},
},
},
}
`;
1 change: 1 addition & 0 deletions src/components/Board.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.board {
display: flex;
justify-content: center;
flex-wrap: wrap;
}

Expand Down
Loading