From bbc856127a210620bf01b9dd409940298e6695a6 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sun, 11 Jun 2017 16:17:14 +0200 Subject: [PATCH] tests(visual): add Argos CI --- .eslintignore | 3 + .gitignore | 6 + .happo.js | 24 + .travis.yml | 8 + docgen/assets/js/sidebar.js | 5 +- docgen/plugins/jsdoc-data.js | 10 +- docgen/plugins/onlyChanged.js | 4 +- docgen/plugins/webpackEntryMetadata.js | 3 +- docgen/src/examples/default-theme/App.js | 20 +- .../src/examples/e-commerce-infinite/App.js | 23 +- docgen/src/examples/e-commerce/App.js | 28 +- docgen/src/examples/material-ui/App.js | 36 +- docgen/src/examples/media/App.js | 42 +- docgen/src/examples/tourism/App.js | 9 +- docgen/src/examples/urlSync.js | 63 +- docgen/syntaxHighlighting.js | 5 +- package.json | 7 + .../styles/_Toggle.scss | 2 +- .../examples/autocomplete/src/App-Mentions.js | 10 +- .../autocomplete/src/App-Multi-Index.js | 13 +- .../examples/geo-search/src/App.js | 11 +- .../examples/multi-index/src/App.js | 5 +- .../examples/react-native/src/Categories.js | 5 +- .../examples/react-native/src/Filters.js | 11 +- .../examples/react-native/src/Home.js | 17 +- .../examples/react-native/src/Rating.js | 16 +- .../examples/react-native/src/Type.js | 5 +- .../react-native/src/components/Spinner.js | 4 +- .../react-native/src/components/Stats.js | 4 +- .../examples/react-router-v4/src/App.js | 2 +- .../src/components/CurrentRefinements.js | 8 +- .../src/components/Highlight.test.js | 6 +- .../src/components/Highlighter.test.js | 6 +- .../src/components/Hits.js | 5 +- .../src/components/InfiniteHits.js | 9 +- .../src/components/LinkList.js | 4 +- .../src/components/PoweredBy.js | 5 +- .../src/components/SearchBox.js | 4 +- .../src/components/Select.js | 4 +- .../src/components/Snippet.test.js | 6 +- .../src/components/StarRating.js | 2 +- .../src/connectors/connectHitsPerPage.js | 4 +- .../src/connectors/connectMultiRange.js | 10 +- .../src/connectors/connectPoweredBy.test.js | 3 +- .../src/connectors/connectSortBy.js | 4 +- .../src/core/InstantSearch.js | 4 +- .../src/core/createConnector.js | 365 ++-- .../src/core/createInstantSearchManager.js | 2 +- .../src/widgets/ClearAll.js | 3 +- .../src/widgets/CurrentRefinements.js | 3 +- .../src/widgets/RangeSlider.js | 7 +- scripts/release.sh | 2 +- scripts/test.sh | 2 + stories/3rdPartyIntegrations.stories.js | 4 +- stories/ClearAll.stories.js | 12 +- stories/CurrentRefinements.stories.js | 16 +- stories/HierarchicalMenu.stories.js | 24 +- stories/Highlight.stories.js | 18 +- stories/Hits.stories.js | 8 +- stories/HitsPerPage.stories.js | 16 +- stories/InfiniteHits.stories.js | 4 +- stories/Menu.stories.js | 32 +- stories/MultiIndex.stories.js | 22 +- stories/MultiRange.stories.js | 20 +- stories/Pagination.stories.js | 20 +- stories/PoweredBy.stories.js | 4 +- stories/RangeInput.stories.js | 16 +- stories/RangeSlider.stories.js | 16 +- stories/RefinementList.stories.js | 32 +- stories/ScrollTo.stories.js | 4 +- stories/SearchBox.stories.js | 23 +- stories/Snippet.stories.js | 18 +- stories/SortBy.stories.js | 8 +- stories/StarRating.stories.js | 24 +- stories/Stats.stories.js | 4 +- stories/Toggle.stories.js | 8 +- stories/util.js | 16 +- storybook/config.js | 2 +- storybook/webpack.config.js | 3 +- test/regressions/XMLHttpRequest.js | 20 + test/regressions/debug.html | 15 + test/regressions/normalize.js | 45 + test/regressions/tests.js | 61 + test/regressions/webpack.config.js | 23 + yarn.lock | 1716 +++++++++-------- 85 files changed, 1707 insertions(+), 1416 deletions(-) create mode 100644 .happo.js create mode 100644 test/regressions/XMLHttpRequest.js create mode 100644 test/regressions/debug.html create mode 100644 test/regressions/normalize.js create mode 100644 test/regressions/tests.js create mode 100644 test/regressions/webpack.config.js diff --git a/.eslintignore b/.eslintignore index 40e6f03359..4f993f2aa0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,3 +5,6 @@ packages/react-instantsearch/examples/*/node_modules/ docs/ docs-production/ dist/ + +# Happo visual regression build +test/.happo diff --git a/.gitignore b/.gitignore index fa2530186d..c8348c028d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,9 @@ npm-debug.log *.iml preview.zip .happypack/ + +# Ignore Argos CI screenshots. +test/screenshots/ + +# Ignore Happo build. +test/.happo/ diff --git a/.happo.js b/.happo.js new file mode 100644 index 0000000000..5aaa52f304 --- /dev/null +++ b/.happo.js @@ -0,0 +1,24 @@ +const path = require('path'); +const FirefoxTarget = require('happo-target-firefox'); + +module.exports = { + snapshotsFolder: 'test/screenshots', + targets: [ + new FirefoxTarget({ + name: 'firefox', + sourceFiles: ['test/.happo/tests.js'], + stylesheets: [ + 'storybook/public/default.css', + 'storybook/public/react-autosuggest.css', + 'storybook/public/rheostat.css', + 'storybook/public/util.css', + ], + viewports: { + medium: { + width: 640, + height: 888, + }, + }, + }), + ], +}; diff --git a/.travis.yml b/.travis.yml index 5d0cfb4ea7..5f31a079be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,17 @@ before_script: branches: only: - master +addons: + firefox: 50.0 +before_install: + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start cache: yarn: true directories: - node_modules - packages/react-instantsearch/node_modules - packages/react-instantsearch-theme-algolia/node_modules +env: + global: + - ARGOS_TOKEN=da82cbbe3add183c6adb18f5c61da515d9bf99dd diff --git a/docgen/assets/js/sidebar.js b/docgen/assets/js/sidebar.js index 039fbbe1ce..bb9cd76224 100644 --- a/docgen/assets/js/sidebar.js +++ b/docgen/assets/js/sidebar.js @@ -32,7 +32,8 @@ function sidebarFollowScroll(sidebarContainer) { sidebarContainer.style.top = null; } sidebarContainer.classList.add('fixed'); - linksContainer.style.maxHeight = `calc(100vh - ${titleHeight + navHeight}px)`; + linksContainer.style.maxHeight = `calc(100vh - ${titleHeight + + navHeight}px)`; } else { sidebarContainer.classList.remove('fixed'); linksContainer.style.maxHeight = ''; @@ -78,7 +79,7 @@ function scrollSpy(sidebarContainer, headersContainer) { // then we take the closest to this position as reference .sort( (header1, header2) => - (Math.abs(header1.rect.top) < Math.abs(header2.rect.top) ? -1 : 1) + Math.abs(header1.rect.top) < Math.abs(header2.rect.top) ? -1 : 1 ); if (headers[0] && highestVisibleHeaders.length === 0) { diff --git a/docgen/plugins/jsdoc-data.js b/docgen/plugins/jsdoc-data.js index c8c638aa8b..8a0f50f6c5 100644 --- a/docgen/plugins/jsdoc-data.js +++ b/docgen/plugins/jsdoc-data.js @@ -10,9 +10,9 @@ export default function() { return function(files, metalsmith, done) { const allFilles = Object.entries(files).reduce( (memo, [filename, file]) => - (/\.jsdoc$/.test(filename) + /\.jsdoc$/.test(filename) ? [...memo, { filename: filename.replace(/\.jsdoc$/, ''), ...file }] - : memo), + : memo, [] ); @@ -80,9 +80,9 @@ export default function() { stats: fileFromMetalsmith && fileFromMetalsmith.stats, filename: fileFromMetalsmith && fileFromMetalsmith.filename, title, - mainTitle: `${data.kind - .charAt(0) - .toUpperCase()}${data.kind.slice(1)}s`, // + mainTitle: `${data.kind.charAt(0).toUpperCase()}${data.kind.slice( + 1 + )}s`, // withHeadings: false, layout: `${data.kind}.pug`, category: data.kind, diff --git a/docgen/plugins/onlyChanged.js b/docgen/plugins/onlyChanged.js index 88b823fd98..3a7102df73 100644 --- a/docgen/plugins/onlyChanged.js +++ b/docgen/plugins/onlyChanged.js @@ -17,10 +17,10 @@ const cssFiles = join(__dirname, '../src/stylesheets/**/*'); const CSSEntryPoints = ['stylesheets/index.css', 'stylesheets/header.css']; export const hasChanged = file => - (file.stats && file.stats.ctime && file.stats.mtime + file.stats && file.stats.ctime && file.stats.mtime ? Date.parse(file.stats.ctime) > lastRunTime || Date.parse(file.stats.mtime) > lastRunTime - : true); + : true; export default function onlyChanged(files, metalsmith, cb) { if (lastRunTime === false) { diff --git a/docgen/plugins/webpackEntryMetadata.js b/docgen/plugins/webpackEntryMetadata.js index d924fe5599..f50b296e14 100644 --- a/docgen/plugins/webpackEntryMetadata.js +++ b/docgen/plugins/webpackEntryMetadata.js @@ -5,7 +5,8 @@ export default function webpackEntryMetadata(webpackConfig) { const assets = Object.keys(webpackConfig.entry).reduce( (memo, entryName) => ({ ...memo, - [`${entryName}.js`]: `${webpackConfig.output.publicPath}${entryName}.js`, + [`${entryName}.js`]: `${webpackConfig.output + .publicPath}${entryName}.js`, }), {} ); diff --git a/docgen/src/examples/default-theme/App.js b/docgen/src/examples/default-theme/App.js index 4bad010cda..ba37f04174 100644 --- a/docgen/src/examples/default-theme/App.js +++ b/docgen/src/examples/default-theme/App.js @@ -19,7 +19,7 @@ import { import { withUrlSync } from '../urlSync'; import 'react-instantsearch-theme-algolia/style.scss'; -const App = props => ( +const App = props => ( - -); + ; -const Header = () => ( +const Header = () =>
( /> -
-); + ; -const Facets = () => ( +const Facets = () => -); + ; -const SideBarSection = ({ title, children }) => ( +const SideBarSection = ({ title, children }) =>
{title}
{children} -
-); + ; const Hit = ({ hit }) => { const icons = []; diff --git a/docgen/src/examples/e-commerce-infinite/App.js b/docgen/src/examples/e-commerce-infinite/App.js index f1e7cff44b..ce2acea128 100644 --- a/docgen/src/examples/e-commerce-infinite/App.js +++ b/docgen/src/examples/e-commerce-infinite/App.js @@ -39,7 +39,7 @@ export default function App() { ); } -const Header = () => ( +const Header = () =>
( aeki -
-); + ; -const Facets = () => ( +const Facets = () => -); + ; -const CustomSearchBox = ({ currentRefinement, refine }) => ( +const CustomSearchBox = ({ currentRefinement, refine }) =>
( -
-); + ; const ColorItem = ({ item, createURL, refine }) => { const active = item.isRefined ? 'checked' : ''; @@ -138,19 +135,19 @@ const ColorItem = ({ item, createURL, refine }) => { }; const CustomColorRefinementList = ({ items, refine, createURL }) => - (items.length > 0 + items.length > 0 ?
Colors
- {items.map(item => ( + {items.map(item => - ))} + )}
- : null); + : null; function CustomHits({ hits, refine, hasMore }) { const loadMoreButton = hasMore diff --git a/docgen/src/examples/e-commerce/App.js b/docgen/src/examples/e-commerce/App.js index 989caf939c..248771490c 100644 --- a/docgen/src/examples/e-commerce/App.js +++ b/docgen/src/examples/e-commerce/App.js @@ -24,7 +24,7 @@ import { import { withUrlSync } from '../urlSync'; import 'react-instantsearch-theme-algolia/style.scss'; -const App = props => ( +const App = props => ( - -); + ; -const Header = () => ( +const Header = () =>
( aeki -
-); + ; -const Facets = () => ( +const Facets = () => -); + ; -const CustomSearchBox = ({ currentRefinement, refine }) => ( +const CustomSearchBox = ({ currentRefinement, refine }) =>
( -
-); + ; const ColorItem = ({ item, createURL, refine }) => { const active = item.isRefined ? 'checked' : ''; @@ -141,19 +137,19 @@ const ColorItem = ({ item, createURL, refine }) => { }; const CustomColorRefinementList = ({ items, refine, createURL }) => - (items.length > 0 + items.length > 0 ?
Colors
- {items.map(item => ( + {items.map(item => - ))} + )}
- : null); + : null; function CustomHits({ hits }) { return ( diff --git a/docgen/src/examples/material-ui/App.js b/docgen/src/examples/material-ui/App.js index 4da6717ce9..ff7574054c 100644 --- a/docgen/src/examples/material-ui/App.js +++ b/docgen/src/examples/material-ui/App.js @@ -37,14 +37,13 @@ import { withUrlSync } from '../urlSync'; injectTapEventPlugin(); -const App = props => ( +const App = props => - -); + ; const isMobile = window.innerWidth < 450; -const MaterialUiExample = props => ( +const MaterialUiExample = props => ( > - -); + ; class Content extends React.Component { constructor() { @@ -190,7 +188,7 @@ const MaterialUiSearchBox = ({ currentRefinement, refine }) => { ); }; -const CheckBoxItem = ({ item, refine }) => ( +const CheckBoxItem = ({ item, refine }) => ( }} /> } - /> -); + />; const MaterialUiCheckBoxRefinementList = ({ items, attributeName, refine, createURL, -}) => ( +}) => {attributeName.toUpperCase()} - {items.map(item => ( + {items.map(item => - ))} - -); + )} + ; const MaterialUiNestedList = function({ id, items, refine }) { return ( @@ -232,7 +228,7 @@ const MaterialUiNestedList = function({ id, items, refine }) { {id.toUpperCase()} {items.map((item, idx) => { const nestedElements = item.items - ? item.items.map((child, childIdx) => ( + ? item.items.map((child, childIdx) => - )) + ) : []; return ( - {this.props.items.map(item => ( + {this.props.items.map(item => - ))} + )} ); } @@ -318,7 +314,7 @@ function CustomHits({ hits, marginLeft, hasMore, refine }) { return (
- {hits.map((hit, idx) => ( + {hits.map((hit, idx) => } @@ -343,7 +339,7 @@ function CustomHits({ hits, marginLeft, hasMore, refine }) { titleStyle={{ fontSize: 16 }} /> - ))} + )}
( +const App = props => ( - -); + ; -const Header = () => ( +const Header = () =>
( You -
-); + ; -const SearchBox = connectSearchBox(({ currentRefinement, refine }) => ( +const SearchBox = connectSearchBox(({ currentRefinement, refine }) =>
(
-)); +); -const Facets = () => ( +const Facets = () =>
- -); + ; -const Panel = ({ title, children, id }) => ( +const Panel = ({ title, children, id }) =>
{title}
{children} -
-); +
; -const Star = ({ active }) => ( - -); +const Star = ({ active }) => + ; const Stars = ({ rating }) => { const stars = []; for (let i = 1; i <= 5; ++i) { @@ -113,11 +108,10 @@ const Stars = ({ rating }) => { ); }; const Genre = ({ name }) => {name}; -const Genres = ({ genres }) => ( +const Genres = ({ genres }) =>

{genres.map((genre, idx) => )} -

-); +

; const Hit = hit => { const { image, rating, year, genre } = hit.hit; @@ -141,18 +135,18 @@ const Hit = hit => { ); }; -const Results = connectSearchBox(() => ( +const Results = connectSearchBox(() =>

-)); +); const RefinementListLinks = connectRefinementList( ({ items, refine, createURL }) => { - const hitComponents = items.map(item => ( + const hitComponents = items.map(item => - )); + ); return (
diff --git a/docgen/src/examples/tourism/App.js b/docgen/src/examples/tourism/App.js index c3be622934..627d8be8a0 100644 --- a/docgen/src/examples/tourism/App.js +++ b/docgen/src/examples/tourism/App.js @@ -22,7 +22,7 @@ import Rheostat from 'rheostat'; import { withUrlSync } from '../urlSync'; -const App = props => ( +const App = props => (
- -); + ; function Header() { return ( @@ -133,9 +132,9 @@ function HitsMap({ hits }) { const boundsConfig = hits.length > 0 ? fitBounds(boundingPoints, availableSpace) : {}; - const markers = hits.map(hit => ( + const markers = hits.map(hit => - )); + ); const options = { minZoomOverride: true, minZoom: 2, diff --git a/docgen/src/examples/urlSync.js b/docgen/src/examples/urlSync.js index 5049aa8a77..676683a151 100644 --- a/docgen/src/examples/urlSync.js +++ b/docgen/src/examples/urlSync.js @@ -3,39 +3,38 @@ import qs from 'qs'; const updateAfter = 700; const searchStateToUrl = searchState => - (searchState - ? `${window.location.pathname}?${qs.stringify(searchState)}` - : ''); + searchState ? `${window.location.pathname}?${qs.stringify(searchState)}` : ''; -export const withUrlSync = App => class urlSync extends Component { - constructor() { - super(); - this.state = { searchState: qs.parse(window.location.search.slice(1)) }; - window.addEventListener('popstate', ({ state: searchState }) => - this.setState({ searchState }) - ); - } +export const withUrlSync = App => + class urlSync extends Component { + constructor() { + super(); + this.state = { searchState: qs.parse(window.location.search.slice(1)) }; + window.addEventListener('popstate', ({ state: searchState }) => + this.setState({ searchState }) + ); + } + + onSearchStateChange = searchState => { + clearTimeout(this.debouncedSetState); + this.debouncedSetState = setTimeout(() => { + window.history.pushState( + searchState, + null, + searchStateToUrl(searchState) + ); + }, updateAfter); + this.setState({ searchState }); + }; - onSearchStateChange = searchState => { - clearTimeout(this.debouncedSetState); - this.debouncedSetState = setTimeout(() => { - window.history.pushState( - searchState, - null, - searchStateToUrl(searchState) + render() { + return ( + ); - }, updateAfter); - this.setState({ searchState }); + } }; - - render() { - return ( - - ); - } -}; diff --git a/docgen/syntaxHighlighting.js b/docgen/syntaxHighlighting.js index c0357cde1c..92e5bf4f97 100644 --- a/docgen/syntaxHighlighting.js +++ b/docgen/syntaxHighlighting.js @@ -23,7 +23,10 @@ export default function highlight(source, lang) { return; } - tokenizedSource += `${text}`; + tokenizedSource += `${text}`; }); return `
diff --git a/package.json b/package.json
index e70a26534a..59de03e158 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,8 @@
     "docs:doctoc": "doctoc --maxlevel 1 README.md",
     "test": "./scripts/test.sh",
     "test:build": "./scripts/test:build.sh",
+    "test:regressions": "webpack --config test/regressions/webpack.config.js && rm -rf test/screenshots && happo run && babel-node ./test/regressions/normalize.js",
+    "argos": "argos upload test/screenshots --token $ARGOS_TOKEN || true",
     "dev": "jest --watch --bail",
     "docs:storybook-start": "NODE_ENV=development start-storybook -p 6006 -c ./storybook -s ./storybook/public",
     "docs:storybook-build-production": "NODE_ENV=development build-storybook -s ./storybook/public -o docs-production/react-instantsearch/storybook -c ./storybook",
@@ -34,6 +36,7 @@
     "@storybook/addons": "^3.1.2",
     "@storybook/react": "^3.1.3",
     "@storybook/ui": "^3.1.3",
+    "argos-cli": "^0.0.8",
     "async": "^2.4.1",
     "autoprefixer": "^7.1.1",
     "babel-cli": "^6.24.1",
@@ -67,9 +70,13 @@
     "eslint-plugin-jasmine": "^2.3.0",
     "eslint-plugin-jest": "^20.0.3",
     "eslint-plugin-react": "^7.1.0",
+    "fs-extra": "^3.0.1",
     "gh-pages": "^1.0.0",
     "glob": "^7.1.2",
     "google-map-react": "^0.24.0",
+    "happo": "^5.0.0-rc.3",
+    "happo-core": "^5.0.0-rc.2",
+    "happo-target-firefox": "^5.0.0-rc.6",
     "happypack": "^4.0.0-beta.1",
     "hasha": "^3.0.0",
     "husky": "^0.13.4",
diff --git a/packages/react-instantsearch-theme-algolia/styles/_Toggle.scss b/packages/react-instantsearch-theme-algolia/styles/_Toggle.scss
index 58da0a57b5..da0871e340 100644
--- a/packages/react-instantsearch-theme-algolia/styles/_Toggle.scss
+++ b/packages/react-instantsearch-theme-algolia/styles/_Toggle.scss
@@ -57,4 +57,4 @@
       border-color: darken($main-color, 7%);
     }
   }
-}
\ No newline at end of file
+}
diff --git a/packages/react-instantsearch/examples/autocomplete/src/App-Mentions.js b/packages/react-instantsearch/examples/autocomplete/src/App-Mentions.js
index b687f19588..efd82a7d70 100644
--- a/packages/react-instantsearch/examples/autocomplete/src/App-Mentions.js
+++ b/packages/react-instantsearch/examples/autocomplete/src/App-Mentions.js
@@ -5,7 +5,7 @@ import 'antd/lib/mention/style/css';
 import { InstantSearch } from 'react-instantsearch/dom';
 import { connectAutoComplete } from 'react-instantsearch/connectors';
 
-const AsyncMention = ({ hits, refine }) => (
+const AsyncMention = ({ hits, refine }) =>
    (
     placeholder="give someone an @-mention here"
     suggestions={hits.map(hit => hit.name)}
     onSearchChange={query => refine(query)}
-  />
-);
+  />;
 
 AsyncMention.propTypes = {
   hits: PropTypes.array,
@@ -23,14 +22,13 @@ AsyncMention.propTypes = {
 
 const ConnectedAsyncMention = connectAutoComplete(AsyncMention);
 
-const App = () => (
+const App = () =>
   
     
-  
-);
+  ;
 
 export default App;
diff --git a/packages/react-instantsearch/examples/autocomplete/src/App-Multi-Index.js b/packages/react-instantsearch/examples/autocomplete/src/App-Multi-Index.js
index 073c13795c..7c66ab2328 100644
--- a/packages/react-instantsearch/examples/autocomplete/src/App-Multi-Index.js
+++ b/packages/react-instantsearch/examples/autocomplete/src/App-Multi-Index.js
@@ -4,7 +4,7 @@ import { connectAutoComplete } from 'react-instantsearch/connectors';
 import Autosuggest from 'react-autosuggest';
 import 'react-instantsearch-theme-algolia/style.css';
 
-const App = () => (
+const App = () =>
    (
     
     
     
-  
-);
+  ;
 
 const AutoComplete = connectAutoComplete(
-  ({ hits, currentRefinement, refine }) => (
+  ({ hits, currentRefinement, refine }) =>
      refine(value)}
       onSuggestionsClearRequested={() => refine('')}
       getSuggestionValue={hit => hit.name}
-      renderSuggestion={hit => (
+      renderSuggestion={hit =>
         
{hit.name}
-
- )} +
} inputProps={{ placeholder: 'Type a product', value: currentRefinement, @@ -38,7 +36,6 @@ const AutoComplete = connectAutoComplete( renderSectionTitle={section => section.index} getSectionSuggestions={section => section.hits} /> - ) ); export default App; diff --git a/packages/react-instantsearch/examples/geo-search/src/App.js b/packages/react-instantsearch/examples/geo-search/src/App.js index 70fc778df0..88bc150ddf 100644 --- a/packages/react-instantsearch/examples/geo-search/src/App.js +++ b/packages/react-instantsearch/examples/geo-search/src/App.js @@ -10,9 +10,7 @@ import qs from 'qs'; const updateAfter = 700; const searchStateToUrl = searchState => - (searchState - ? `${window.location.pathname}?${qs.stringify(searchState)}` - : ''); + searchState ? `${window.location.pathname}?${qs.stringify(searchState)}` : ''; class App extends Component { constructor() { @@ -71,7 +69,8 @@ class App extends Component { onSearchStateChange={this.onSearchStateChange} > {configuration} - Either type a destination or click somewhere on the map to see the closest apartment. + Either type a destination or click somewhere on the map to see the + closest apartment.
@@ -132,9 +131,9 @@ function HitsMap({ hits, onLatLngChange }) { const boundsConfig = hits.length > 0 ? fitBounds(boundingPoints, availableSpace) : {}; - const markers = hits.map(hit => ( + const markers = hits.map(hit => - )); + ); const options = { minZoomOverride: true, minZoom: 2, diff --git a/packages/react-instantsearch/examples/multi-index/src/App.js b/packages/react-instantsearch/examples/multi-index/src/App.js index efa326f784..6a6654c78f 100644 --- a/packages/react-instantsearch/examples/multi-index/src/App.js +++ b/packages/react-instantsearch/examples/multi-index/src/App.js @@ -2,7 +2,7 @@ import React from 'react'; import { InstantSearch, Hits, SearchBox, Index } from 'react-instantsearch/dom'; import 'react-instantsearch-theme-algolia/style.css'; -const App = () => ( +const App = () => (

Results in second dataset

-
-); + ; export default App; diff --git a/packages/react-instantsearch/examples/react-native/src/Categories.js b/packages/react-instantsearch/examples/react-native/src/Categories.js index 70c4ee4f7f..ae4f0a3d11 100644 --- a/packages/react-instantsearch/examples/react-native/src/Categories.js +++ b/packages/react-instantsearch/examples/react-native/src/Categories.js @@ -186,15 +186,14 @@ class Menu extends Component { ); }; - _renderSeparator = (sectionID, rowID, adjacentRowHighlighted) => ( + _renderSeparator = (sectionID, rowID, adjacentRowHighlighted) => - ); + />; } Menu.propTypes = { diff --git a/packages/react-instantsearch/examples/react-native/src/Filters.js b/packages/react-instantsearch/examples/react-native/src/Filters.js index f129bbbc39..f0736bffa7 100644 --- a/packages/react-instantsearch/examples/react-native/src/Filters.js +++ b/packages/react-instantsearch/examples/react-native/src/Filters.js @@ -108,12 +108,14 @@ class Refinements extends React.Component { Price: { attributeName: 'price', value: item => - `From ${item.currentRefinement.min}$ to ${item.currentRefinement.max}$`, + `From ${item.currentRefinement.min}$ to ${item.currentRefinement + .max}$`, }, Rating: { attributeName: 'rating', value: item => - `From ${item.currentRefinement.min} stars to ${item.currentRefinement.max} stars`, + `From ${item.currentRefinement.min} stars to ${item.currentRefinement + .max} stars`, }, ClearAll: { attributeName: 'clearAll', @@ -159,15 +161,14 @@ class Refinements extends React.Component { return {filtersRow}; }; - _renderSeparator = (sectionID, rowId, adjacentRowHighlighted) => ( + _renderSeparator = (sectionID, rowId, adjacentRowHighlighted) => - ); + />; render() { const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2, diff --git a/packages/react-instantsearch/examples/react-native/src/Home.js b/packages/react-instantsearch/examples/react-native/src/Home.js index 5190ea7047..0bdb18191c 100644 --- a/packages/react-instantsearch/examples/react-native/src/Home.js +++ b/packages/react-instantsearch/examples/react-native/src/Home.js @@ -232,7 +232,7 @@ class Hits extends Component { return hits; } - _renderRow = (hit, sectionId, rowId) => ( + _renderRow = (hit, sectionId, rowId) => @@ -264,18 +264,16 @@ class Hits extends Component { - - ); + ; - _renderSeparator = (sectionID, rowID, adjacentRowHighlighted) => ( + _renderSeparator = (sectionID, rowID, adjacentRowHighlighted) => - ); + />; } Hits.propTypes = { @@ -285,9 +283,9 @@ Hits.propTypes = { }; const ConnectedHits = connectInfiniteHits(Hits); -const ConnectedStats = connectStats(({ nbHits }) => ( +const ConnectedStats = connectStats(({ nbHits }) => {nbHits} products found -)); +); const ConnectedSortBy = connectSortBy( ({ refine, items, currentRefinement }) => { @@ -341,7 +339,7 @@ const ConnectedSortBy = connectSortBy( ); const Filters = connectCurrentRefinements( - ({ items, searchState, onSearchStateChange }) => ( + ({ items, searchState, onSearchStateChange }) =>
- )) + ) :