-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wrote tests for view module component
- Loading branch information
1 parent
b3ad0ba
commit 1a58dc7
Showing
16 changed files
with
328 additions
and
62 deletions.
There are no files selected for viewing
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,21 @@ | ||
import React from 'react'; | ||
import { arrayOf, object } from 'prop-types'; | ||
import './contentList.scss'; | ||
|
||
const ContentList = ({ contents }) => ( | ||
contents.map((content) => { | ||
return ( | ||
<div key={content.id} className="content-item"> | ||
<a href={content.link}> | ||
<p>{content.name}</p> | ||
</a> | ||
</div> | ||
); | ||
}) | ||
); | ||
|
||
ContentList.propTypes = { | ||
contents: arrayOf(object), | ||
}; | ||
|
||
export default ContentList; |
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,21 @@ | ||
.content-item { | ||
margin: 0px 0px 25px; | ||
cursor: pointer; | ||
padding: 10px; | ||
border-radius: 5px; | ||
box-shadow: 2px 2px 10px rgba(0,0,0,0.6); | ||
|
||
&:hover { | ||
border: solid #f3994a 2px; | ||
} | ||
a { | ||
text-decoration: none; | ||
color: #f3994a; | ||
font-size: 18px; | ||
|
||
p { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
} | ||
} |
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
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,11 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import toJson from 'enzyme-to-json'; | ||
import ModuleSidebar from '../../components/ModuleSidebar'; | ||
|
||
describe('Component: ModuleSidebar', () => { | ||
it('should render correctly', () => { | ||
const wrapper = shallow(<ModuleSidebar />); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
}); |
55 changes: 55 additions & 0 deletions
55
src/test/components/__snapshots__/ModuleSidebar.spec.js.snap
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,55 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Component: ModuleSidebar should render correctly 1`] = ` | ||
<Sidebar> | ||
<div | ||
className="d-aside" | ||
> | ||
<div> | ||
<span | ||
className="d-logo" | ||
> | ||
<img | ||
alt="logo" | ||
src="test-file-stub" | ||
/> | ||
Community | ||
</span> | ||
</div> | ||
<ul | ||
className="d-links" | ||
> | ||
<li | ||
className="module-active" | ||
> | ||
<Link | ||
to="/dashboard" | ||
> | ||
Modules | ||
</Link> | ||
</li> | ||
<li> | ||
<Link | ||
to="/profile" | ||
> | ||
Profile | ||
</Link> | ||
</li> | ||
<li> | ||
<Link | ||
to="/payment" | ||
> | ||
Payment | ||
</Link> | ||
</li> | ||
<li> | ||
<Link | ||
to="/aboutus" | ||
> | ||
Help | ||
</Link> | ||
</li> | ||
</ul> | ||
</div> | ||
</Sidebar> | ||
`; |
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,98 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`View Module component should render ViewModule correctly 1`] = ` | ||
<Fragment> | ||
<Connect(Header) /> | ||
<Container | ||
className="v-container" | ||
fluid={true} | ||
tag="div" | ||
> | ||
<Row | ||
className="m-row" | ||
tag="div" | ||
> | ||
<Col | ||
className="v-sidebar" | ||
sm="2" | ||
tag="div" | ||
widths={ | ||
Array [ | ||
"xs", | ||
"sm", | ||
"md", | ||
"lg", | ||
"xl", | ||
] | ||
} | ||
> | ||
<ModuleSidebar /> | ||
</Col> | ||
<Col | ||
sm="10" | ||
tag="div" | ||
widths={ | ||
Array [ | ||
"xs", | ||
"sm", | ||
"md", | ||
"lg", | ||
"xl", | ||
] | ||
} | ||
> | ||
<main | ||
className="module-main" | ||
> | ||
<div | ||
className="module-header" | ||
> | ||
<h2> | ||
Getting Started | ||
</h2> | ||
<p | ||
className="module-description" | ||
> | ||
introduction to customer learning | ||
</p> | ||
</div> | ||
<div | ||
className="module-content" | ||
> | ||
<p | ||
className="content-header" | ||
> | ||
Content | ||
</p> | ||
<div | ||
className="module-content-items" | ||
> | ||
<ContentList | ||
contents={ | ||
Array [ | ||
Object { | ||
"id": 1, | ||
"link": "http://localhost:3000", | ||
"name": "Introduction", | ||
}, | ||
] | ||
} | ||
/> | ||
</div> | ||
</div> | ||
<Link | ||
to="/test/4" | ||
> | ||
<Button | ||
classname="test-button" | ||
text="Take Test" | ||
type="button" | ||
/> | ||
</Link> | ||
</main> | ||
</Col> | ||
</Row> | ||
</Container> | ||
<Footer /> | ||
</Fragment> | ||
`; |
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
Oops, something went wrong.