forked from erikras/redux-form-material-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix erikras#293 add lib/ dir to git.
- Loading branch information
Showing
17 changed files
with
916 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,5 @@ node_modules | |
coverage | ||
dist | ||
es | ||
lib | ||
npm-debug.log | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
|
||
var _Checkbox = require('@material-ui/core/Checkbox'); | ||
|
||
var _Checkbox2 = _interopRequireDefault(_Checkbox); | ||
|
||
var _createComponent = require('./createComponent'); | ||
|
||
var _createComponent2 = _interopRequireDefault(_createComponent); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
|
||
exports.default = (0, _createComponent2.default)(_Checkbox2.default, function (_ref) { | ||
var _ref$input = _ref.input, | ||
_onChange = _ref$input.onChange, | ||
value = _ref$input.value, | ||
inputProps = _objectWithoutProperties(_ref$input, ['onChange', 'value']), | ||
meta = _ref.meta, | ||
ignoredOnChange = _ref.onChange, | ||
defaultChecked = _ref.defaultChecked, | ||
props = _objectWithoutProperties(_ref, ['input', 'meta', 'onChange', 'defaultChecked']); | ||
|
||
return _extends({}, inputProps, props, { | ||
checked: value ? true : false, | ||
onChange: function onChange(event, isInputChecked) { | ||
_onChange(isInputChecked); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
|
||
var _RadioGroup = require('@material-ui/core/RadioGroup'); | ||
|
||
var _RadioGroup2 = _interopRequireDefault(_RadioGroup); | ||
|
||
var _createComponent = require('./createComponent'); | ||
|
||
var _createComponent2 = _interopRequireDefault(_createComponent); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
|
||
exports.default = (0, _createComponent2.default)(_RadioGroup2.default, function (_ref) { | ||
var _ref$input = _ref.input, | ||
_onChange = _ref$input.onChange, | ||
value = _ref$input.value, | ||
inputProps = _objectWithoutProperties(_ref$input, ['onChange', 'value']), | ||
meta = _ref.meta, | ||
onChangeFromField = _ref.onChange, | ||
props = _objectWithoutProperties(_ref, ['input', 'meta', 'onChange']); | ||
|
||
return _extends({}, inputProps, props, { | ||
value: value, | ||
onChange: function onChange(event, value) { | ||
_onChange(value); | ||
if (onChangeFromField) { | ||
onChangeFromField(value); | ||
} | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
|
||
var _Select = require('@material-ui/core/Select'); | ||
|
||
var _Select2 = _interopRequireDefault(_Select); | ||
|
||
var _createComponent = require('./createComponent'); | ||
|
||
var _createComponent2 = _interopRequireDefault(_createComponent); | ||
|
||
var _mapError = require('./mapError'); | ||
|
||
var _mapError2 = _interopRequireDefault(_mapError); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
|
||
exports.default = (0, _createComponent2.default)(_Select2.default, function (_ref) { | ||
var _ref$input = _ref.input, | ||
_onChange = _ref$input.onChange, | ||
value = _ref$input.value, | ||
_onBlur = _ref$input.onBlur, | ||
inputProps = _objectWithoutProperties(_ref$input, ['onChange', 'value', 'onBlur']), | ||
onChangeFromField = _ref.onChange, | ||
defaultValue = _ref.defaultValue, | ||
props = _objectWithoutProperties(_ref, ['input', 'onChange', 'defaultValue']); | ||
|
||
return _extends({}, (0, _mapError2.default)(_extends({}, props, { hasHelperText: false })), inputProps, { | ||
value: value, | ||
onChange: function onChange(event) { | ||
_onChange(event.target.value); | ||
if (onChangeFromField) { | ||
onChangeFromField(event.target.value); | ||
} | ||
}, | ||
onBlur: function onBlur() { | ||
return _onBlur(value); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
|
||
var _Switch = require('@material-ui/core/Switch'); | ||
|
||
var _Switch2 = _interopRequireDefault(_Switch); | ||
|
||
var _createComponent = require('./createComponent'); | ||
|
||
var _createComponent2 = _interopRequireDefault(_createComponent); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
|
||
exports.default = (0, _createComponent2.default)(_Switch2.default, function (_ref) { | ||
var _ref$input = _ref.input, | ||
onChange = _ref$input.onChange, | ||
value = _ref$input.value, | ||
inputProps = _objectWithoutProperties(_ref$input, ['onChange', 'value']), | ||
checked = _ref.checked, | ||
meta = _ref.meta, | ||
props = _objectWithoutProperties(_ref, ['input', 'checked', 'meta']); | ||
|
||
return _extends({}, inputProps, props, { | ||
onChange: onChange, | ||
checked: !!value | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
|
||
var _TextField = require('@material-ui/core/TextField'); | ||
|
||
var _TextField2 = _interopRequireDefault(_TextField); | ||
|
||
var _createComponent = require('./createComponent'); | ||
|
||
var _createComponent2 = _interopRequireDefault(_createComponent); | ||
|
||
var _mapError = require('./mapError'); | ||
|
||
var _mapError2 = _interopRequireDefault(_mapError); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
|
||
exports.default = (0, _createComponent2.default)(_TextField2.default, function (_ref) { | ||
var defaultValue = _ref.defaultValue, | ||
props = _objectWithoutProperties(_ref, ['defaultValue']); | ||
|
||
return _extends({}, (0, _mapError2.default)(props)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
'use strict'; | ||
|
||
var _expect = require('expect'); | ||
|
||
var _expect2 = _interopRequireDefault(_expect); | ||
|
||
var _expectJsx = require('expect-jsx'); | ||
|
||
var _expectJsx2 = _interopRequireDefault(_expectJsx); | ||
|
||
var _lodash = require('lodash.noop'); | ||
|
||
var _lodash2 = _interopRequireDefault(_lodash); | ||
|
||
var _Checkbox = require('@material-ui/core/Checkbox'); | ||
|
||
var _Checkbox2 = _interopRequireDefault(_Checkbox); | ||
|
||
var _react = require('react'); | ||
|
||
var _react2 = _interopRequireDefault(_react); | ||
|
||
var _Checkbox3 = require('../Checkbox'); | ||
|
||
var _Checkbox4 = _interopRequireDefault(_Checkbox3); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
_expect2.default.extend(_expectJsx2.default); | ||
|
||
describe('Checkbox', function () { | ||
it('has a display name', function () { | ||
(0, _expect2.default)(_Checkbox4.default.displayName).toBe('ReduxFormMaterialUIWithStyles'); | ||
}); | ||
|
||
it('renders an unchecked Checkbox', function () { | ||
(0, _expect2.default)(new _Checkbox4.default({ | ||
input: { | ||
name: 'myCheckbox', | ||
onChange: _lodash2.default | ||
} | ||
}).render()).toEqualJSX(_react2.default.createElement(_Checkbox2.default, { | ||
name: 'myCheckbox', | ||
checked: false, | ||
onChange: _lodash2.default, | ||
ref: function ref() {} | ||
})); | ||
}); | ||
|
||
it('renders a checked Checkbox', function () { | ||
(0, _expect2.default)(new _Checkbox4.default({ | ||
input: { | ||
name: 'myCheckbox', | ||
onChange: _lodash2.default, | ||
value: true | ||
} | ||
}).render()).toEqualJSX(_react2.default.createElement(_Checkbox2.default, { | ||
name: 'myCheckbox', | ||
checked: true, | ||
onChange: _lodash2.default, | ||
ref: function ref() {} | ||
})); | ||
}); | ||
|
||
it('should ignore defaultChecked', function () { | ||
(0, _expect2.default)(new _Checkbox4.default({ | ||
input: { | ||
name: 'myCheckbox', | ||
onChange: _lodash2.default | ||
}, | ||
defaultChecked: true | ||
}).render()).toEqualJSX(_react2.default.createElement(_Checkbox2.default, { name: 'myCheckbox', onChange: _lodash2.default, ref: function ref() {} })); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'use strict'; | ||
|
||
var _expect = require('expect'); | ||
|
||
var _expect2 = _interopRequireDefault(_expect); | ||
|
||
var _expectJsx = require('expect-jsx'); | ||
|
||
var _expectJsx2 = _interopRequireDefault(_expectJsx); | ||
|
||
var _RadioGroup = require('@material-ui/core/RadioGroup'); | ||
|
||
var _RadioGroup2 = _interopRequireDefault(_RadioGroup); | ||
|
||
var _react = require('react'); | ||
|
||
var _react2 = _interopRequireDefault(_react); | ||
|
||
var _lodash = require('lodash.noop'); | ||
|
||
var _lodash2 = _interopRequireDefault(_lodash); | ||
|
||
var _testUtils = require('react-dom/test-utils'); | ||
|
||
var _testUtils2 = _interopRequireDefault(_testUtils); | ||
|
||
var _RadioGroup3 = require('../RadioGroup'); | ||
|
||
var _RadioGroup4 = _interopRequireDefault(_RadioGroup3); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
_expect2.default.extend(_expectJsx2.default); | ||
|
||
describe('RadioGroup', function () { | ||
it('has a display name', function () { | ||
(0, _expect2.default)(_RadioGroup4.default.displayName).toBe('ReduxFormMaterialUIRadioGroup'); | ||
}); | ||
|
||
it('renders a RadioGroup', function () { | ||
(0, _expect2.default)(new _RadioGroup4.default({ | ||
input: { | ||
name: 'myRadio', | ||
value: 'Foo', | ||
onChange: { noop: _lodash2.default } | ||
} | ||
}).render()).toEqualJSX(_react2.default.createElement(_RadioGroup2.default, { name: 'myRadio', value: 'Foo', onChange: _lodash2.default, ref: function ref() {} })); | ||
}); | ||
|
||
it('provides getRenderedComponent', function () { | ||
var dom = _testUtils2.default.renderIntoDocument(_react2.default.createElement(_RadioGroup4.default, { | ||
input: { name: 'myRadio', value: 'Foo' } | ||
})); | ||
|
||
var element = _testUtils2.default.findRenderedComponentWithType(dom, _RadioGroup4.default); | ||
(0, _expect2.default)(element.getRenderedComponent).toBeA('function'); | ||
(0, _expect2.default)(element.getRenderedComponent()).toExist(); | ||
}); | ||
}); |
Oops, something went wrong.