reshow-build
Advanced tools
Comparing version 0.16.1 to 0.16.2
@@ -31,6 +31,11 @@ "use strict"; | ||
it("test build string", function () { | ||
var vdom = (0, _index["default"])("foo")(); | ||
var vdom = (0, _index["default"])("Foo Bar")(); | ||
var actual = (0, _reshowUnit.shallow)(vdom).html(); | ||
(0, _chai.expect)(actual).to.equal("<span>foo</span>"); | ||
(0, _chai.expect)(actual).to.equal("<span>Foo Bar</span>"); | ||
}); | ||
it("test build native html", function () { | ||
var vdom = (0, _index["default"])("a")(); | ||
var actual = (0, _reshowUnit.shallow)(vdom).html(); | ||
(0, _chai.expect)(actual).to.equal("<a></a>"); | ||
}); | ||
it("test function with error", function () { | ||
@@ -37,0 +42,0 @@ var run = function run() { |
@@ -53,8 +53,10 @@ "use strict"; | ||
return ( /*#__PURE__*/(0, _react.isValidElement)(component) ? _react.cloneElement : _react.createElement).apply(_reshowConstant.T_NULL, params); | ||
if (_reshowConstant.STRING === (0, _typeof2["default"])(component) && component !== component.replace(/[^a-z]/g, "")) { | ||
return buildReact( /*#__PURE__*/_react["default"].createElement("span", null, component), props, child); | ||
} else { | ||
return ( /*#__PURE__*/(0, _react.isValidElement)(component) ? _react.cloneElement : _react.createElement).apply(_reshowConstant.T_NULL, params); | ||
} | ||
}; | ||
var build = function build(component, componentOption) { | ||
var _span; | ||
return function (props, child) { | ||
@@ -74,6 +76,2 @@ if (!component) { | ||
} | ||
} else { | ||
if (_reshowConstant.STRING === (0, _typeof2["default"])(component)) { | ||
component = _span || (_span = /*#__PURE__*/_react["default"].createElement("span", null, component)); | ||
} | ||
} | ||
@@ -80,0 +78,0 @@ |
@@ -16,6 +16,11 @@ import _objectWithoutProperties from "reshow-runtime/es/helpers/objectWithoutProperties"; | ||
it("test build string", function () { | ||
var vdom = build("foo")(); | ||
var vdom = build("Foo Bar")(); | ||
var actual = shallow(vdom).html(); | ||
expect(actual).to.equal("<span>foo</span>"); | ||
expect(actual).to.equal("<span>Foo Bar</span>"); | ||
}); | ||
it("test build native html", function () { | ||
var vdom = build("a")(); | ||
var actual = shallow(vdom).html(); | ||
expect(actual).to.equal("<a></a>"); | ||
}); | ||
it("test function with error", function () { | ||
@@ -22,0 +27,0 @@ var run = function run() { |
@@ -39,8 +39,10 @@ import _typeof from "reshow-runtime/es/helpers/typeof"; | ||
return ( /*#__PURE__*/isValidElement(component) ? cloneElement : createElement).apply(T_NULL, params); | ||
if (STRING === _typeof(component) && component !== component.replace(/[^a-z]/g, "")) { | ||
return buildReact( /*#__PURE__*/React.createElement("span", null, component), props, child); | ||
} else { | ||
return ( /*#__PURE__*/isValidElement(component) ? cloneElement : createElement).apply(T_NULL, params); | ||
} | ||
}; | ||
var build = function build(component, componentOption) { | ||
var _span; | ||
return function (props, child) { | ||
@@ -60,6 +62,2 @@ if (!component) { | ||
} | ||
} else { | ||
if (STRING === _typeof(component)) { | ||
component = _span || (_span = /*#__PURE__*/React.createElement("span", null, component)); | ||
} | ||
} | ||
@@ -66,0 +64,0 @@ |
{ | ||
"name": "reshow-build", | ||
"version": "0.16.1", | ||
"version": "0.16.2", | ||
"description": "A simple util help u build or create component from react instance or function", | ||
@@ -5,0 +5,0 @@ "main": "./build/cjs/src/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
37787
890