@shopgate/pwa-ui-material 7.25.0-beta.2 → 7.25.0-beta.4

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.
@@ -13,5 +13,7 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
13
13
  * @param {string} [props.contentClassName] Class name for the content wrapper
14
14
  * @param {string} [props.testId] Test ID for the component
15
15
  * @param {React.ReactNode} props.children Children used for the content section of the accordion
16
+ * @param {Function} props.renderAdditionalHeaderContent optional additional content
17
+ * for the accordion header
16
18
  * @returns {JSX.Element}
17
- */function Accordion(props){var renderLabel=props.renderLabel,handleLabel=props.handleLabel,role=props.role,children=props.children,testId=props.testId,className=props.className,contentClassName=props.contentClassName,chevronClassName=props.chevronClassName,openWithChevron=props.openWithChevron,startOpened=props.startOpened,chevronPosition=props.chevronPosition;if(!renderLabel||!children){return null;}var controlsId=testId?"".concat(testId,"-content").replace(/[^\w\s]/gi,'-').replace(' ','-'):'accordion-content';return React.createElement("div",{className:"ui-material__accordion-container"},React.createElement(AccordionContainer,{open:startOpened},function(_ref){var handleOpen=_ref.handleOpen,handleClose=_ref.handleClose,open=_ref.open;var clickHandlers={onClick:open?handleClose:handleOpen,onKeyDown:open?handleClose:handleOpen,role:role,tabIndex:'0'};return React.createElement(React.Fragment,null,React.createElement("div",_extends({},openWithChevron?{}:clickHandlers,{className:classnames('ui-material__accordion-title',className,styles.toggle,_defineProperty(_defineProperty({},styles.toggleLeftAligned,chevronPosition==='left'),styles.clickable,!openWithChevron)),"data-test-id":testId,key:"accordion-toggle","aria-expanded":open,"aria-controls":controlsId,"aria-label":handleLabel}),React.createElement("div",{className:styles.labelContainer},renderLabel({open:open})),React.createElement("div",_extends({className:classnames(styles.chevronContainer,chevronClassName,_defineProperty({},styles.clickable,openWithChevron))},openWithChevron?clickHandlers:{},{"aria-label":i18n.text(open?'favorites.close_list':'favorites.open_list')}),React.createElement(ChevronIcon,{className:open?styles.chevronOpen:styles.chevronClosed}))),React.createElement(AccordionContent,{open:open,id:controlsId,key:controlsId,className:contentClassName},children));}));}Accordion.defaultProps={children:null,renderLabel:noop,className:null,contentClassName:null,chevronClassName:null,handleLabel:null,role:'button',testId:null,openWithChevron:false,chevronPosition:'right',startOpened:false};export default Accordion;
19
+ */function Accordion(props){var renderLabel=props.renderLabel,handleLabel=props.handleLabel,role=props.role,children=props.children,testId=props.testId,className=props.className,contentClassName=props.contentClassName,chevronClassName=props.chevronClassName,openWithChevron=props.openWithChevron,startOpened=props.startOpened,chevronPosition=props.chevronPosition,renderAdditionalHeaderContent=props.renderAdditionalHeaderContent;if(!renderLabel||!children){return null;}var controlsId=testId?"".concat(testId,"-content").replace(/[^\w\s]/gi,'-').replace(' ','-'):'accordion-content';return React.createElement("div",{className:"ui-material__accordion-container"},React.createElement(AccordionContainer,{open:startOpened},function(_ref){var handleOpen=_ref.handleOpen,handleClose=_ref.handleClose,open=_ref.open;var clickHandlers={onClick:open?handleClose:handleOpen,onKeyDown:open?handleClose:handleOpen,role:role};return React.createElement(React.Fragment,null,React.createElement("div",{className:classnames('ui-material__accordion-title',className,styles.toggle),"data-test-id":testId},React.createElement("div",_extends({},openWithChevron?{}:clickHandlers,{key:"accordion-toggle","aria-expanded":open,"aria-controls":controlsId,"aria-label":handleLabel,className:classnames(styles.labelContainer,_defineProperty({},styles.toggleLeftAligned,chevronPosition==='left'))}),renderLabel({open:open}),React.createElement("div",_extends({className:classnames(styles.chevronContainer,chevronClassName,_defineProperty({},styles.clickable,openWithChevron))},openWithChevron?clickHandlers:{},{"aria-label":i18n.text(open?'favorites.close_list':'favorites.open_list')}),React.createElement(ChevronIcon,{className:open?styles.chevronOpen:styles.chevronClosed}))),renderAdditionalHeaderContent&&React.createElement("div",null,renderAdditionalHeaderContent())),React.createElement(AccordionContent,{open:open,id:controlsId,key:controlsId,className:contentClassName},children));}));}Accordion.defaultProps={children:null,renderAdditionalHeaderContent:null,renderLabel:noop,className:null,contentClassName:null,chevronClassName:null,handleLabel:null,role:'button',testId:null,openWithChevron:false,chevronPosition:'right',startOpened:false};export default Accordion;
@@ -1,7 +1,5 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _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);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}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 _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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}});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 _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";/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _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);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}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 _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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}});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 _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 classNames from'classnames';import styles from"./style";/**
2
2
  * The AppBarTitle component.
3
3
  */var AppBarTitle=/*#__PURE__*/function(_PureComponent){function AppBarTitle(){_classCallCheck(this,AppBarTitle);return _callSuper(this,AppBarTitle,arguments);}_inherits(AppBarTitle,_PureComponent);return _createClass(AppBarTitle,[{key:"render",value:/**
4
- * @returns {JSX}
5
- */function render(){var _this$props=this.props,onClick=_this$props.onClick,title=_this$props.title;/* eslint-disable jsx-a11y/no-static-element-interactions,
6
- jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-tabindex */return React.createElement("div",{className:styles,role:"heading","aria-labelledby":"titleLabel","aria-level":"1","data-test-id":"title: ".concat(title),tabIndex:0},React.createElement("span",{onClick:onClick,id:"titleLabel",dangerouslySetInnerHTML:{__html:title}}));/* eslint-enable jsx-a11y/no-static-element-interactions,
7
- jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-tabindex */}}]);}(PureComponent);_defineProperty(AppBarTitle,"defaultProps",{onClick:null});export default AppBarTitle;
4
+ * @returns {JSX.Element}
5
+ */function render(){var _this$props=this.props,onClick=_this$props.onClick,title=_this$props.title;if(!title)return null;return React.createElement("div",{className:classNames(styles,'theme__app-bar__title'),role:"heading","aria-labelledby":"titleLabel","aria-level":"1","data-test-id":"title: ".concat(title),tabIndex:-1},React.createElement("span",{role:"presentation",onClick:onClick,id:"titleLabel",dangerouslySetInnerHTML:{__html:title}}));}}]);}(PureComponent);_defineProperty(AppBarTitle,"defaultProps",{onClick:null});export default AppBarTitle;
@@ -1,9 +1,9 @@
1
- import React from'react';import PropTypes from'prop-types';import Title from"./components/Title";import Content from"./components/Content";import Buttons from"./components/Buttons";import styles from"./style";/**
1
+ import React from'react';import PropTypes from'prop-types';import{FocusTrap}from'@shopgate/engage/a11y/components';import Title from"./components/Title";import Content from"./components/Content";import Buttons from"./components/Buttons";import styles from"./style";/**
2
2
  * This component renders a basic dialog in Google Material Design.
3
- * @param {Object} children The component children to render in the dialog.
4
- * @param {Object[]} actions The dialog actions.
5
- * @param {string} actions.label The label of the action.
6
- * @param {Function} actions.action The callback to invoke when the action is triggered.
7
- * @param {string|ReactElement} title The title of the dialog.
8
- * @return {JSX} The rendered dialog.
9
- */var BasicDialog=function BasicDialog(_ref){var children=_ref.children,actions=_ref.actions,title=_ref.title;return React.createElement("div",{className:"".concat(styles.container," ui-material__base-dialog"),"data-test-id":"basicDialog",role:"alertdialog","aria-modal":true,"aria-labelledby":"basicDialogTitle basicDialogDesc"},React.createElement("div",{className:styles.content},React.createElement(Title,{title:title}),React.createElement(Content,{content:children})),React.createElement("div",{className:styles.actions},React.createElement("div",{className:styles.innerActions},React.createElement(Buttons,{actions:actions}))));};BasicDialog.defaultProps={children:null,actions:[],title:null};export default BasicDialog;
3
+ * @param {Object} props The component props.
4
+ * @param {ReactNode} props.children The component children to render in the dialog.
5
+ * @param {Array<{label: string, action: Function}>} props.actions The dialog actions:
6
+ * the label and the callback to invoke when the action is triggered
7
+ * @param {string | ReactNode} props.title The title of the dialog.
8
+ * @return {JSX.Element} The rendered dialog.
9
+ */var BasicDialog=function BasicDialog(_ref){var children=_ref.children,actions=_ref.actions,title=_ref.title;return React.createElement(FocusTrap,null,React.createElement("div",{className:"".concat(styles.container," ui-material__base-dialog"),"data-test-id":"basicDialog",role:"alertdialog","aria-modal":true,"aria-labelledby":"basicDialogTitle basicDialogDesc"},React.createElement("div",{className:styles.content},React.createElement(Title,{title:title}),React.createElement(Content,{content:children})),React.createElement("div",{className:styles.actions},React.createElement("div",{className:styles.innerActions},React.createElement(Buttons,{actions:actions})))));};BasicDialog.defaultProps={children:null,actions:[],title:null};export default BasicDialog;
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import Title from"./components/Title";import Content from"./components/Content";import Buttons from"./components/Buttons";import BasicDialog from"./index";var props={title:'Hello World',children:React.createElement("div",null,"Hello World"),actions:[{label:'action0',action:jest.fn()},{label:'action1',action:jest.fn()},{label:'action2',action:jest.fn()}]};describe('<BasicDialog />',function(){it('should render with minimal props',function(){var wrapper=shallow(React.createElement(BasicDialog,{actions:[]}));expect(wrapper).toMatchSnapshot();});it('should render as expected',function(){var wrapper=shallow(React.createElement(BasicDialog,props));expect(wrapper).toMatchSnapshot();expect(wrapper.find(Title).length).toBe(1);expect(wrapper.find(Title).props().title).toEqual(props.title);expect(wrapper.find(Content).length).toBe(1);expect(wrapper.find(Content).props().content).toEqual(props.children);expect(wrapper.find(Buttons).length).toBe(1);expect(wrapper.find(Buttons).props().actions).toEqual(props.actions);});});
1
+ import React from'react';import{shallow}from'enzyme';import Title from"./components/Title";import Content from"./components/Content";import Buttons from"./components/Buttons";import BasicDialog from"./index";var props={title:'Hello World',children:React.createElement("div",null,"Hello World"),actions:[{label:'action0',action:jest.fn()},{label:'action1',action:jest.fn()},{label:'action2',action:jest.fn()}]};jest.mock('@shopgate/engage/a11y/components');describe('<BasicDialog />',function(){it('should render with minimal props',function(){var wrapper=shallow(React.createElement(BasicDialog,{actions:[]}));expect(wrapper).toMatchSnapshot();});it('should render as expected',function(){var wrapper=shallow(React.createElement(BasicDialog,props));expect(wrapper).toMatchSnapshot();expect(wrapper.find(Title).length).toBe(1);expect(wrapper.find(Title).props().title).toEqual(props.title);expect(wrapper.find(Content).length).toBe(1);expect(wrapper.find(Content).props().content).toEqual(props.children);expect(wrapper.find(Buttons).length).toBe(1);expect(wrapper.find(Buttons).props().actions).toEqual(props.actions);});});
@@ -1,8 +1,7 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _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);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}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 _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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}});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 _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{UIEvents}from'@shopgate/pwa-core';import{withForwardedRef}from'@shopgate/engage/core';import I18n from'@shopgate/pwa-common/components/I18n';import styles from"./style";/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _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);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}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 _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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}});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 _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{UIEvents}from'@shopgate/pwa-core';import{withForwardedRef}from'@shopgate/engage/core';import{I18n}from'@shopgate/engage/components';import styles from"./style";/**
2
2
  * The NavDrawerItem component.
3
3
  */var NavDrawerItem=/*#__PURE__*/function(_Component){function NavDrawerItem(){var _this2;_classCallCheck(this,NavDrawerItem);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this2=_callSuper(this,NavDrawerItem,[].concat(args));/**
4
4
  * Handles an Item click by executing it's href.
5
- * @param {Object} props The component props.
6
5
  */_defineProperty(_this2,"handleClick",function(){UIEvents.emit('navdrawer_close');setTimeout(_this2.props.onClick,300);});return _this2;}_inherits(NavDrawerItem,_Component);return _createClass(NavDrawerItem,[{key:"shouldComponentUpdate",value:/**
7
6
  * Only re-render when the label prop changes.
8
7
  * @param {Object} nextProps The next component props.
@@ -1 +1 @@
1
- import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';export default css({color:themeColors.shade3,fontSize:'0.875rem',fontWeight:500,margin:'16px 0 0 16px'});
1
+ import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';export default css({color:themeColors.shade11,fontSize:'0.875rem',fontWeight:500,margin:'16px 0 0 16px'});
package/NavDrawer/spec.js CHANGED
@@ -1 +1 @@
1
- import React from'react';import{shallow,mount}from'enzyme';import NavDrawer from"./index";jest.unmock('@shopgate/pwa-core');describe('NavDrawer',function(){it('should match the snapshot',function(){var wrapper=shallow(React.createElement(NavDrawer,null,"Content"));expect(wrapper).toMatchSnapshot();});it('should open and close with an event',function(){var onOpen=jest.fn();var onClose=jest.fn();var wrapper=mount(React.createElement(NavDrawer,{onOpen:onOpen,onClose:onClose},"Content"));NavDrawer.open();expect(wrapper.state().open).toEqual(true);expect(onOpen).toHaveBeenCalled();expect(onClose).not.toHaveBeenCalled();NavDrawer.close();expect(wrapper.state().open).toEqual(false);expect(onClose).toHaveBeenCalled();});it('should close when Backdrop is clicked',function(){var wrapper=shallow(React.createElement(NavDrawer,null,"Content"));var backdrop=wrapper.find('Backdrop');NavDrawer.open();expect(wrapper.state().open).toEqual(true);backdrop.simulate('click');expect(wrapper.state().open).toEqual(false);});});
1
+ import React from'react';import{shallow,mount}from'enzyme';import NavDrawer from"./index";jest.unmock('@shopgate/pwa-core');jest.mock('@shopgate/engage/components');describe('NavDrawer',function(){it('should match the snapshot',function(){var wrapper=shallow(React.createElement(NavDrawer,null,"Content"));expect(wrapper).toMatchSnapshot();});it('should open and close with an event',function(){var onOpen=jest.fn();var onClose=jest.fn();var wrapper=mount(React.createElement(NavDrawer,{onOpen:onOpen,onClose:onClose},"Content"));NavDrawer.open();expect(wrapper.state().open).toEqual(true);expect(onOpen).toHaveBeenCalled();expect(onClose).not.toHaveBeenCalled();NavDrawer.close();expect(wrapper.state().open).toEqual(false);expect(onClose).toHaveBeenCalled();});it('should close when Backdrop is clicked',function(){var wrapper=shallow(React.createElement(NavDrawer,null,"Content"));var backdrop=wrapper.find('Backdrop');NavDrawer.open();expect(wrapper.state().open).toEqual(true);backdrop.simulate('click');expect(wrapper.state().open).toEqual(false);});});
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-ui-material",
3
- "version": "7.25.0-beta.2",
3
+ "version": "7.25.0-beta.4",
4
4
  "description": "Shopgate's material design UI components.",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
7
7
  "devDependencies": {
8
- "@shopgate/pwa-common": "7.25.0-beta.2",
8
+ "@shopgate/pwa-common": "7.25.0-beta.4",
9
9
  "react": "~16.14.0",
10
10
  "react-dom": "~16.14.0",
11
11
  "redux": "^4.2.1"