@brightleaf/elements
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -13,2 +13,4 @@ "use strict"; | ||
function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
expect.extend({ | ||
@@ -36,2 +38,25 @@ toHaveClass: _jestDom.toHaveClass | ||
}); | ||
it('should render with has-background-primary when hasBackgroundPrimary set', function () { | ||
var _render3 = (0, _react2.render)(_react.default.createElement(_box.Box, { | ||
className: "boxed-in", | ||
hasBackgroundPrimary: true | ||
}, _react.default.createElement("div", null, "Trapped in a Box"))), | ||
container = _render3.container; | ||
expect(container.firstChild).toHaveClass('box'); | ||
expect(container.firstChild).toHaveClass('has-background-primary'); | ||
}); | ||
test.each([['has-background-primary', 'hasBackgroundPrimary'], ['has-background-success', 'hasBackgroundSuccess'], ['has-background-warning', 'hasBackgroundWarning'], ['has-background-danger', 'hasBackgroundDanger'], ['has-background-info', 'hasBackgroundInfo'], ['has-background-white', 'hasBackgroundWhite'], ['has-background-black', 'hasBackgroundBlack'], ['has-background-light', 'hasBackgroundLight'], ['has-background-dark', 'hasBackgroundDark'], ['has-background-link', 'hasBackgroundLink'], ['has-background-black-bis', 'hasBackgroundBlackBis'], ['has-background-black-ter', 'hasBackgroundBlackTer'], ['has-background-grey-darker', 'hasBackgroundGreyDarker'], ['has-background-grey-dark', 'hasBackgroundGreyDark'], ['has-background-grey', 'hasBackgroundGrey'], ['has-background-grey-light', 'hasBackgroundGreyLight'], ['has-background-grey-lighter', 'hasBackgroundGreyLighter'], ['has-background-white-ter', 'hasBackgroundWhiteTer'], ['has-background-white-bis', 'hasBackgroundWhiteBis']])('The background color class %i is added when %i is set)', function (className, propertyName) { | ||
var prop = {}; | ||
prop[propertyName] = true; | ||
var _render4 = (0, _react2.render)(_react.default.createElement(_box.Box, _extends({ | ||
className: "boxed-in" | ||
}, prop), _react.default.createElement("div", null, "Trapped in a Box"))), | ||
container = _render4.container; | ||
expect(container.firstChild).toHaveClass('box'); | ||
expect(container.firstChild).toHaveClass('boxed-in'); | ||
expect(container.firstChild).toHaveClass(className); | ||
}); | ||
}); |
@@ -12,10 +12,20 @@ "use strict"; | ||
var _base = require("../base"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
var Box = function Box(_ref) { | ||
var children = _ref.children, | ||
className = _ref.className; | ||
return _react.default.createElement("div", { | ||
className = _ref.className, | ||
props = _objectWithoutProperties(_ref, ["children", "className"]); | ||
return _react.default.createElement(_base.Base, _extends({ | ||
className: (0, _classnames.default)('box', className) | ||
}, children); | ||
}, props), children); | ||
}; | ||
@@ -25,3 +35,6 @@ | ||
Box.propTypes = {}; | ||
Box.defaultProps = { | ||
as: 'div' | ||
}; | ||
var _default = Box; | ||
exports.default = _default; |
{ | ||
"name": "@brightleaf/elements", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "React UI elements styled with Bulma CSS", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
359887
140
7751