@shopgate/pwa-ui-shared 6.20.0-beta.1 → 6.20.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AccordionContainer/index.js +7 -4
- package/AccordionContainer/spec.js +2 -2
- package/ActionButton/index.js +7 -7
- package/ActionButton/spec.js +1 -1
- package/AddToCartButton/index.js +7 -6
- package/AddToCartButton/mock.js +3 -3
- package/AddToCartButton/spec.js +1 -1
- package/Availability/index.js +1 -1
- package/Availability/spec.js +1 -1
- package/Button/index.js +7 -7
- package/Button/spec.js +1 -1
- package/ButtonLink/index.js +3 -3
- package/ButtonLink/spec.js +1 -1
- package/Card/index.js +1 -1
- package/CardList/components/Item/index.js +1 -1
- package/CardList/index.js +3 -3
- package/CartTotalLine/components/Amount/index.js +1 -1
- package/CartTotalLine/components/Hint/index.js +1 -1
- package/CartTotalLine/components/Label/index.js +1 -1
- package/CartTotalLine/index.js +1 -1
- package/Checkbox/index.js +2 -2
- package/Chip/index.js +1 -1
- package/Chip/spec.js +1 -1
- package/ClientInformation/index.js +5 -5
- package/ClientInformation/spec.js +1 -1
- package/ContextMenu/components/Item/index.js +2 -2
- package/ContextMenu/components/Item/style.js +5 -1
- package/ContextMenu/components/Position/index.js +4 -4
- package/ContextMenu/index.js +8 -8
- package/ContextMenu/spec.js +3 -3
- package/ContextMenu/style.js +1 -1
- package/Dialog/components/PipelineErrorDialog/index.js +9 -9
- package/Dialog/components/PipelineErrorDialog/spec.js +2 -2
- package/Dialog/components/TextMessageDialog/index.js +1 -1
- package/Dialog/components/TextMessageDialog/spec.js +1 -1
- package/Dialog/components/VariantSelectModal/index.js +1 -1
- package/Dialog/components/VariantSelectModal/spec.js +2 -2
- package/Dialog/constants.js +1 -1
- package/Dialog/index.js +4 -4
- package/Dialog/spec.js +2 -2
- package/DiscountBadge/index.js +1 -1
- package/DiscountBadge/spec.js +1 -1
- package/FavoritesButton/connector.js +2 -2
- package/FavoritesButton/index.js +8 -8
- package/FavoritesButton/spec.js +1 -1
- package/Footer/index.js +9 -9
- package/Footer/index.spec.js +4 -4
- package/Form/Builder/builders/buildCountryList.js +1 -1
- package/Form/Builder/builders/buildFormDefaults.js +1 -1
- package/Form/Builder/builders/buildFormElements.js +2 -2
- package/Form/Builder/builders/buildFormElements.spec.js +1 -1
- package/Form/Builder/builders/buildProvinceList.js +1 -1
- package/Form/Builder/classes/ActionListener/index.js +3 -3
- package/Form/Builder/components/CheckboxElement.js +3 -3
- package/Form/Builder/components/CountryElement.js +3 -3
- package/Form/Builder/components/ProvinceElement.js +3 -3
- package/Form/Builder/components/RadioElement.js +3 -3
- package/Form/Builder/components/SelectElement.js +3 -3
- package/Form/Builder/components/TextElement.js +3 -3
- package/Form/Builder/index.js +8 -8
- package/Form/Builder/spec.js +3 -3
- package/Form/Checkbox/index.js +3 -3
- package/Form/Password/index.js +5 -5
- package/Form/Password/spec.js +1 -1
- package/Form/RadioGroup/components/Item/index.js +3 -3
- package/Form/RadioGroup/index.js +7 -7
- package/Form/RadioGroup/spec.js +2 -2
- package/Form/Select/index.js +5 -5
- package/Form/Select/spec.js +1 -1
- package/Form/TextField/index.js +5 -5
- package/Form/TextField/spec.js +1 -1
- package/Form/index.js +8 -8
- package/FormElement/components/ErrorText/index.js +1 -1
- package/FormElement/components/Label/index.js +1 -1
- package/FormElement/components/Placeholder/index.js +1 -1
- package/FormElement/components/Underline/index.js +1 -1
- package/FormElement/index.js +6 -6
- package/FormElement/spec.js +1 -1
- package/Glow/index.js +6 -6
- package/Glow/spec.js +1 -1
- package/IndicatorCircle/index.js +1 -1
- package/IndicatorCircle/spec.js +1 -1
- package/LoadingIndicator/index.js +1 -1
- package/Manufacturer/index.js +1 -1
- package/MessageBar/index.js +1 -1
- package/MessageBar/spec.js +1 -1
- package/NoResults/components/Icon/index.js +1 -1
- package/NoResults/index.js +1 -1
- package/Placeholder/index.js +3 -3
- package/PlaceholderLabel/index.js +1 -1
- package/PlaceholderLabel/spec.js +1 -1
- package/PlaceholderParagraph/index.js +1 -1
- package/PlaceholderParagraph/spec.js +1 -1
- package/Price/index.js +1 -1
- package/PriceInfo/index.js +1 -1
- package/PriceStriked/index.js +6 -6
- package/ProductProperties/index.js +1 -1
- package/ProductProperties/index.spec.js +1 -1
- package/ProgressBar/index.js +4 -4
- package/ProgressBar/spec.js +1 -1
- package/RadioButton/index.js +1 -1
- package/RadioButton/spec.js +1 -1
- package/RatingNumber/index.js +1 -1
- package/RatingNumber/index.spec.js +2 -2
- package/RatingStars/index.js +5 -5
- package/RatingStars/spec.js +2 -2
- package/Ripple/components/RippleAnimation/index.js +3 -3
- package/Ripple/index.js +16 -16
- package/RippleButton/index.js +7 -7
- package/RippleButton/spec.js +1 -1
- package/ScannerOverlay/components/CameraOverlay/index.js +1 -1
- package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +1 -1
- package/ScannerOverlay/components/ScannerBar/components/ScannerInstructions/index.js +1 -1
- package/ScannerOverlay/components/ScannerBar/index.js +1 -1
- package/ScannerOverlay/index.js +7 -7
- package/ScannerOverlay/index.spec.js +1 -1
- package/Sheet/components/Header/components/SearchBar/index.js +2 -2
- package/Sheet/components/Header/components/SearchBar/spec.js +1 -1
- package/Sheet/components/Header/index.js +4 -4
- package/Sheet/components/Header/spec.js +1 -1
- package/Sheet/index.js +10 -10
- package/Sheet/spec.js +2 -2
- package/TaxDisclaimer/index.js +1 -1
- package/TaxDisclaimer/spec.js +2 -2
- package/TextField/components/ErrorText/index.js +1 -1
- package/TextField/components/FormElement/index.js +1 -1
- package/TextField/components/Hint/index.js +1 -1
- package/TextField/components/Label/index.js +2 -2
- package/TextField/components/Underline/index.js +1 -1
- package/TextField/index.js +8 -8
- package/TextField/spec.js +2 -2
- package/ToggleIcon/index.js +5 -5
- package/ToggleIcon/spec.js +1 -1
- package/icons/AccountBoxIcon.js +1 -1
- package/icons/AddMoreIcon.js +1 -1
- package/icons/ArrowDropIcon.js +1 -1
- package/icons/ArrowIcon.js +2 -2
- package/icons/BarcodeScannerIcon.js +1 -1
- package/icons/BoxIcon.js +1 -1
- package/icons/BrowseIcon.js +1 -1
- package/icons/BurgerIcon.js +1 -1
- package/icons/CartCouponIcon.js +1 -1
- package/icons/CartIcon.js +1 -1
- package/icons/CartPlusIcon.js +1 -1
- package/icons/CheckIcon.js +1 -1
- package/icons/CheckedIcon.js +1 -1
- package/icons/ChevronIcon.js +1 -1
- package/icons/CreditCardIcon.js +1 -1
- package/icons/CrossIcon.js +1 -1
- package/icons/DescriptionIcon.js +1 -1
- package/icons/FilterIcon.js +1 -1
- package/icons/FlashDisabledIcon.js +1 -1
- package/icons/FlashEnabledIcon.js +1 -1
- package/icons/GridIcon.js +1 -1
- package/icons/HeartIcon.js +1 -1
- package/icons/HeartOutlineIcon.js +1 -1
- package/icons/HomeIcon.js +1 -1
- package/icons/InfoIcon.js +1 -1
- package/icons/InfoOutlineIcon.js +1 -1
- package/icons/ListIcon.js +1 -1
- package/icons/LocalShippingIcon.js +1 -1
- package/icons/LockIcon.js +1 -1
- package/icons/LogoutIcon.js +1 -1
- package/icons/MagnifierIcon.js +1 -1
- package/icons/MoreIcon.js +1 -1
- package/icons/MoreVertIcon.js +1 -1
- package/icons/PlaceholderIcon.js +1 -1
- package/icons/RadioCheckedIcon.js +1 -1
- package/icons/RadioUncheckedIcon.js +1 -1
- package/icons/SecurityIcon.js +1 -1
- package/icons/ShoppingCartIcon.js +1 -1
- package/icons/SortIcon.js +1 -1
- package/icons/StarHalfIcon.js +1 -1
- package/icons/StarIcon.js +1 -1
- package/icons/StarOutlineIcon.js +1 -1
- package/icons/TickIcon.js +1 -1
- package/icons/TrashIcon.js +1 -1
- package/icons/UncheckedIcon.js +1 -1
- package/icons/ViewListIcon.js +1 -1
- package/icons/VisibilityIcon.js +1 -1
- package/icons/VisibilityOffIcon.js +1 -1
- package/package.json +5 -5
- package/Dialog/components/HtmlContentDialog/index.js +0 -6
- package/Dialog/components/HtmlContentDialog/spec.js +0 -1
package/Form/Select/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function _typeof(obj){
|
|
1
|
+
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import FormElement from"../../FormElement";import styles from"./style";/**
|
|
2
2
|
* A component that provides a styled select for user input in material design.
|
|
3
|
-
*/var Select=/*#__PURE__*/function(_Component){_inherits(Select,_Component);/**
|
|
3
|
+
*/var Select=/*#__PURE__*/function(_Component){_inherits(Select,_Component);var _super=_createSuper(Select);/**
|
|
4
4
|
* Creates a new text field component.
|
|
5
5
|
* @param {Object} props The component properties.
|
|
6
|
-
*/function Select(props){var _this;_classCallCheck(this,Select);_this=
|
|
6
|
+
*/function Select(props){var _this;_classCallCheck(this,Select);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"handleChange",function(_ref){var target=_ref.target;if(!_this.props.isControlled){_this.setState({value:target.value});}_this.props.onChange(target.value);});_defineProperty(_assertThisInitialized(_this),"handleFocusChange",function(isFocused){_this.setState({isFocused:isFocused});});_this.state={value:props.value,isFocused:false};return _this;}/**
|
|
7
7
|
* Update state with new props.
|
|
8
8
|
* @param {Object} nextProps The new props.
|
|
9
9
|
*/_createClass(Select,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){this.setState({value:nextProps.value});}/**
|
|
10
10
|
* @param {string} value The entered text.
|
|
11
|
-
*/},{key:"render"
|
|
11
|
+
*/},{key:"render",value:/**
|
|
12
12
|
* @return {JSX}
|
|
13
|
-
*/
|
|
13
|
+
*/function render(){var _this2=this;var _this$props=this.props,name=_this$props.name,options=_this$props.options,translateErrorText=_this$props.translateErrorText;return/*#__PURE__*/React.createElement(FormElement,{className:"".concat(this.props.className," ui-shared__form__select"),placeholder:this.props.placeholder,htmlFor:name,label:this.props.label,errorText:this.props.errorText,translateErrorText:translateErrorText,isFocused:this.state.isFocused,hasValue:!!this.state.value},/*#__PURE__*/React.createElement("select",{id:this.props.name,name:this.props.name,onChange:this.handleChange,onFocus:function onFocus(){return _this2.handleFocusChange(true);},onBlur:function onBlur(){return _this2.handleFocusChange(false);},value:this.state.value,className:classNames(styles.select,'select')},Object.keys(options).map(function(key){return/*#__PURE__*/React.createElement("option",{className:"option",value:key,key:"".concat(name,"_").concat(key)},options[key]);})));}}]);return Select;}(Component);_defineProperty(Select,"defaultProps",{className:'',errorText:'',isControlled:false,placeholder:'',label:'',onChange:function onChange(){},options:{},translateErrorText:true,value:''});export default Select;
|
package/Form/Select/spec.js
CHANGED
|
@@ -2,4 +2,4 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
2
2
|
var tests={'should render select with no options':{},// eslint-disable-next-line extra-rules/no-single-line-objects
|
|
3
3
|
'should render select with 2 options':{options:{DE:'Germany',US:'United states'}},// eslint-disable-next-line extra-rules/no-single-line-objects
|
|
4
4
|
'should render select with 1 selected option':{options:{DE:'Germany',US:'United states'},value:'DE'}};Object.keys(tests).forEach(function(test){it(test,function(){var testFixtures=tests[test];// eslint-disable-next-line extra-rules/no-single-line-objects
|
|
5
|
-
var wrapper=mount(React.createElement(Select,_extends({},inputProps,
|
|
5
|
+
var wrapper=mount(/*#__PURE__*/React.createElement(Select,_extends({},inputProps,testFixtures)));expect(wrapper).toMatchSnapshot();});});});
|
package/Form/TextField/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
function _typeof(obj){
|
|
1
|
+
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}var _excluded=["className","placeholder","label","errorText","leftElement","rightElement","hasUnderline"];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;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import Input from'@shopgate/pwa-common/components/Input';import Grid from'@shopgate/pwa-common/components/Grid';import FormElement from'@shopgate/pwa-ui-shared/FormElement';import style from"./style";/**
|
|
2
2
|
* No operational
|
|
3
3
|
*/var noop=function noop(){};/**
|
|
4
4
|
* TextField component
|
|
5
|
-
*/var TextField=/*#__PURE__*/function(_Component){_inherits(TextField,_Component);/**
|
|
5
|
+
*/var TextField=/*#__PURE__*/function(_Component){_inherits(TextField,_Component);var _super=_createSuper(TextField);/**
|
|
6
6
|
* Creates a new text field component.
|
|
7
7
|
* @param {Object} props The component properties.
|
|
8
|
-
*/function TextField(props){var _this;_classCallCheck(this,TextField);_this=
|
|
8
|
+
*/function TextField(props){var _this;_classCallCheck(this,TextField);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"handleFocusChange",function(isFocused){_this.setState({isFocused:isFocused});});_this.state={isFocused:false};return _this;}/**
|
|
9
9
|
* Internal focus event handler.
|
|
10
10
|
* @param {boolean} isFocused Whether the input component is focused.
|
|
11
|
-
*/_createClass(TextField,[{key:"render"
|
|
11
|
+
*/_createClass(TextField,[{key:"render",value:/**
|
|
12
12
|
* Renders the text field.
|
|
13
13
|
* @return {JSX}
|
|
14
|
-
*/
|
|
14
|
+
*/function render(){var _this$props=this.props,className=_this$props.className,placeholder=_this$props.placeholder,label=_this$props.label,errorText=_this$props.errorText,leftElement=_this$props.leftElement,rightElement=_this$props.rightElement,hasUnderline=_this$props.hasUnderline,props=_objectWithoutProperties(_this$props,_excluded);return/*#__PURE__*/React.createElement(FormElement,{className:"".concat(className," ui-shared__form__text-field"),htmlFor:props.name,placeholder:placeholder,label:label,errorText:errorText,hasUnderline:hasUnderline,hasValue:!!props.value,isFocused:this.state.isFocused},/*#__PURE__*/React.createElement(Grid,null,leftElement&&/*#__PURE__*/React.createElement(Grid.Item,{grow:0,className:style.element},leftElement),/*#__PURE__*/React.createElement(Grid.Item,{grow:1,className:style.container},/*#__PURE__*/React.createElement(Input,_extends({},props,{onFocusChange:this.handleFocusChange,className:style[props.multiLine?'multiLine':'input'],validateOnBlur:true}))),rightElement&&/*#__PURE__*/React.createElement(Grid.Item,{grow:0,className:style.element},rightElement)));}}]);return TextField;}(Component);_defineProperty(TextField,"defaultProps",{attributes:null,className:'',errorText:'',hasUnderline:true,label:'',leftElement:null,onChange:noop,placeholder:'',multiLine:false,rightElement:null,value:'',type:'text'});export default TextField;
|
package/Form/TextField/spec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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);}import React from'react';import{mount}from'enzyme';import TextField from"./index";var inputProps={name:'test-input'};describe('<TextField>',function(){it('should render a simple text field',function(){var wrapper=mount(React.createElement(TextField,inputProps));expect(wrapper).toMatchSnapshot();expect(wrapper.find('input').length).toBe(1);});it('should render the text field as password',function(){var wrapper=mount(React.createElement(TextField,_extends({},inputProps,{password:true})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('input[type="password"]').length).toBe(1);});it('should render the text field with a default value',function(){var wrapper=mount(React.createElement(TextField,_extends({},inputProps,{value:"FooBar"})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('input[value="FooBar"]').length).toBe(1);});it('should trigger the onChange callback',function(){var onChangeMock=jest.fn();var wrapper=mount(React.createElement(TextField,_extends({},inputProps,{onChange:onChangeMock})));wrapper.find('input').simulate('change',{target:{value:'a'}});expect(wrapper).toMatchSnapshot();expect(onChangeMock.mock.calls.length).toBe(2);});it('should receive the correct value while typing',function(){var wrapper=mount(React.createElement(TextField,inputProps));var input=wrapper.find('input');input.simulate('change',{target:{value:'foobar'}});expect(wrapper).toMatchSnapshot();expect(input.instance().value).toBe('foobar');});it('should sanitize the input',function(){var wrapper=mount(React.createElement(TextField,_extends({},inputProps,{onSanitize:function onSanitize(value){return value.toUpperCase();}})));var input=wrapper.find('input');input.simulate('change',{target:{value:'foobar'}});expect(wrapper).toMatchSnapshot();expect(input.instance().value).toBe('FOOBAR');});it('should trigger the validation callback',function(){var onValidateMock=jest.fn();var wrapper=mount(React.createElement(TextField,_extends({},inputProps,{onValidate:onValidateMock})));expect(wrapper).toMatchSnapshot();expect(onValidateMock).toHaveBeenCalled();});it('should focus the input',function(){var onFocusMock=jest.fn();var wrapper=mount(React.createElement(TextField,_extends({},inputProps,{onFocusChange:onFocusMock})));var input=wrapper.find('SimpleInput');expect(wrapper).toMatchSnapshot();expect(input.instance().isFocused).toBe(false);input.simulate('focus');expect(input.instance().isFocused).toBe(true);input.simulate('blur');expect(input.instance().isFocused).toBe(false);});it('should show the error message',function(){var errorText='This is an error here';var wrapper=mount(React.createElement(TextField,_extends({},inputProps,{errorText:errorText})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('ErrorText').find('Translate').at(0).props().string).toEqual(errorText);});it('should show the label',function(){var label='This is the label';var wrapper=mount(React.createElement(TextField,_extends({},inputProps,{label:label})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('Label').find('Translate').props().string).toEqual(label);});it('should show the placeholder text',function(){var placeholder='This is the placeholder text';var wrapper=mount(React.createElement(TextField,_extends({},inputProps,{placeholder:placeholder})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('Placeholder').find('Translate').at(0).props().string).toEqual(placeholder);});});
|
|
1
|
+
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);}import React from'react';import{mount}from'enzyme';import TextField from"./index";var inputProps={name:'test-input'};describe('<TextField>',function(){it('should render a simple text field',function(){var wrapper=mount(/*#__PURE__*/React.createElement(TextField,inputProps));expect(wrapper).toMatchSnapshot();expect(wrapper.find('input').length).toBe(1);});it('should render the text field as password',function(){var wrapper=mount(/*#__PURE__*/React.createElement(TextField,_extends({},inputProps,{password:true})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('input[type="password"]').length).toBe(1);});it('should render the text field with a default value',function(){var wrapper=mount(/*#__PURE__*/React.createElement(TextField,_extends({},inputProps,{value:"FooBar"})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('input[value="FooBar"]').length).toBe(1);});it('should trigger the onChange callback',function(){var onChangeMock=jest.fn();var wrapper=mount(/*#__PURE__*/React.createElement(TextField,_extends({},inputProps,{onChange:onChangeMock})));wrapper.find('input').simulate('change',{target:{value:'a'}});expect(wrapper).toMatchSnapshot();expect(onChangeMock.mock.calls.length).toBe(2);});it('should receive the correct value while typing',function(){var wrapper=mount(/*#__PURE__*/React.createElement(TextField,inputProps));var input=wrapper.find('input');input.simulate('change',{target:{value:'foobar'}});expect(wrapper).toMatchSnapshot();expect(input.instance().value).toBe('foobar');});it('should sanitize the input',function(){var wrapper=mount(/*#__PURE__*/React.createElement(TextField,_extends({},inputProps,{onSanitize:function onSanitize(value){return value.toUpperCase();}})));var input=wrapper.find('input');input.simulate('change',{target:{value:'foobar'}});expect(wrapper).toMatchSnapshot();expect(input.instance().value).toBe('FOOBAR');});it('should trigger the validation callback',function(){var onValidateMock=jest.fn();var wrapper=mount(/*#__PURE__*/React.createElement(TextField,_extends({},inputProps,{onValidate:onValidateMock})));expect(wrapper).toMatchSnapshot();expect(onValidateMock).toHaveBeenCalled();});it('should focus the input',function(){var onFocusMock=jest.fn();var wrapper=mount(/*#__PURE__*/React.createElement(TextField,_extends({},inputProps,{onFocusChange:onFocusMock})));var input=wrapper.find('SimpleInput');expect(wrapper).toMatchSnapshot();expect(input.instance().isFocused).toBe(false);input.simulate('focus');expect(input.instance().isFocused).toBe(true);input.simulate('blur');expect(input.instance().isFocused).toBe(false);});it('should show the error message',function(){var errorText='This is an error here';var wrapper=mount(/*#__PURE__*/React.createElement(TextField,_extends({},inputProps,{errorText:errorText})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('ErrorText').find('Translate').at(0).props().string).toEqual(errorText);});it('should show the label',function(){var label='This is the label';var wrapper=mount(/*#__PURE__*/React.createElement(TextField,_extends({},inputProps,{label:label})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('Label').find('Translate').props().string).toEqual(label);});it('should show the placeholder text',function(){var placeholder='This is the placeholder text';var wrapper=mount(/*#__PURE__*/React.createElement(TextField,_extends({},inputProps,{placeholder:placeholder})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('Placeholder').find('Translate').at(0).props().string).toEqual(placeholder);});});
|
package/Form/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
function _typeof(obj){
|
|
1
|
+
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';/**
|
|
2
2
|
* Form component that handles keyboard submit, next buttons, ...
|
|
3
3
|
* @deprecated Use `@shopgate/engage/components/Form` instead.
|
|
4
|
-
*/var Form=/*#__PURE__*/function(_PureComponent){_inherits(Form,_PureComponent);
|
|
5
|
-
|
|
4
|
+
*/var Form=/*#__PURE__*/function(_PureComponent){_inherits(Form,_PureComponent);var _super=_createSuper(Form);/**
|
|
5
|
+
* Initializes the form component.
|
|
6
|
+
* @param {Object} props The components props.
|
|
7
|
+
*/function Form(props){var _this;_classCallCheck(this,Form);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"handleSubmit",function(event){event.preventDefault();var inputFocused=[].concat(_this.formElement.current.querySelectorAll('input')).some(function(input){return document.activeElement===input;});if(inputFocused){document.activeElement.blur();}_this.props.onSubmit();});_defineProperty(_assertThisInitialized(_this),"handleKeyPress",function(event){// Enter key and on iOS also the "Done" button.
|
|
8
|
+
if(event.which===13){_this.handleSubmit(event);}});_this.formElement=/*#__PURE__*/React.createRef();return _this;}/**
|
|
6
9
|
* Handles the form submit.
|
|
7
10
|
* @param {Object} event The event that caused the submit.
|
|
8
|
-
*/_createClass(Form,[{key:"render"
|
|
11
|
+
*/_createClass(Form,[{key:"render",value:/**
|
|
9
12
|
* Renders the component.
|
|
10
13
|
* @returns {JSX}
|
|
11
|
-
*/
|
|
12
|
-
* Initializes the form component.
|
|
13
|
-
* @param {Object} props The components props.
|
|
14
|
-
*/});export default Form;
|
|
14
|
+
*/function render(){/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */return/*#__PURE__*/React.createElement("form",{action:"#",onSubmit:this.handleSubmit,onKeyPress:this.handleKeyPress,ref:this.formElement,className:"ui-shared__form"},this.props.children);/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */}}]);return Form;}(PureComponent);_defineProperty(Form,"defaultProps",{onSubmit:function onSubmit(){}});export default Form;
|
|
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import classNames fro
|
|
|
2
2
|
* Error message component.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var ErrorText=function ErrorText(_ref){var className=_ref.className,errorText=_ref.errorText,translate=_ref.translate;return
|
|
5
|
+
*/var ErrorText=function ErrorText(_ref){var className=_ref.className,errorText=_ref.errorText,translate=_ref.translate;return/*#__PURE__*/React.createElement("div",{className:classNames(className,styles,'errorText')},translate&&/*#__PURE__*/React.createElement(I18n.Text,{string:errorText}),!translate&&errorText);};ErrorText.defaultProps={className:null,errorText:null,translate:true};export default ErrorText;
|
|
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import classNames fro
|
|
|
2
2
|
* Renders the label element.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @return {JSX}
|
|
5
|
-
*/var Label=function Label(props){var labelStyles=styles.labelStyles(props.isFocused,props.isFloating,props.hasErrorMessage);return(/* eslint-disable-next-line jsx-a11y/label-has-associated-control */React.createElement("label",{htmlFor:props.htmlFor,className:classNames(labelStyles,'label')}
|
|
5
|
+
*/var Label=function Label(props){var labelStyles=styles.labelStyles(props.isFocused,props.isFloating,props.hasErrorMessage);return/*#__PURE__*/ (/* eslint-disable-next-line jsx-a11y/label-has-associated-control */React.createElement("label",{htmlFor:props.htmlFor,className:classNames(labelStyles,'label')},/*#__PURE__*/React.createElement(I18n.Text,{string:props.label})));};Label.defaultProps={htmlFor:'',isFocused:false,isFloating:false,hasErrorMessage:false,label:''};export default Label;
|
|
@@ -3,4 +3,4 @@ import React from'react';import PropTypes from'prop-types';import classNames fro
|
|
|
3
3
|
* @param {string} placeholder The placeholder text.
|
|
4
4
|
* @param {boolean} visible Sets the placeholder visibility.
|
|
5
5
|
* @return {JSX}
|
|
6
|
-
*/var Placeholder=function Placeholder(_ref){var placeholder=_ref.placeholder,visible=_ref.visible,ariaHidden=_ref['aria-hidden'];return
|
|
6
|
+
*/var Placeholder=function Placeholder(_ref){var placeholder=_ref.placeholder,visible=_ref.visible,ariaHidden=_ref['aria-hidden'];return/*#__PURE__*/React.createElement("div",{className:classNames(styles.placeholderStyles(visible),'placeholder'),"aria-hidden":ariaHidden},/*#__PURE__*/React.createElement(I18n.Text,{string:placeholder}));};Placeholder.defaultProps={'aria-hidden':null,placeholder:'',visible:false};export default Placeholder;
|
|
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import classNames fro
|
|
|
2
2
|
* Renders the label element.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @return {JSX}
|
|
5
|
-
*/var Underline=function Underline(props){return
|
|
5
|
+
*/var Underline=function Underline(props){return/*#__PURE__*/React.createElement("div",{className:classNames(styles.underlineWrapper,'underline')},/*#__PURE__*/React.createElement("div",{className:styles.underline,style:styles.underlineStyle(props.isFocused,props.hasErrorMessage)}));};Underline.defaultProps={isFocused:false,hasErrorMessage:false};export default Underline;
|
package/FormElement/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function _typeof(obj){
|
|
1
|
+
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import Label from"./components/Label";import Underline from"./components/Underline";import ErrorText from"./components/ErrorText";import Placeholder from"./components/Placeholder";import style from"./style";/**
|
|
2
2
|
* A component that provides a styled form element in material design.
|
|
3
|
-
*/var FormElement=/*#__PURE__*/function(_Component){_inherits(FormElement,_Component);function FormElement(){_classCallCheck(this,FormElement);return
|
|
4
|
-
* @return {JSX}
|
|
5
|
-
*/value:function render(){var _this$props=this.props,isFocused=_this$props.isFocused,errorText=_this$props.errorText,translateErrorText=_this$props.translateErrorText,placeholder=_this$props.placeholder,hasPlaceholder=_this$props.hasPlaceholder,htmlFor=_this$props.htmlFor,label=_this$props.label,className=_this$props.className;return React.createElement("div",{className:classNames(style.formElement,className,'formElement','ui-shared__form-element')},hasPlaceholder&&React.createElement(Placeholder,{visible:this.isPlaceholderVisible,placeholder:placeholder||label,"aria-hidden":true}),React.createElement(Label,{htmlFor:htmlFor,label:label,isFocused:isFocused,isFloating:this.isLabelFloating,hasErrorMessage:this.hasErrorMessage}),this.props.children,this.props.hasUnderline&&React.createElement(Underline,{isFocused:isFocused,hasErrorMessage:this.hasErrorMessage}),React.createElement(ErrorText,{errorText:errorText,translate:translateErrorText}));}},{key:"isLabelFloating",/**
|
|
3
|
+
*/var FormElement=/*#__PURE__*/function(_Component){_inherits(FormElement,_Component);var _super=_createSuper(FormElement);function FormElement(){_classCallCheck(this,FormElement);return _super.apply(this,arguments);}_createClass(FormElement,[{key:"isLabelFloating",get:/**
|
|
6
4
|
* @returns {boolean} Whether the label is currently floating.
|
|
7
|
-
*/
|
|
5
|
+
*/function get(){return this.props.isFocused||this.props.hasValue;}/**
|
|
8
6
|
* @returns {boolean} Whether the hint text is currently visible.
|
|
9
7
|
*/},{key:"isPlaceholderVisible",get:function get(){return!this.props.isFocused&&!this.props.hasValue;}/**
|
|
10
8
|
* @returns {boolean} Whether the hint text is currently visible.
|
|
11
|
-
*/},{key:"hasErrorMessage",get:function get(){return!!this.props.errorText;}
|
|
9
|
+
*/},{key:"hasErrorMessage",get:function get(){return!!this.props.errorText;}/**
|
|
10
|
+
* @return {JSX}
|
|
11
|
+
*/},{key:"render",value:function render(){var _this$props=this.props,isFocused=_this$props.isFocused,errorText=_this$props.errorText,translateErrorText=_this$props.translateErrorText,placeholder=_this$props.placeholder,hasPlaceholder=_this$props.hasPlaceholder,htmlFor=_this$props.htmlFor,label=_this$props.label,className=_this$props.className;return/*#__PURE__*/React.createElement("div",{className:classNames(style.formElement,className,'formElement','ui-shared__form-element')},hasPlaceholder&&/*#__PURE__*/React.createElement(Placeholder,{visible:this.isPlaceholderVisible,placeholder:placeholder||label,"aria-hidden":true}),/*#__PURE__*/React.createElement(Label,{htmlFor:htmlFor,label:label,isFocused:isFocused,isFloating:this.isLabelFloating,hasErrorMessage:this.hasErrorMessage}),this.props.children,this.props.hasUnderline&&/*#__PURE__*/React.createElement(Underline,{isFocused:isFocused,hasErrorMessage:this.hasErrorMessage}),/*#__PURE__*/React.createElement(ErrorText,{errorText:errorText,translate:translateErrorText}));}}]);return FormElement;}(Component);_defineProperty(FormElement,"defaultProps",{children:null,className:'',errorText:'',placeholder:'',label:'',isFocused:false,hasValue:false,hasPlaceholder:true,hasUnderline:true,translateErrorText:true});export default FormElement;
|
package/FormElement/spec.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
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);}import React from'react';import{mount}from'enzyme';import FormElement from"./index";var inputProps={htmlFor:'test-input'};describe('<FormElement />',function(){// Simple tests for snapshots
|
|
2
|
-
var tests={'should render a form element with no children':{props:{}},'should render a form element with 1 child':{props:{children:[React.createElement("input",{key:"test-key"})]}},'should render a focused form element':{props:{isFocused:true}},'should show the label':{props:{label:'The label'},find:'Label',equal:'The label'},'should show the error message':{props:{errorText:'The error text'},find:'ErrorText',equal:'The error text'},'should show the placeholder text':{props:{placeholder:'The placeholder'},find:'Placeholder',equal:'The placeholder'}};Object.keys(tests).forEach(function(test){it(test,function(){var testFixtures=tests[test];var wrapper=mount(React.createElement(FormElement,_extends({},inputProps,
|
|
2
|
+
var tests={'should render a form element with no children':{props:{}},'should render a form element with 1 child':{props:{children:[/*#__PURE__*/React.createElement("input",{key:"test-key"})]}},'should render a focused form element':{props:{isFocused:true}},'should show the label':{props:{label:'The label'},find:'Label',equal:'The label'},'should show the error message':{props:{errorText:'The error text'},find:'ErrorText',equal:'The error text'},'should show the placeholder text':{props:{placeholder:'The placeholder'},find:'Placeholder',equal:'The placeholder'}};Object.keys(tests).forEach(function(test){it(test,function(){var testFixtures=tests[test];var wrapper=mount(/*#__PURE__*/React.createElement(FormElement,_extends({},inputProps,testFixtures.props)));expect(wrapper).toMatchSnapshot();if(testFixtures.find){expect(wrapper.find(testFixtures.find).find('Translate').props().string).toEqual(testFixtures.equal);}});});it('Should hide placeholder with hasValue',function(){var wrapper=mount(/*#__PURE__*/React.createElement(FormElement,_extends({},inputProps,{hasValue:true})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('Placeholder').props().visible).toEqual(false);});});
|
package/Glow/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function _typeof(obj){
|
|
1
|
+
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}var _excluded=["children","styles","forwardedRef","className","color"];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;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{withForwardedRef}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import styles from"./style";/**
|
|
2
2
|
* Renders a glowing component that is visible when the user interacts with the element.
|
|
3
|
-
*/var Glow=/*#__PURE__*/function(_Component){_inherits(Glow,_Component);/**
|
|
3
|
+
*/var Glow=/*#__PURE__*/function(_Component){_inherits(Glow,_Component);var _super=_createSuper(Glow);/**
|
|
4
4
|
* The component constructor.
|
|
5
5
|
* @param {Object} props The component props.
|
|
6
|
-
*/function Glow(props){var _this;_classCallCheck(this,Glow);_this=
|
|
6
|
+
*/function Glow(props){var _this;_classCallCheck(this,Glow);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"handleTouchTap",function(){_this.setState({hover:true});_this.timeout=setTimeout(function(){_this.setState({hover:false});},250);});_this.timeout=null;_this.state={hover:false};return _this;}/**
|
|
7
7
|
* Clears any previously set timeout.
|
|
8
|
-
*/_createClass(Glow,[{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this.timeout);}},{key:"render"
|
|
8
|
+
*/_createClass(Glow,[{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this.timeout);}},{key:"render",value:/**
|
|
9
9
|
* Renders the component.
|
|
10
10
|
* @returns {JSX}
|
|
11
|
-
*/
|
|
12
|
-
jsx-a11y/click-events-have-key-events */return
|
|
11
|
+
*/function render(){var _this$props=this.props,children=_this$props.children,propStyles=_this$props.styles,forwardedRef=_this$props.forwardedRef,className=_this$props.className,color=_this$props.color,rest=_objectWithoutProperties(_this$props,_excluded);var innerInlineStyles;if(this.state.hover){innerInlineStyles=_extends({},propStyles.glow,propStyles.hover,{background:color});}else{innerInlineStyles=_extends({},propStyles.glow);}/* eslint-disable jsx-a11y/no-static-element-interactions,
|
|
12
|
+
jsx-a11y/click-events-have-key-events */return/*#__PURE__*/React.createElement("div",_extends({},rest,{className:classNames(styles.container,className,'ui-shared__glow'),onClick:this.handleTouchTap,style:propStyles.container,ref:forwardedRef}),/*#__PURE__*/React.createElement("div",{className:styles.glow,style:innerInlineStyles}),children);/* eslint-enable jsx-a11y/no-static-element-interactions,
|
|
13
13
|
jsx-a11y/click-events-have-key-events */}}]);return Glow;}(Component);_defineProperty(Glow,"defaultProps",{color:themeConfig.colors.shade8,className:null,forwardedRef:null,styles:{container:null,glow:null,hover:null}});export default withForwardedRef(Glow);
|
package/Glow/spec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from'react';import{mount}from'enzyme';import Glow from"./index";describe('<Glow />',function(){it('should render with a smile',function(){var wrapper=mount(React.createElement(Glow,null
|
|
1
|
+
import React from'react';import{mount}from'enzyme';import Glow from"./index";describe('<Glow />',function(){it('should render with a smile',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Glow,null,/*#__PURE__*/React.createElement("p",null,"Glowing!")));expect(wrapper).toMatchSnapshot();});});
|
package/IndicatorCircle/index.js
CHANGED
|
@@ -6,4 +6,4 @@ import React from'react';import PropTypes from'prop-types';import{themeConfig}fr
|
|
|
6
6
|
* @param {Object} props.strokeWidth Stroke width of the circle.
|
|
7
7
|
* @param {bool} props.paused Animation should be paused.
|
|
8
8
|
* @returns {JSX}
|
|
9
|
-
*/var IndicatorCircle=function IndicatorCircle(_ref){var size=_ref.size,color=_ref.color,strokeWidth=_ref.strokeWidth,paused=_ref.paused;return
|
|
9
|
+
*/var IndicatorCircle=function IndicatorCircle(_ref){var size=_ref.size,color=_ref.color,strokeWidth=_ref.strokeWidth,paused=_ref.paused;return/*#__PURE__*/React.createElement("svg",{className:"".concat(styles.spinner(paused)," ui-shared__indicator-circle"),viewBox:"25 25 50 50",width:size,height:size,xmlns:"http://www.w3.org/2000/svg","data-test-id":"loadingIndicator"},/*#__PURE__*/React.createElement("circle",{className:styles.circle(color,strokeWidth,paused),cx:"50",cy:"50",r:"20"}));};IndicatorCircle.defaultProps={color:themeConfig.colors.accent,paused:false,size:themeConfig.variables.loadingIndicator.size,strokeWidth:themeConfig.variables.loadingIndicator.strokeWidth};export default IndicatorCircle;
|
package/IndicatorCircle/spec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from'react';import{shallow,mount}from'enzyme';import IndicatorCircle from"./index";import styles from"./style";describe('<IndicatorCircle />',function(){it('should apply the given size',function(){var wrapper=shallow(React.createElement(IndicatorCircle,{size:32}));expect(wrapper).toMatchSnapshot();var svg=wrapper.find('svg');expect(svg.props().width).toBe(32);expect(svg.props().height).toBe(32);});it('should apply the given color',function(){var wrapper=mount(React.createElement(IndicatorCircle,{size:32,color:"#fff",strokeWidth:4}));expect(wrapper).toMatchSnapshot();var correctCssClass=styles.circle('#fff',4,false);var wrongCssClass=styles.circle('#000',0);var circleHtml=wrapper.find('circle');expect(circleHtml.html().indexOf(correctCssClass)).toBeGreaterThanOrEqual(0);expect(circleHtml.html().indexOf(wrongCssClass)).toBe(-1);});});
|
|
1
|
+
import React from'react';import{shallow,mount}from'enzyme';import IndicatorCircle from"./index";import styles from"./style";describe('<IndicatorCircle />',function(){it('should apply the given size',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(IndicatorCircle,{size:32}));expect(wrapper).toMatchSnapshot();var svg=wrapper.find('svg');expect(svg.props().width).toBe(32);expect(svg.props().height).toBe(32);});it('should apply the given color',function(){var wrapper=mount(/*#__PURE__*/React.createElement(IndicatorCircle,{size:32,color:"#fff",strokeWidth:4}));expect(wrapper).toMatchSnapshot();var correctCssClass=styles.circle('#fff',4,false);var wrongCssClass=styles.circle('#000',0);var circleHtml=wrapper.find('circle');expect(circleHtml.html().indexOf(correctCssClass)).toBeGreaterThanOrEqual(0);expect(circleHtml.html().indexOf(wrongCssClass)).toBe(-1);});});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from'react';import{themeConfig}from'@shopgate/engage';import IndicatorCircle from"../IndicatorCircle";import styles,{imgContainer}from"./style";var _themeConfig$variable=themeConfig.variables.loadingIndicator;_themeConfig$variable=_themeConfig$variable===void 0?{}:_themeConfig$variable;var loadingImageSrc=_themeConfig$variable.imgSrc;/**
|
|
2
2
|
* Renders a loading indicator.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/var LoadingIndicator=function LoadingIndicator(){if(loadingImageSrc){return
|
|
4
|
+
*/var LoadingIndicator=function LoadingIndicator(){if(loadingImageSrc){return/*#__PURE__*/React.createElement("div",{className:"".concat(imgContainer," loading-indicator ui-shared__loading-indicator")},/*#__PURE__*/React.createElement("img",{src:loadingImageSrc,alt:""}));}return/*#__PURE__*/React.createElement("div",{className:"".concat(styles," loading-indicator ui-shared__loading-indicator")},/*#__PURE__*/React.createElement(IndicatorCircle,null));};export default LoadingIndicator;
|
package/Manufacturer/index.js
CHANGED
|
@@ -4,4 +4,4 @@ import React from'react';import PropTypes from'prop-types';import styles from"./
|
|
|
4
4
|
* @param {string} props.text The manufacturer name.
|
|
5
5
|
* @param {string} [props.className] CSS classes.
|
|
6
6
|
* @return {JSX}
|
|
7
|
-
*/var Manufacturer=function Manufacturer(_ref){var className=_ref.className,text=_ref.text;return
|
|
7
|
+
*/var Manufacturer=function Manufacturer(_ref){var className=_ref.className,text=_ref.text;return/*#__PURE__*/React.createElement("div",{className:"".concat(styles," ").concat(className," ui-shared__manufacturer")},text);};Manufacturer.defaultProps={className:''};export default Manufacturer;
|
package/MessageBar/index.js
CHANGED
|
@@ -5,4 +5,4 @@ import React,{memo}from'react';import classnames from'classnames';import PropTyp
|
|
|
5
5
|
* @param {Object} props.classNames Styling.
|
|
6
6
|
* @returns {JSX}
|
|
7
7
|
* @deprecated Please import from `@shopgate/engage/components` instead.
|
|
8
|
-
*/var MessageBar
|
|
8
|
+
*/var MessageBar=/*#__PURE__*/memo(function(_ref){var messages=_ref.messages,classNames=_ref.classNames;return/*#__PURE__*/React.createElement("div",{className:classnames(styles.container,classNames.container,'ui-shared__message-bar'),role:messages.length>0?'alert':null},messages.map(function(item){var _item$type=item.type,type=_item$type===void 0?'info':_item$type,message=item.message,_item$messageParams=item.messageParams,messageParams=_item$messageParams===void 0?null:_item$messageParams,translated=item.translated;var messageOutput=!translated?i18n.text(message,messageParams):message;return/*#__PURE__*/React.createElement("div",{key:"".concat(type,"-").concat(message),className:classnames(classNames.message,styles[type])},/*#__PURE__*/React.createElement("span",{"aria-hidden":true},messageOutput));}));});MessageBar.defaultProps={classNames:{container:null,message:null}};export default MessageBar;
|
package/MessageBar/spec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from'react';import{mount}from'enzyme';import MessageBar from"./index";var MESSAGE1='This is some information';var MESSAGE2='This is an error that happened here.';var MESSAGE3='This is just a warning. Nothing to freak out about.';var MESSAGE4='Normal pre-translated message.';var MESSAGE5='Normal pre-translated message.';var MESSAGE6='some.translation.string';var MESSAGE7='Message with messageParams';describe('<MessageBar />',function(){describe('General rendering',function(){it('should be empty if no messages have been set',function(){var wrapper=mount(React.createElement(MessageBar,{messages:[]}));expect(wrapper).toMatchSnapshot();});it('should render a message as info if type is missing',function(){var wrapper=mount(React.createElement(MessageBar,{messages:[{message:'something'}]}));expect(wrapper).toMatchSnapshot();});});describe('Multiple messages rendering',function(){it('should render messages without frontend translation',function(){var wrapper=mount(React.createElement(MessageBar,{messages:[{type:'info',message:MESSAGE1},{type:'error',message:MESSAGE2},{type:'warning',message:MESSAGE3},{message:MESSAGE4,translated:null},{message:MESSAGE5,translated:true}]}));expect(wrapper).toMatchSnapshot();});it('should translate and render all given messages',function(){var wrapper=mount(React.createElement(MessageBar,{messages:[{message:MESSAGE6,translated:false},{message:MESSAGE7,messageParams:{myCustomParam1:'-> TEST-VALUE #1 <-',myCustomParam2:'-> TEST-VALUE #2 <-'},translated:false}]}));expect(wrapper).toMatchSnapshot();});it('should render with custom classNames',function(){var wrapper=mount(React.createElement(MessageBar,{messages:[{message:MESSAGE1}],classNames:{container:'cls-container',message:'cls-message'}}));expect(wrapper).toMatchSnapshot();});});});
|
|
1
|
+
import React from'react';import{mount}from'enzyme';import MessageBar from"./index";var MESSAGE1='This is some information';var MESSAGE2='This is an error that happened here.';var MESSAGE3='This is just a warning. Nothing to freak out about.';var MESSAGE4='Normal pre-translated message.';var MESSAGE5='Normal pre-translated message.';var MESSAGE6='some.translation.string';var MESSAGE7='Message with messageParams';describe('<MessageBar />',function(){describe('General rendering',function(){it('should be empty if no messages have been set',function(){var wrapper=mount(/*#__PURE__*/React.createElement(MessageBar,{messages:[]}));expect(wrapper).toMatchSnapshot();});it('should render a message as info if type is missing',function(){var wrapper=mount(/*#__PURE__*/React.createElement(MessageBar,{messages:[{message:'something'}]}));expect(wrapper).toMatchSnapshot();});});describe('Multiple messages rendering',function(){it('should render messages without frontend translation',function(){var wrapper=mount(/*#__PURE__*/React.createElement(MessageBar,{messages:[{type:'info',message:MESSAGE1},{type:'error',message:MESSAGE2},{type:'warning',message:MESSAGE3},{message:MESSAGE4,translated:null},{message:MESSAGE5,translated:true}]}));expect(wrapper).toMatchSnapshot();});it('should translate and render all given messages',function(){var wrapper=mount(/*#__PURE__*/React.createElement(MessageBar,{messages:[{message:MESSAGE6,translated:false},{message:MESSAGE7,messageParams:{myCustomParam1:'-> TEST-VALUE #1 <-',myCustomParam2:'-> TEST-VALUE #2 <-'},translated:false}]}));expect(wrapper).toMatchSnapshot();});it('should render with custom classNames',function(){var wrapper=mount(/*#__PURE__*/React.createElement(MessageBar,{messages:[{message:MESSAGE1}],classNames:{container:'cls-container',message:'cls-message'}}));expect(wrapper).toMatchSnapshot();});});});
|
|
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import styles from"./
|
|
|
2
2
|
* The no search results icon component.
|
|
3
3
|
* @param {Object} props Props of the component
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var NoResultIcon=function NoResultIcon(props){return
|
|
5
|
+
*/var NoResultIcon=function NoResultIcon(props){return/*#__PURE__*/React.createElement("svg",{className:props.className,viewBox:"-2698 6977 216 216",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/React.createElement("defs",null,/*#__PURE__*/React.createElement("filter",{id:"no-search-results-shadow",height:"130%"},/*#__PURE__*/React.createElement("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:"3"}),/*#__PURE__*/React.createElement("feOffset",{dx:"2",dy:"2",result:"offsetblur"}),/*#__PURE__*/React.createElement("feComponentTransfer",null,/*#__PURE__*/React.createElement("feFuncA",{type:"linear",slope:"0.1"})),/*#__PURE__*/React.createElement("feMerge",null,/*#__PURE__*/React.createElement("feMergeNode",null),/*#__PURE__*/React.createElement("feMergeNode",{"in":"SourceGraphic"})))),/*#__PURE__*/React.createElement("g",{transform:"translate(-2770 6819)"},/*#__PURE__*/React.createElement("g",{transform:"translate(0 46)"},/*#__PURE__*/React.createElement("circle",{className:styles.background,cx:"104",cy:"104",r:"104",transform:"translate(76 116)"})),/*#__PURE__*/React.createElement("g",{transform:"translate(-4 42)"},/*#__PURE__*/React.createElement("circle",{className:styles.background,cx:"108",cy:"108",r:"108",transform:"translate(76 116)"})),/*#__PURE__*/React.createElement("g",null,/*#__PURE__*/React.createElement("circle",{className:styles.circle,cx:"104",cy:"104",r:"104",transform:"translate(76 162)"}),/*#__PURE__*/React.createElement("circle",{className:styles.circle,cx:"92",cy:"92",r:"92",transform:"translate(88 174)"}),/*#__PURE__*/React.createElement("circle",{className:styles.circle,cx:"80",cy:"80",r:"80",transform:"translate(100 186)"})),/*#__PURE__*/React.createElement("g",{name:"cloud",filter:"url(#no-search-results-shadow)",transform:"translate(83.6 235.124)"},/*#__PURE__*/React.createElement("g",{transform:"matrix(1, 0, 0, 1, 2686.4, -7054.12)"},/*#__PURE__*/React.createElement("path",{className:styles.background,d:"M90.216,116.652a24.732,24.732,0,0,1-20.61-10.992,13.394,13.394,0,0,1-7.263-1.374,20,20,0,0,1-7.655,1.767,20.473,20.473,0,0,1-18.255-10.6,20.009,20.009,0,0,1-6.478.981A23.584,23.584,0,0,1,6.4,73.076c0-10.6,6.085-19.236,15.507-22.181V50.11A13.07,13.07,0,0,1,34.862,37.155a13.905,13.905,0,0,1,2.748.2A18.6,18.6,0,0,1,52.724,29.7,19.248,19.248,0,0,1,65.876,35,14.4,14.4,0,0,1,75.1,31.659a13.191,13.191,0,0,1,6.281,1.963,24.851,24.851,0,0,1,40.239,1.767,21.962,21.962,0,0,1,20.61,5.3c.393-.2.589-.393.981-.589a16.9,16.9,0,0,1,7.459-1.963,15.491,15.491,0,0,1,15.311,13.937A22.951,22.951,0,0,1,181.49,64.439c2.944,6.478,2.355,13.544-1.57,20.218a21.266,21.266,0,0,1-18.059,10.011h-.2c-4.122,0-7.459-.785-10.207-2.552a13.109,13.109,0,0,1-7.263.393,24.871,24.871,0,0,1-15.311,15.114,24.1,24.1,0,0,1-18.451-.981A25.762,25.762,0,0,1,90.216,116.652Z",transform:"translate(-2686.4 7054.12)"}))),/*#__PURE__*/React.createElement("g",{name:"magnifier",filter:"url(#no-search-results-shadow)"},/*#__PURE__*/React.createElement("g",{transform:"matrix(1, 0, 0, 1, 2770, -6819)"},/*#__PURE__*/React.createElement("rect",{className:styles.magnifier,width:"13.003",height:"3.855",transform:"matrix(0.53, 0.85, -0.85, 0.53, -2613.92, 7029.38)"})),/*#__PURE__*/React.createElement("g",{transform:"matrix(1, 0, 0, 1, 2770, -6819)"},/*#__PURE__*/React.createElement("rect",{className:styles.magnifier,width:"3.855",height:"13.003",transform:"translate(-2566.07 7029.56) rotate(37.01)"})),/*#__PURE__*/React.createElement("g",{transform:"matrix(1, 0, 0, 1, 2770, -6819)"},/*#__PURE__*/React.createElement("rect",{className:styles.magnifier,width:"3.856",height:"13.002",transform:"translate(-2592.67 7023)"})),/*#__PURE__*/React.createElement("circle",{className:styles.background,cx:"34",cy:"34",r:"34",transform:"translate(147 223)"}),/*#__PURE__*/React.createElement("g",{transform:"translate(136 -7)"},/*#__PURE__*/React.createElement("g",{transform:"translate(10.699 229.942)"},/*#__PURE__*/React.createElement("g",{transform:"translate(0 0)"},/*#__PURE__*/React.createElement("g",{transform:"matrix(1, 0, 0, 1, 2623.3, -7041.94)"},/*#__PURE__*/React.createElement("path",{className:styles.magnifier,d:"M83.335,33.853a34.228,34.228,0,1,0-1.494,49.8l4.482,4.482L84.63,89.829a1.926,1.926,0,0,0,0,2.789l17.032,16.932a1.926,1.926,0,0,0,2.789,0l5.677-5.677a1.926,1.926,0,0,0,0-2.789L93.1,84.152a1.926,1.926,0,0,0-2.789,0l-1.1,1.1-4.482-4.482A34.352,34.352,0,0,0,83.335,33.853Zm22.51,68.625-2.789,2.789L88.912,91.124,91.7,88.335ZM37.718,79.47a30.214,30.214,0,1,1,42.729,0A30.3,30.3,0,0,1,37.718,79.47Z",transform:"translate(-2648.22 7018.1)"})),/*#__PURE__*/React.createElement("path",{className:styles.magnifier,d:"M111.291,55.583a1.972,1.972,0,1,0,2.789-2.789,28.585,28.585,0,0,0-40.338-.1,1.972,1.972,0,0,0,2.789,2.789A24.557,24.557,0,0,1,111.291,55.583Z",transform:"translate(-59.748 -38.701)"})))))));};NoResultIcon.defaultProps={className:''};export default NoResultIcon;
|
package/NoResults/index.js
CHANGED
|
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import I18n from'@sho
|
|
|
2
2
|
* The NoResults component.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var NoResults=function NoResults(props){return
|
|
5
|
+
*/var NoResults=function NoResults(props){return/*#__PURE__*/React.createElement("div",{className:"".concat(styles.wrapper," ui-shared__no-results"),"data-test-id":"noResults"},/*#__PURE__*/React.createElement("div",{className:styles.icon},/*#__PURE__*/React.createElement(Icon,null)),/*#__PURE__*/React.createElement("div",{className:styles.headline},/*#__PURE__*/React.createElement(I18n.Text,{string:props.headlineText,params:props})),/*#__PURE__*/React.createElement("div",{className:styles.text},/*#__PURE__*/React.createElement(I18n.Text,{string:props.bodyText,params:props})));};export default NoResults;
|
package/Placeholder/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function _typeof(obj){
|
|
1
|
+
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import styles from"./style";/**
|
|
2
2
|
* The placeholder component.
|
|
3
|
-
*/var Placeholder=/*#__PURE__*/function(_PureComponent){_inherits(Placeholder,_PureComponent);function Placeholder(){_classCallCheck(this,Placeholder);return
|
|
3
|
+
*/var Placeholder=/*#__PURE__*/function(_PureComponent){_inherits(Placeholder,_PureComponent);var _super=_createSuper(Placeholder);function Placeholder(){_classCallCheck(this,Placeholder);return _super.apply(this,arguments);}_createClass(Placeholder,[{key:"render",value:/* eslint-disable react/no-unused-prop-types */ /* eslint-enable react/no-unused-prop-types */ /**
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/
|
|
5
|
+
*/function render(){return/*#__PURE__*/React.createElement("div",{className:"".concat(styles," ui-shared__placeholder"),style:this.props});}}]);return Placeholder;}(PureComponent);_defineProperty(Placeholder,"defaultProps",{height:0,left:0,top:0,width:0});export default Placeholder;
|
|
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import styles from"./
|
|
|
2
2
|
* Placeholder for one line texts.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @return {JSX}
|
|
5
|
-
*/var PlaceholderLabel=function PlaceholderLabel(_ref){var children=_ref.children,className=_ref.className,ready=_ref.ready,style=_ref.style;if(!ready){return
|
|
5
|
+
*/var PlaceholderLabel=function PlaceholderLabel(_ref){var children=_ref.children,className=_ref.className,ready=_ref.ready,style=_ref.style;if(!ready){return/*#__PURE__*/React.createElement("div",{style:style,className:"".concat(styles.label," ").concat(className," ui-shared__placeholder-label")});}return children;};PlaceholderLabel.defaultProps={children:null,className:'',style:null,ready:false};export default PlaceholderLabel;
|
package/PlaceholderLabel/spec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from'react';import{mount}from'enzyme';import PlaceholderLabel from"./index";describe('<PlaceholderLabel />',function(){it('should render placeholder ',function(){var wrapper=mount(React.createElement(PlaceholderLabel,{ready:false}
|
|
1
|
+
import React from'react';import{mount}from'enzyme';import PlaceholderLabel from"./index";describe('<PlaceholderLabel />',function(){it('should render placeholder ',function(){var wrapper=mount(/*#__PURE__*/React.createElement(PlaceholderLabel,{ready:false},/*#__PURE__*/React.createElement("h1",null,"foo")));expect(wrapper).toMatchSnapshot();expect(wrapper.find('h1').length).toEqual(0);});it('should render children',function(){var wrapper=mount(/*#__PURE__*/React.createElement(PlaceholderLabel,{ready:true},/*#__PURE__*/React.createElement("h1",null,"foo")));expect(wrapper).toMatchSnapshot();expect(wrapper.find('h1').length).toEqual(1);});});
|
|
@@ -3,4 +3,4 @@ import React from'react';import PropTypes from'prop-types';import range from'lod
|
|
|
3
3
|
* Creates a simple paragraph out of PlaceholderLabels.
|
|
4
4
|
* @param {Object} props The component props.
|
|
5
5
|
* @return {JSX}
|
|
6
|
-
*/var PlaceholderParagraph=function PlaceholderParagraph(_ref){var className=_ref.className,children=_ref.children,lines=_ref.lines,ready=_ref.ready;if(ready){return children;}return
|
|
6
|
+
*/var PlaceholderParagraph=function PlaceholderParagraph(_ref){var className=_ref.className,children=_ref.children,lines=_ref.lines,ready=_ref.ready;if(ready){return children;}return/*#__PURE__*/React.createElement("div",{className:"ui-shared__placeholder-paragraph"},range(lines).map(function(num){var width=num%2===0?"".concat(widths[(num/2+widths.length)%widths.length],"%"):null;return/*#__PURE__*/React.createElement(PlaceholderLabel,{key:num,style:width?{width:width}:null,className:className});}));};PlaceholderParagraph.defaultProps={className:'',lines:3,ready:false};export default PlaceholderParagraph;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from'react';import{mount}from'enzyme';import PlaceholderParagraph from"./index";describe('<PlaceholderParagraph />',function(){it('should render placeholder ',function(){var wrapper=mount(React.createElement(PlaceholderParagraph,{ready:false}
|
|
1
|
+
import React from'react';import{mount}from'enzyme';import PlaceholderParagraph from"./index";describe('<PlaceholderParagraph />',function(){it('should render placeholder ',function(){var wrapper=mount(/*#__PURE__*/React.createElement(PlaceholderParagraph,{ready:false},/*#__PURE__*/React.createElement("h1",null,"foo")));expect(wrapper).toMatchSnapshot();expect(wrapper.find('h1').length).toEqual(0);});it('should render children',function(){var wrapper=mount(/*#__PURE__*/React.createElement(PlaceholderParagraph,{ready:true},/*#__PURE__*/React.createElement("h1",null,"foo")));expect(wrapper).toMatchSnapshot();expect(wrapper.find('h1').length).toEqual(1);});});
|
package/Price/index.js
CHANGED
|
@@ -13,4 +13,4 @@ var showDisclaimer=typeof show==='boolean'?show:showTaxDisclaimer;var containerC
|
|
|
13
13
|
* A unitPriceMin > 0 means, that the product has child products with different prices.
|
|
14
14
|
* The unitPriceMin contains the lowest of these prices and will be
|
|
15
15
|
* displayed with a 'From' prefix.
|
|
16
|
-
*/return
|
|
16
|
+
*/return/*#__PURE__*/React.createElement("div",{className:containerClasses,"data-test-id":"minPrice: ".concat(props.unitPriceMin," price: ").concat(props.unitPrice," currency: ").concat(props.currency)},/*#__PURE__*/React.createElement("span",{role:"text","aria-label":__('price.label',{price:ariaPrice})},props.unitPriceMin?/*#__PURE__*/React.createElement(I18n.Text,{string:"price.from"},/*#__PURE__*/React.createElement(I18n.Price,{currency:props.currency,fractions:props.fractions,forKey:"price",price:props.unitPriceMin})):/*#__PURE__*/React.createElement(I18n.Price,{currency:props.currency,fractions:props.fractions,price:props.unitPrice})),props.taxDisclaimer&&showDisclaimer?/*#__PURE__*/React.createElement("div",{role:"text",className:styles.disclaimer,"aria-label":__('product.tax_disclaimer')},hint||'*'):null);/* eslint-enable jsx-a11y/aria-role */};Price.defaultProps={className:'',unitPriceMin:0,discounted:false,fractions:true,taxDisclaimer:false};Price.contextTypes={i18n:PropTypes.func};export default Price;
|
package/PriceInfo/index.js
CHANGED
|
@@ -4,4 +4,4 @@ import React from'react';import PropTypes from'prop-types';import styles from"./
|
|
|
4
4
|
* @param {string} props.text The price info string e.g. 12,00 € / l
|
|
5
5
|
* @param {string} [props.className] CSS classes
|
|
6
6
|
* @return {JSX}
|
|
7
|
-
*/var PriceInfo=function PriceInfo(_ref){var className=_ref.className,text=_ref.text;return
|
|
7
|
+
*/var PriceInfo=function PriceInfo(_ref){var className=_ref.className,text=_ref.text;return/*#__PURE__*/React.createElement("div",{className:"".concat(styles," ").concat(className," ui-shared__price-info"),dangerouslySetInnerHTML:{__html:text},"data-test-id":"priceInfo: ".concat(text)});};PriceInfo.defaultProps={className:''};export default PriceInfo;
|
package/PriceStriked/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _typeof(obj){
|
|
1
|
+
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import I18n from'@shopgate/pwa-common/components/I18n';import styles from"./style";/**
|
|
2
2
|
* Calculates the angle for the strike-through line
|
|
3
3
|
* @param {HTMLElement} element The price element
|
|
4
4
|
* @returns {number} the calculated angle
|
|
@@ -13,10 +13,10 @@ return Math.round(90-Math.atan(width/height)*(180/Math.PI));};/**
|
|
|
13
13
|
* @param {string} props.currency The currency of the price
|
|
14
14
|
* @param {string} [props.className] CSS classes
|
|
15
15
|
* @return {JSX}
|
|
16
|
-
*/var PriceStriked=/*#__PURE__*/function(_Component){_inherits(PriceStriked,_Component);/**
|
|
16
|
+
*/var PriceStriked=/*#__PURE__*/function(_Component){_inherits(PriceStriked,_Component);var _super=_createSuper(PriceStriked);/**
|
|
17
17
|
* Constructor
|
|
18
18
|
* @param {Object} props The component props
|
|
19
|
-
*/function PriceStriked(props){var _this;_classCallCheck(this,PriceStriked);_this=
|
|
19
|
+
*/function PriceStriked(props){var _this;_classCallCheck(this,PriceStriked);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"setAngle",function(){if(_this.element){_this.angle=calcAngle(_this.element);return true;}return false;});_this.angle=null;_this.element=null;return _this;}/**
|
|
20
20
|
* Updates the component one more time with the calculated angle
|
|
21
21
|
* based on the DOM element.
|
|
22
22
|
*/_createClass(PriceStriked,[{key:"componentDidMount",value:function componentDidMount(){if(this.setAngle()){this.forceUpdate();}}/**
|
|
@@ -24,8 +24,8 @@ return Math.round(90-Math.atan(width/height)*(180/Math.PI));};/**
|
|
|
24
24
|
* and returns true if succeeded.
|
|
25
25
|
* @param {Object} element The target element.
|
|
26
26
|
* @returns {boolean}
|
|
27
|
-
*/},{key:"render"
|
|
27
|
+
*/},{key:"render",value:/**
|
|
28
28
|
* Renders the component.
|
|
29
29
|
* @returns {JSX}
|
|
30
|
-
*/
|
|
31
|
-
role:"text",className:"".concat(styles.basic," ").concat(this.props.className," ").concat(angleStyle," price-striked ui-shared__price-striked")}
|
|
30
|
+
*/function render(){var _this2=this;var _this$context$i18n=this.context.i18n(),__=_this$context$i18n.__,_p=_this$context$i18n._p;var angleStyle=this.angle?styles.getAngleStyle(this.angle):'';return/*#__PURE__*/React.createElement("div",{// eslint-disable-next-line jsx-a11y/aria-role
|
|
31
|
+
role:"text",className:"".concat(styles.basic," ").concat(this.props.className," ").concat(angleStyle," price-striked ui-shared__price-striked")},/*#__PURE__*/React.createElement("span",{ref:function ref(_ref){_this2.element=_ref;},"data-test-id":"strikedPrice: ".concat(this.props.value),"aria-label":__('price.label_old_price',{price:_p(this.props.value,this.props.currency,true)})},/*#__PURE__*/React.createElement(I18n.Price,{price:this.props.value,currency:this.props.currency})));}}]);return PriceStriked;}(Component);_defineProperty(PriceStriked,"defaultProps",{className:''});_defineProperty(PriceStriked,"contextTypes",{i18n:PropTypes.func});export default PriceStriked;
|
|
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import Ellipsis from'
|
|
|
2
2
|
* The Product Properties component.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var Properties=function Properties(_ref){var lineClamp=_ref.lineClamp,properties=_ref.properties;if(!properties.length){return null;}return
|
|
5
|
+
*/var Properties=function Properties(_ref){var lineClamp=_ref.lineClamp,properties=_ref.properties;if(!properties.length){return null;}return/*#__PURE__*/React.createElement("ul",{className:"ui-shared__product-properties"},properties.map(function(_ref2){var label=_ref2.label,value=_ref2.value;return/*#__PURE__*/React.createElement("li",{key:"".concat(label,"-").concat(value)},lineClamp&&/*#__PURE__*/React.createElement(Ellipsis,{rows:lineClamp},"".concat(label,": ").concat(value)),!lineClamp&&"".concat(label,": ").concat(value));}));};Properties.defaultProps={lineClamp:null,properties:[]};export default Properties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from'react';import{mount}from'enzyme';import Ellipsis from'@shopgate/pwa-common/components/Ellipsis';import ProductProperties from"./index";var properties=[{label:'Label One',value:'Value One'},{label:'Label Two',value:'Value Two'}];describe('<ProductProperties />',function(){it('should not render when no properties are passed',function(){var wrapper=mount(React.createElement(ProductProperties,null));expect(wrapper).toMatchSnapshot();expect(wrapper).toBeEmptyRender();});it('should not render when an empty list of properties is passed',function(){var wrapper=mount(React.createElement(ProductProperties,{properties:[]}));expect(wrapper).toMatchSnapshot();expect(wrapper).toBeEmptyRender();});it('should render as expected when properties are passed',function(){expect.assertions(5);var wrapper=mount(React.createElement(ProductProperties,{properties:properties}));expect(wrapper).toMatchSnapshot();expect(wrapper.find(Ellipsis).exists()).toBe(false);var listElements=wrapper.find('li');expect(listElements.length).toBe(2);listElements.forEach(function(el,index){expect(listElements.at(index).text()).toBe("".concat(properties[index].label,": ").concat(properties[index].value));});});it('should use the ellipsis component when the lineClamp prop is passed ',function(){expect.assertions(6);var lineClamp=2;var wrapper=mount(React.createElement(ProductProperties,{properties:properties,lineClamp:lineClamp}));expect(wrapper).toMatchSnapshot();var listElements=wrapper.find(Ellipsis);expect(listElements.length).toBe(2);listElements.forEach(function(el,index){expect(el.prop('rows')).toBe(lineClamp);expect(listElements.at(index).text()).toBe("".concat(properties[index].label,": ").concat(properties[index].value));});});});
|
|
1
|
+
import React from'react';import{mount}from'enzyme';import Ellipsis from'@shopgate/pwa-common/components/Ellipsis';import ProductProperties from"./index";var properties=[{label:'Label One',value:'Value One'},{label:'Label Two',value:'Value Two'}];describe('<ProductProperties />',function(){it('should not render when no properties are passed',function(){var wrapper=mount(/*#__PURE__*/React.createElement(ProductProperties,null));expect(wrapper).toMatchSnapshot();expect(wrapper).toBeEmptyRender();});it('should not render when an empty list of properties is passed',function(){var wrapper=mount(/*#__PURE__*/React.createElement(ProductProperties,{properties:[]}));expect(wrapper).toMatchSnapshot();expect(wrapper).toBeEmptyRender();});it('should render as expected when properties are passed',function(){expect.assertions(5);var wrapper=mount(/*#__PURE__*/React.createElement(ProductProperties,{properties:properties}));expect(wrapper).toMatchSnapshot();expect(wrapper.find(Ellipsis).exists()).toBe(false);var listElements=wrapper.find('li');expect(listElements.length).toBe(2);listElements.forEach(function(el,index){expect(listElements.at(index).text()).toBe("".concat(properties[index].label,": ").concat(properties[index].value));});});it('should use the ellipsis component when the lineClamp prop is passed ',function(){expect.assertions(6);var lineClamp=2;var wrapper=mount(/*#__PURE__*/React.createElement(ProductProperties,{properties:properties,lineClamp:lineClamp}));expect(wrapper).toMatchSnapshot();var listElements=wrapper.find(Ellipsis);expect(listElements.length).toBe(2);listElements.forEach(function(el,index){expect(el.prop('rows')).toBe(lineClamp);expect(listElements.at(index).text()).toBe("".concat(properties[index].label,": ").concat(properties[index].value));});});});
|