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

react-input-message

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-input-message - npm Package Compare versions

Comparing version 0.5.4 to 0.5.5

2

lib/connectToMessageContainer.js

@@ -55,3 +55,3 @@ var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };

MessageListener.prototype._getValidationState = function _getValidationState() {
var messages = this.getContext().messages(this.props.for || this.props.group);
var messages = this.getContext().messages(this.props.for, this.props.group);

@@ -58,0 +58,0 @@ return {

@@ -19,2 +19,6 @@ "use strict";

var has = function (obj, key) {
return obj && ({}).hasOwnProperty.call(obj, key);
};
module.exports = (function (_React$Component) {

@@ -28,4 +32,4 @@ function ValidationContainer(props, context) {

this._groups = window.Map ? new Map() : Object.create(null);
this._fields = window.Map ? new Map() : Object.create(null);
this._groups = Object.create(null);
this._fields = Object.create(null);

@@ -115,3 +119,3 @@ this.state = {

if (!(!group || !group.length)) [].concat(group).forEach(function (grp) {
if (!_this._groups.hasOwnProperty(grp)) return _this._groups[grp] = [name];
if (!has(_this._groups, grp)) return _this._groups[grp] = [name];

@@ -135,3 +139,3 @@ if (_this._groups[grp].indexOf(name) === -1) _this._groups[grp].push(name);

for (var key in this._groups) if (this._groups.hasOwnProperty(key)) remove(name, key);
for (var key in this._groups) if (has(this._groups, key)) remove(name, key);

@@ -163,7 +167,11 @@ this._fields[name] = false;

ValidationContainer.prototype._messages = function _messages(names) {
ValidationContainer.prototype._messages = function _messages(names, groups) {
var _this = this;
if (!names || !names.length) return _extends({}, this.props.messages);
if (!names || !names.length) {
if (!groups || !groups.length) return _extends({}, this.props.messages);
names = this.fields(groups);
}
return [].concat(names).reduce(function (o, name) {

@@ -170,0 +178,0 @@ if (_this.props.messages[name]) o[name] = _this.props.messages[name];

{
"name": "react-input-message",
"description": "unopinionated form input annotation",
"version": "0.5.4",
"version": "0.5.5",
"repository": {

@@ -6,0 +6,0 @@ "url": "git://github.com/jquense/react-input-message.git"

@@ -8,9 +8,51 @@ var React = require('react/addons')

var findTag = utils.findRenderedDOMComponentWithTag
, findClass = utils.findRenderedDOMComponentWithClass
, findAllTag = utils.scryRenderedDOMComponentsWithTag
, findAllClass = utils.scryRenderedDOMComponentsWithClass
, findType = utils.findRenderedComponentWithType
, findAllType = utils.scryRenderedComponentsWithType
, trigger = utils.Simulate
describe('connect to container HoC', ()=>{
describe('Message', ()=>{
it('should use the prop Component', function(){
var inst = utils.renderIntoDocument(
<MessageContainer messages={{ fieldA: 'hi', fieldB: 'good day' }} >
<div>
<Message for='fieldA' className='msg' component='p'/>
</div>
</MessageContainer>)
var messages = findTag(inst, 'p');
})
it('should allow empty `for`', function(){
var inst = utils.renderIntoDocument(
<MessageContainer messages={{ fieldA: 'hi', fieldB: 'good day' }} >
<div>
<Message className='msg'/>
</div>
</MessageContainer>)
var messages = findType(inst, Message._Message);
messages.props.messages.should.eql({ fieldA: 'hi', fieldB: 'good day' })
})
it('should allow group summaries', function(){
var inst = utils.renderIntoDocument(
<MessageContainer messages={{ fieldA: 'hi', fieldB: 'good day' }} >
<div>
<MessageTrigger for='fieldA' group='test'>
<input/>
</MessageTrigger>
<Message group='test' className='msg'/>
</div>
</MessageContainer>)
var messages = findType(inst, Message._Message);
messages.props.messages.should.eql({ fieldA: 'hi' })
})
})

@@ -9,3 +9,2 @@ 'use strict';

var findTag = utils.findRenderedDOMComponentWithTag

@@ -12,0 +11,0 @@ , findClass = utils.findRenderedDOMComponentWithClass

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