forked from AdaGold/inspiration-board
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Dionisia - Edges - Inspiration-Board #30
Open
larachan15
wants to merge
3
commits into
Ada-C10:master
Choose a base branch
from
larachan15:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import Board from './Board'; | ||
import { shallow } from 'enzyme'; | ||
|
||
|
||
describe('Board', () => { | ||
test('that it matches an existing snapshot for deleting', () => { | ||
const wrapper = shallow( <Board deleteCard={() => {} } />); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
test('that it matches an existing snapshot for adding', () => { | ||
const wrapper = shallow( <Board addCard={() => {} } />); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,50 @@ import emoji from 'emoji-dictionary'; | |
import './Card.css'; | ||
|
||
class Card extends Component { | ||
deleteCardHandler = () => { | ||
console.log("Delete button was clicked on"); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this be a functional component? |
||
this.props.deleteCardCallback(this.props.id) | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className="card"> | ||
Card | ||
<div className="card__content"> | ||
<p className="card__content-text"> | ||
{this.props.text} | ||
</p> | ||
<p className="card__content-emoji"> | ||
{this.props.emoji} | ||
</p> | ||
<button onClick={this.deleteCardHandler} | ||
type="button" | ||
className="card__delete" | ||
> | ||
Delete | ||
</button> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
// const Card = (props) => { | ||
// const { text, emoji } = props; | ||
// | ||
// return ( | ||
// <div className="card"> | ||
// <div className="card__content"> | ||
// <p className="card__content-text">{text}</p> | ||
// <p className="card__content-emoji">{emoji}</p> | ||
// </div> | ||
// </div> | ||
// ) | ||
// } | ||
|
||
Card.propTypes = { | ||
|
||
text: PropTypes.string, | ||
emoji: PropTypes.string, | ||
deleteCardCallback: PropTypes.func | ||
}; | ||
|
||
export default Card; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import Card from './Card'; | ||
import { shallow } from 'enzyme'; | ||
|
||
describe('Card', () => { | ||
test('that it matches an existing card snapshot', () => { | ||
const wrapper = shallow( <Card | ||
text="My message!" | ||
emoji="black_heart" | ||
deleteCardCallback={() => {} } />); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import NewCardForm from './NewCardForm'; | ||
import { shallow } from 'enzyme'; | ||
|
||
describe('NewCardForm', () => { | ||
test('that it matches an existing snapshot for adding', () => { | ||
const wrapper = shallow( | ||
<NewCardForm /> | ||
); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Board that it matches an existing snapshot for adding 1`] = ` | ||
<div> | ||
<section | ||
className="form-section" | ||
> | ||
<NewCardForm | ||
addCardCallback={[Function]} | ||
/> | ||
</section> | ||
<section | ||
className="board" | ||
/> | ||
</div> | ||
`; | ||
|
||
exports[`Board that it matches an existing snapshot for deleting 1`] = ` | ||
<div> | ||
<section | ||
className="form-section" | ||
> | ||
<NewCardForm | ||
addCardCallback={[Function]} | ||
/> | ||
</section> | ||
<section | ||
className="board" | ||
/> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Card that it matches an existing card snapshot 1`] = ` | ||
<div | ||
className="card" | ||
> | ||
<div | ||
className="card__content" | ||
> | ||
<p | ||
className="card__content-text" | ||
> | ||
My message! | ||
</p> | ||
<p | ||
className="card__content-emoji" | ||
> | ||
black_heart | ||
</p> | ||
<button | ||
className="card__delete" | ||
onClick={[Function]} | ||
type="button" | ||
> | ||
Delete | ||
</button> | ||
</div> | ||
</div> | ||
`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you've kept all the API interaction logic in one place - the callbacks are a little more complex, but I would say it makes the app as a whole much easier to comprehend. Whether or not you intended it, this is a great example of the container component pattern well-applied.