{}} />
+ );
+
+ expect(form).toMatchSnapshot();
+
+ form.unmount();
+ });
+
+});
diff --git a/src/components/Card.js b/src/components/Card.js
index 6788cc03..1d464d15 100644
--- a/src/components/Card.js
+++ b/src/components/Card.js
@@ -5,17 +5,35 @@ import emoji from 'emoji-dictionary';
import './Card.css';
class Card extends Component {
+
+ deleteOnSubmit = (event) => {
+ // console.log(this.props.id);
+ this.props.onDeleteCard(this.props.id);
+ }
+
render() {
+ const emojis = this.props.emoji
+
return (
- Card
+ Card
+
+ {this.props.id}
+ {this.props.text}
+ {emoji.getUnicode(`${emojis}`)}
+
+
+
)
}
}
Card.propTypes = {
-
+ text: PropTypes.string.isRequired,
+ emoji: PropTypes.string
};
export default Card;
diff --git a/src/components/Card.test.js b/src/components/Card.test.js
new file mode 100644
index 00000000..de8c69f2
--- /dev/null
+++ b/src/components/Card.test.js
@@ -0,0 +1,17 @@
+import React from 'react';
+import Card from './Card';
+import { mount, shallow } from 'enzyme';
+
+describe('Card', () => {
+ test('onClick handler working', () => {
+ // const textValue = 'Encouraging message';
+ const onClick = jest.fn();
+ const wrapper = shallow(
+
+ );
+
+ expect(wrapper).toMatchSnapshot();
+
+ wrapper.find('button').simulate('click');
+ })
+})
diff --git a/src/components/NewCardForm.css b/src/components/NewCardForm.css
index d11b9ad4..d277b5e5 100644
--- a/src/components/NewCardForm.css
+++ b/src/components/NewCardForm.css
@@ -4,6 +4,7 @@
width: 50%;
margin: auto;
padding-bottom: 4rem;
+ background-color: lightblue;
}
.new-card-form__header {
diff --git a/src/components/NewCardForm.js b/src/components/NewCardForm.js
index 47331423..f34f6890 100644
--- a/src/components/NewCardForm.js
+++ b/src/components/NewCardForm.js
@@ -4,3 +4,86 @@ import emoji from 'emoji-dictionary';
import './NewCardForm.css';
const EMOJI_LIST = ["", "heart_eyes", "beer", "clap", "sparkling_heart", "heart_eyes_cat", "dog"]
+
+class NewCardForm extends Component {
+ static propTypes = {
+ addCardCallback: PropTypes.func.isRequired
+ };
+
+ constructor() {
+ super();
+
+ this.state = {
+ text: '',
+ emoji: ''
+ }
+ }
+
+ onInputChange = (event) => {
+ // this doesn't work for multiple keys
+ // this.setState({
+ // text: event.target.value,
+ // emoji: event.target.value});
+ const key = event.target.name;
+ let value = event.target.value;
+
+ const updatedInput= {};
+ updatedInput[key] = value;
+ this.setState(updatedInput);
+ }
+
+ onFormSubmit = (event) => {
+ event.preventDefault();
+ console.log("on form submit");
+
+ this.props.addCardCallback(this.state);
+
+ console.log(this.state);
+ this.setState({
+ text: '',
+ emoji: ''
+ });
+ console.log(this.state);
+ }
+
+ render() {
+ const emojiList = EMOJI_LIST.map((emojiWord, index) => {
+ return })
+
+ return (
+
+ );
+ }
+}
+
+export default NewCardForm;
diff --git a/src/components/NewCardForm.test.js b/src/components/NewCardForm.test.js
index e69de29b..9a38a6b0 100644
--- a/src/components/NewCardForm.test.js
+++ b/src/components/NewCardForm.test.js
@@ -0,0 +1,15 @@
+import React from 'react';
+import NewCardForm from './NewCardForm';
+import { mount } from 'enzyme';
+
+describe('NewCardForm', () => {
+ test('that it matches an existing snapshot', () => {
+ // Arrange: First Mount the Component in the testing DOM
+ const wrapper = mount( {} } />);
+
+ // Asserts that looks like last snapshot
+ expect(wrapper).toMatchSnapshot();
+
+ wrapper.unmount();
+ });
+});
diff --git a/src/components/Status.js b/src/components/Status.js
new file mode 100644
index 00000000..cc8a0afe
--- /dev/null
+++ b/src/components/Status.js
@@ -0,0 +1,23 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+
+class Status extends React.Component {
+ static propTypes = {
+ message: PropTypes.string,
+ type: PropTypes.string
+ }
+ render() {
+ let prefix = '';
+ if (this.props.type === 'error') {
+ prefix = "There was a problem: ";
+ }
+ return (
+
+ {prefix}
+ {this.props.message}
+
+ );
+ }
+}
+
+export default Status;
diff --git a/src/components/__snapshots__/Board.test.js.snap b/src/components/__snapshots__/Board.test.js.snap
new file mode 100644
index 00000000..eb5a2ace
--- /dev/null
+++ b/src/components/__snapshots__/Board.test.js.snap
@@ -0,0 +1,192 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Board render a new card form 1`] = `
+
+`;
+
+exports[`Board render a new card form 2`] = `
+
+`;
+
+exports[`Board shallow mount 1`] = `
+
+`;
diff --git a/src/components/__snapshots__/Card.test.js.snap b/src/components/__snapshots__/Card.test.js.snap
new file mode 100644
index 00000000..ed74262c
--- /dev/null
+++ b/src/components/__snapshots__/Card.test.js.snap
@@ -0,0 +1,8 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Card onClick handler working 1`] = `
+
+`;
diff --git a/src/components/__snapshots__/NewCardForm.test.js.snap b/src/components/__snapshots__/NewCardForm.test.js.snap
new file mode 100644
index 00000000..75e6637e
--- /dev/null
+++ b/src/components/__snapshots__/NewCardForm.test.js.snap
@@ -0,0 +1,97 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`NewCardForm that it matches an existing snapshot 1`] = `
+
+
+
+`;
diff --git a/src/data/card-data.json b/src/data/card-data.json
index 1f9793ec..068e019d 100644
--- a/src/data/card-data.json
+++ b/src/data/card-data.json
@@ -6,7 +6,7 @@
},
{
"text": "",
- "Emoji": "heart_eyes"
+ "emoji": "heart_eyes"
},
{
"text": "REST is part of work"