Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-tag-input

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tag-input - npm Package Compare versions

Comparing version 3.0.5 to 3.0.6

dist-modules/reactTags.js

8

lib/ReactTags.js

@@ -42,2 +42,3 @@ import React from 'react';

handleInputChange: React.PropTypes.func,
handleInputBlur: React.PropTypes.func,
minQueryLength: React.PropTypes.number,

@@ -111,2 +112,8 @@ shouldRenderSuggestions: React.PropTypes.func,

},
handleBlur: function(e) {
var value = e.target.value.trim();
if (this.props.handleInputBlur && value.length){
this.props.handleInputBlur(value)
}
},
handleKeyDown: function(e) {

@@ -254,2 +261,3 @@ var { query, selectedIndex, suggestions } = this.state;

aria-label={placeholder}
onBlur={this.handleBlur}
onChange={this.handleChange}

@@ -256,0 +264,0 @@ onKeyDown={this.handleKeyDown}

2

package.json
{
"name": "react-tag-input",
"version": "3.0.5",
"version": "3.0.6",
"description": "React tags is a fantastically simple tagging component for your React projects",

@@ -5,0 +5,0 @@ "main": "dist-modules/reactTags.js",

@@ -109,2 +109,3 @@ React-Tags

- [`handleInputChange`](#handleInputChange)
- [`handleInputBlur`](#handleInputBlur)
- [`minQueryLength`](#minQueryLength)

@@ -217,2 +218,12 @@ - [`removeComponent`](#removeComponent)

<a name="handleInputBlur"></a>
##### handleInputBlur (optional)
Optional event handler for input onBlur
```js
<ReactTags
handleInputBlur={this.handleInputBlur}
...>
```
<a name="minQueryLength"></a>

@@ -219,0 +230,0 @@ ##### minQueryLength (optional)

import React from 'react';
import { expect } from 'chai';
import { shallow, mount, render } from 'enzyme';
import { mount } from 'enzyme';
import { spy } from 'sinon';
import noop from 'lodash/noop';

@@ -31,2 +32,24 @@ import { WithContext as ReactTags } from '../lib/ReactTags';

});
it("invokes the onBlur event", () => {
const handleInputBlur = spy();
const $el = mount(mockItem());
// Won't be invoked as there's no `handleInputBlur` event yet.
$el.find('.ReactTags__tagInput input').simulate('blur');
expect(handleInputBlur.callCount).to.equal(0);
// Still won't be invoked, as the input value is empty.
$el.setProps({ handleInputBlur });
$el.find('.ReactTags__tagInput input').simulate('blur');
expect(handleInputBlur.callCount).to.equal(0);
// Voila...
$el.find('.ReactTags__tagInput input').get(0).value = 'Example';
$el.find('.ReactTags__tagInput input').simulate('blur');
expect(handleInputBlur.callCount).to.equal(1);
expect(handleInputBlur.calledWith('Example')).to.be.true;
});
});

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc