Skip to content

Commit

Permalink
release 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yjose committed Feb 5, 2018
1 parent 285b981 commit 84ecd73
Show file tree
Hide file tree
Showing 15 changed files with 560 additions and 120 deletions.
406 changes: 385 additions & 21 deletions __test__/__snapshots__/index.test.js.snap

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions __test__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@ const PopupTestInput = props => (
popup content
</Popup>
);

const PopupTriggerFunction = props => (
<Popup
{...props}
trigger={open => <button>Button nested {open ? "open" : "close"}</button>}
>
popup content
</Popup>
);
const PopupContentAsFunction = props => (
<Popup {...props} trigger={<button> Trigger</button>}>
{(close, open) => <div> Popup content {open ? "open" : "close"} </div>}
</Popup>
);
test("it should render correctly ", () => {
const popup = shallow(<PopupTest triggerOn="click" />);
expect(shallowToJson(popup)).toMatchSnapshot();
Expand Down Expand Up @@ -45,7 +57,26 @@ test("it should render correctly on hover (triggerOn = 'focus') ", () => {
expect(shallowToJson(popup)).toMatchSnapshot();
});

// closeOnDocumentClick Tests
// trigger as function

test("it should render correctly on click and will update the trigger text ", () => {
const popup = mount(<PopupTriggerFunction />);
popup.find("button").simulate("click");
expect(shallowToJson(popup)).toMatchSnapshot();
popup.find("button").simulate("click");
expect(shallowToJson(popup)).toMatchSnapshot();
});

// content as function
test("it should render correctly on click and will update the the popup content text ", () => {
const popup = mount(<PopupContentAsFunction />);
popup.find("button").simulate("click");
expect(shallowToJson(popup)).toMatchSnapshot();
popup.find("button").simulate("click");
expect(shallowToJson(popup)).toMatchSnapshot();
});

// closeOnDocumentClick Tests PopupContentAsFunction

test("it shouldn't close on click outside popup ", () => {
const popup = mount(<PopupTest triggerOn="click" />);
Expand Down
12 changes: 12 additions & 0 deletions lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ Requires React >= 16.0

![alt text](https://cdn-images-1.medium.com/max/800/1*x-TqQwyT2ADmnb51oRJCOg.gif)

## TO DO

* [x] Create repository && publish package
* [x] Create reactjs-popup Home page
* [x] Tooltip Support
* [x] Modal Support
* [x] Menu & Nested Menu Support
* [x] Add Live examples
* [ ] Animation API
* [ ] Toast Support
* [ ] suggest a feature [here](https://github.com/yjose/reactjs-popup/labels/Features)

## Installing / Getting started

This package is available in npm repository as reactjs-popup. It will work correctly with all popular bundlers.
Expand Down
2 changes: 1 addition & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactjs-popup",
"version": "1.0.1",
"version": "1.0.2",
"description": "React Popup Component",
"main": "reactjsPopup.es.js",
"module": "reactjsPopup.es.js",
Expand Down
54 changes: 31 additions & 23 deletions lib/reactjs-popup.dev.js

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

2 changes: 1 addition & 1 deletion lib/reactjs-popup.dev.js.map

Large diffs are not rendered by default.

54 changes: 31 additions & 23 deletions lib/reactjs-popup.js

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

2 changes: 1 addition & 1 deletion lib/reactjs-popup.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 84ecd73

Please sign in to comment.