Skip to content
This repository has been archived by the owner on Mar 30, 2018. It is now read-only.

Commit

Permalink
Fix test warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshHARDIYA committed Nov 22, 2016
1 parent 9fa22cb commit 59e2b34
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 12 deletions.
54 changes: 45 additions & 9 deletions src/Modal/__tests__/__snapshots__/index-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ exports[`Modal renders a Blank Modal 1`] = `
closeOnOutsideClick={true}
onClose={[Function]}
onOpen={[Function]}
openByClickOn="button">
openByClickOn={
<button>
Open
</button>
}>
<div
aria-hidden={false}
className="uk-modal"
Expand Down Expand Up @@ -55,7 +59,11 @@ exports[`Modal renders a Caption 1`] = `
closeOnOutsideClick={true}
onClose={[Function]}
onOpen={[Function]}
openByClickOn="button">
openByClickOn={
<button>
Open
</button>
}>
<div
aria-hidden={false}
className="uk-modal"
Expand Down Expand Up @@ -88,7 +96,11 @@ exports[`Modal renders a Header and Footer 1`] = `
closeOnOutsideClick={true}
onClose={[Function]}
onOpen={[Function]}
openByClickOn="button">
openByClickOn={
<button>
Open
</button>
}>
<div
aria-hidden={false}
className="uk-modal"
Expand Down Expand Up @@ -130,7 +142,11 @@ exports[`Modal renders a Lightbox 1`] = `
closeOnOutsideClick={true}
onClose={[Function]}
onOpen={[Function]}
openByClickOn="button">
openByClickOn={
<button>
Open
</button>
}>
<div
aria-hidden={false}
className="uk-modal"
Expand Down Expand Up @@ -161,7 +177,11 @@ exports[`Modal renders a Spinner 1`] = `
closeOnOutsideClick={true}
onClose={[Function]}
onOpen={[Function]}
openByClickOn="button">
openByClickOn={
<button>
Open
</button>
}>
<div
aria-hidden={false}
className="uk-modal"
Expand All @@ -188,7 +208,11 @@ exports[`Modal renders an alert modal 1`] = `
closeOnOutsideClick={true}
onClose={[Function]}
onOpen={[Function]}
openByClickOn="button">
openByClickOn={
<button>
Open
</button>
}>
<div
aria-hidden={false}
className="uk-modal"
Expand Down Expand Up @@ -223,7 +247,11 @@ exports[`Modal renders an confirm modal 1`] = `
closeOnOutsideClick={true}
onClose={[Function]}
onOpen={[Function]}
openByClickOn="button">
openByClickOn={
<button>
Open
</button>
}>
<div
aria-hidden={false}
className="uk-modal"
Expand Down Expand Up @@ -267,7 +295,11 @@ exports[`Modal renders an prompt modal 1`] = `
closeOnOutsideClick={true}
onClose={[Function]}
onOpen={[Function]}
openByClickOn="button">
openByClickOn={
<button>
Open
</button>
}>
<div
aria-hidden={false}
className="uk-modal"
Expand Down Expand Up @@ -318,7 +350,11 @@ exports[`Modal renders correctly 1`] = `
closeOnOutsideClick={true}
onClose={[Function]}
onOpen={[Function]}
openByClickOn="button">
openByClickOn={
<button>
Open
</button>
}>
<div
aria-hidden={false}
className="uk-modal"
Expand Down
16 changes: 14 additions & 2 deletions src/Modal/__tests__/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Modal', () => {
it('renders correctly', () => {
const options = { createNodeMock }
const component = renderer.create(
<Modal>Lorem ipsum</Modal>, options
<Modal target={<button>Open</button>}>Lorem ipsum</Modal>, options
)
expect(component.toJSON()).toMatchSnapshot()
})
Expand All @@ -30,6 +30,7 @@ describe('Modal', () => {
({ handleClose }) => <button onClick={handleClose}>Yes!</button>,
]}
header="Headline"
target={<button>Open</button>}
>
Lorem ipsum
</Modal>
Expand All @@ -41,6 +42,7 @@ describe('Modal', () => {
const component = renderer.create(
<Modal
caption="Caption"
target={<button>Open</button>}
>
Lorem ipsum
</Modal>
Expand All @@ -52,6 +54,7 @@ describe('Modal', () => {
const component = renderer.create(
<Modal
lightbox
target={<button>Open</button>}
>
<img role="presentation" src="http://getuikit.com/docs/images/placeholder_600x400.svg" />
</Modal>
Expand All @@ -63,6 +66,7 @@ describe('Modal', () => {
const component = renderer.create(
<Modal
blank
target={<button>Open</button>}
>
<div className="uk-grid uk-flex-middle">
<div
Expand All @@ -87,6 +91,7 @@ describe('Modal', () => {
const component = renderer.create(
<Modal
close={false}
target={<button>Open</button>}
>
<div className="uk-modal-spinner" />
</Modal>
Expand All @@ -97,6 +102,7 @@ describe('Modal', () => {
it('renders an alert modal', () => {
const component = renderer.create(
<Modal
target={<button>Open</button>}
type="alert"
>
Something bad happened!
Expand All @@ -108,6 +114,7 @@ describe('Modal', () => {
it('renders an confirm modal', () => {
const component = renderer.create(
<Modal
target={<button>Open</button>}
type="confirm"
>
Are you absolutely sure about this?
Expand All @@ -119,6 +126,7 @@ describe('Modal', () => {
it('renders an prompt modal', () => {
const component = renderer.create(
<Modal
target={<button>Open</button>}
type="prompt"
>
Please enter the name of the repo you&quot;re deleting:
Expand All @@ -128,7 +136,11 @@ describe('Modal', () => {
})

let component = renderer.create(
<Modal>Lorem ipsum</Modal>
<Modal
target={<button>Open</button>}
>
Lorem ipsum
</Modal>
)

it('should handle handleClick', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Modal extends Component {
children: PropTypes.node,
confirmLabel: PropTypes.string,
isOpen: PropTypes.bool,
target: PropTypes.node,
target: PropTypes.element,
type: PropTypes.string,
onCancel: PropTypes.func,
onConfirm: PropTypes.func,
Expand Down

0 comments on commit 59e2b34

Please sign in to comment.