Skip to content

Commit

Permalink
feat(refinementList): add escapeFacetHits parameter (#2507)
Browse files Browse the repository at this point in the history
* chore(sffv): confirm #2474
* feat(sffv): implement XSS escape on search for facet values
* feat(refinementList): add escapeFacetHits
* chore(deps): update AlgoliaSearch Helper
* chore(doc): add new options
* chore(dev-novel): add a story for just escaping the values
* chore: fix code style
* chore(test): rm sinon of connectRefinementList test
* chore(test): clean up setImmmediate from connectRefinementList test
* refactor(refinement-list): use Boolean to convert escapeFacetValues
* chore(test): cleanup all setImmediate
* chore(test): use consise API when possible
  • Loading branch information
bobylito authored Oct 25, 2017
1 parent c7c0e69 commit 9b1b7ee
Show file tree
Hide file tree
Showing 7 changed files with 421 additions and 43 deletions.
52 changes: 52 additions & 0 deletions dev/app/init-builtin-widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,58 @@ export default () => {
})
);
})
)
.add(
'escape the facet values',
wrapWithHits(container => {
window.search.addWidget(
instantsearch.widgets.refinementList({
container,
attributeName: 'brand',
operator: 'or',
limit: 10,
templates: {
header: 'Searchable brands',
},
searchForFacetValues: {
placeholder: 'Find other brands...',
escapeFacetValues: true,
},
})
);
})
)
.add(
'with a hits widget with escapeHits set to true',
wrapWithHits(container => {
const list = document.createElement('div');
const hits = document.createElement('div');
container.appendChild(hits);
container.appendChild(list);
window.search.addWidget(
instantsearch.widgets.hits({
container: hits,
templates: {
item: '',
},
escapeHits: true,
})
);
window.search.addWidget(
instantsearch.widgets.refinementList({
container: list,
attributeName: 'brand',
operator: 'or',
limit: 10,
templates: {
header: 'Searchable brands',
},
searchForFacetValues: {
placeholder: 'Find other brands...',
},
})
);
})
);

storiesOf('StarRating').add(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
},
"dependencies": {
"algoliasearch": "^3.24.0",
"algoliasearch-helper": "^2.22.0",
"algoliasearch-helper": "^2.23.0",
"classnames": "^2.2.5",
"events": "^1.1.0",
"hogan.js": "^3.0.2",
Expand Down
Loading

0 comments on commit 9b1b7ee

Please sign in to comment.