@shopgate/pwa-ui-shared 6.18.0-beta.4 → 6.18.0

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.
@@ -1,3 +1,3 @@
1
- function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useState}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{I18n,Input,MagnifierIcon}from'@shopgate/engage/components';import styles from"./style";/**
1
+ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useState}from'react';import PropTypes from'prop-types';import classNames from'classnames';import I18n from'@shopgate/pwa-common/components/I18n';import Input from'@shopgate/pwa-common/components/Input';import MagnifierIcon from"../../../../../icons/MagnifierIcon";import styles from"./style";/**
2
2
  * @return {JSX}
3
- */var SearchBar=function SearchBar(_ref){var handleChange=_ref.handleChange;var _useState=useState(''),_useState2=_slicedToArray(_useState,2),query=_useState2[0],setQuery=_useState2[1];var name='search';return React.createElement("div",{className:"theme__browse__search-field","data-test-id":"SearchField"},React.createElement("div",{className:styles.container},React.createElement("div",{className:styles.inputWrapper},React.createElement("form",{onSubmit:function onSubmit(e){e.preventDefault();}},React.createElement("label",{htmlFor:name,className:styles.label},React.createElement("div",{className:styles.icon},React.createElement(MagnifierIcon,null)),!query.length&&React.createElement(I18n.Text,{string:"search.placeholder"})),React.createElement(Input,{name:name,autoComplete:false,className:classNames(styles.input),onChange:function onChange(value){handleChange(value);setQuery(value);},value:query,type:"search"})))));};export default SearchBar;
3
+ */var SearchBar=function SearchBar(_ref){var handleChange=_ref.handleChange;var _useState=useState(''),_useState2=_slicedToArray(_useState,2),query=_useState2[0],setQuery=_useState2[1];var name='search';return React.createElement("div",{className:"ui-shared__sheet__search-field","data-test-id":"SearchField"},React.createElement("div",{className:styles.container},React.createElement("div",{className:styles.inputWrapper},React.createElement("form",{onSubmit:function onSubmit(e){e.preventDefault();}},React.createElement("label",{htmlFor:name,className:styles.label},React.createElement("div",{className:styles.icon},React.createElement(MagnifierIcon,null)),!query.length&&React.createElement(I18n.Text,{string:"search.placeholder"})),React.createElement(Input,{name:name,autoComplete:false,className:classNames(styles.input),onChange:function onChange(value){handleChange(value);setQuery(value);},value:query,type:"search"})))));};export default SearchBar;
@@ -0,0 +1,3 @@
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React from'react';import{mount}from'enzyme';import SearchBar from"./index";describe('<SearchBar />',function(){it('should call handleChange on input',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var handleChange,wrapper;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:handleChange=jest.fn();_context.next=3;return mount(React.createElement(SearchBar,{handleChange:handleChange}));case 3:wrapper=_context.sent;expect(wrapper).toMatchSnapshot();// Update input
2
+ wrapper.find('input').first().simulate('change',{target:{name:'search',value:'asdf'}});// Should call with updated state.
3
+ expect(handleChange).toHaveBeenCalledWith('asdf');case 7:case"end":return _context.stop();}}},_callee);})));});
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import mockRenderOptions from'@shopgate/pwa-common/helpers/mocks/mockRenderOptions';import Header from"./index";describe('<Header />',function(){it('should render with correct title',function(){var title='My Title';var wrapper=shallow(React.createElement(Header,{title:title}),mockRenderOptions);expect(wrapper).toMatchSnapshot();expect(wrapper.find('GridItem').first().props().children).toEqual(title);});});
1
+ import React from'react';import{shallow,mount}from'enzyme';import mockRenderOptions from'@shopgate/pwa-common/helpers/mocks/mockRenderOptions';import Header from"./index";describe('<Header />',function(){it('should render with correct title',function(){var title='My Title';var wrapper=shallow(React.createElement(Header,{title:title}),mockRenderOptions);expect(wrapper).toMatchSnapshot();expect(wrapper.find('GridItem').first().props().children).toEqual(title);});it('should render searchbar',function(){var title='My Title';var wrapper=mount(React.createElement(Header,{title:title,showSearch:true}),mockRenderOptions);expect(wrapper).toMatchSnapshot();expect(wrapper.find('SearchBar').length).toBe(1);});it('should call handleChange on input',function(){var title='My Title';var handleChange=jest.fn();var wrapper=mount(React.createElement(Header,{title:title,showSearch:true,handleChange:handleChange}),mockRenderOptions);wrapper.find('input').first().simulate('change',{target:{name:'search',value:'asdf'}});expect(handleChange).toHaveBeenCalledWith('asdf');});});
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-ui-shared",
3
- "version": "6.18.0-beta.4",
3
+ "version": "6.18.0",
4
4
  "description": "Shopgate's shared UI components.",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
7
7
  "dependencies": {
8
- "@shopgate/pwa-ui-ios": "6.18.0-beta.4",
9
- "@shopgate/pwa-ui-material": "6.18.0-beta.4"
8
+ "@shopgate/pwa-ui-ios": "6.18.0",
9
+ "@shopgate/pwa-ui-material": "6.18.0"
10
10
  },
11
11
  "devDependencies": {
12
- "@shopgate/pwa-common": "6.18.0-beta.4",
13
- "@shopgate/pwa-common-commerce": "6.18.0-beta.4",
12
+ "@shopgate/pwa-common": "6.18.0",
13
+ "@shopgate/pwa-common-commerce": "6.18.0",
14
14
  "classnames": "^2.2.5",
15
15
  "react": "~16.12.0"
16
16
  },