Skip to content

Commit

Permalink
add test and changelog for onClick
Browse files Browse the repository at this point in the history
  • Loading branch information
Ola Holmström committed Jun 29, 2015
1 parent e566043 commit 0a132b7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
### 1.3.7 (2015-06-19)

* Add onClick to component.

### 1.3.6 (2015-06-23)

* Add beforeTagAdd and beforeTagRemove props.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -142,7 +142,7 @@ Callback when input field blurs.

##### onClick

Callback when the input field is clicked
Callback when the component (anything from tags to the input) is clicked on.

##### onKeyDown

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -4,7 +4,7 @@
"react-tagsinput.js",
"react-tagsinput.css"
],
"version": "1.3.6",
"version": "1.3.7",
"homepage": "https://github.com/olahol/react-tagsinput",
"description": "Simple react.js component for inputing tags",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-tagsinput",
"version": "1.3.6",
"version": "1.3.7",
"description": "Simple react.js component for inputing tags",
"main": "react-tagsinput.js",
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions react-tagsinput.js
Expand Up @@ -278,6 +278,7 @@
if (e.target === this.getDOMNode()) {
this.focus();
}

this.props.onClick(e);
}

Expand Down
19 changes: 19 additions & 0 deletions test/index.js
Expand Up @@ -314,6 +314,25 @@ describe("TagsInput", function () {
assert.equal(input.props.className.trim(), "tagsinput-input", "there should be no namespace");
});

it("should test onClick", function (done) {
var clicks = 0;
var tagsinput = createTagsInput({
onClick: function () {
clicks++;
if (clicks === 2) {
done();
}
}
}).tagsInput();

var tag = randomString();

var input = addTag(tagsinput, tag, true);

TestUtils.Simulate.click(tagsinput.getDOMNode());
TestUtils.Simulate.click(input.getDOMNode());
});

it("should test transform prop", function () {
var tagsinput = createTagsInput({
transform: function (tag) {
Expand Down

1 comment on commit 0a132b7

@willwashburn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks! This is great!

Please sign in to comment.