Skip to content

Commit

Permalink
Merge pull request #1012 from searchspring/develop
Browse files Browse the repository at this point in the history
Release v0.52.2
  • Loading branch information
korgon authored Mar 18, 2024
2 parents c9651b7 + dbc631d commit 7589d7e
Show file tree
Hide file tree
Showing 8 changed files with 3,356 additions and 313 deletions.
1 change: 0 additions & 1 deletion packages/snap-preact-demo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import './styles/custom.scss';
*/

let siteId = '8uyt2m';
// let siteId = 'z7h1jh';

// grab siteId out of the URL
const urlObj = url(window.location.href);
Expand Down
237 changes: 0 additions & 237 deletions packages/snap-preact-demo/src/middleware/plugins/afterSearch.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
describe('Middleware Test', () => {
it('can modify core mappings and render them', () => {
cy.on('window:before:load', (win) => {
win.mergeSnapConfig = {
controllers: {
search: [
{
config: {
middleware: {
afterStore: ({ controller }) => {
controller.store.results.forEach((result) => {
(result.mappings.core.name = '!!!'), (result.mappings.core.price = 9.99);
});
},
},
},
},
],
},
};
});
cy.visit('https://localhost:2222/');

cy.snapController().then(({ store }) => {
store.results.forEach((result) => {
// ensure store contains correct values
expect(result.mappings.core.name).to.equal('!!!');
expect(result.mappings.core.price).to.equal(9.99);

expect(result.display.mappings.core.name).to.equal('!!!');
expect(result.display.mappings.core.price).to.equal(9.99);
});
});

// ensure elements rendered with correct middleware
cy.get('.ss__result .ss__result__details__title').should('contain.text', '!!!');
cy.get('.ss__result .ss__result__price').should('contain.text', '$9.99');
});
});
15 changes: 15 additions & 0 deletions packages/snap-shared/src/MockData/meta/z7h1jh/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"facets": {
"ss_price": { "multiple": "or", "display": "list", "label": "Price", "collapsed": true },
"ss_review_value": { "multiple": "or", "display": "list", "label": "Customer Rating", "collapsed": true },
"ss_tags_color": { "multiple": "or", "display": "palette", "label": "Color", "collapsed": true },
"tags_fit": { "multiple": "or", "display": "list", "label": "Fit", "collapsed": true },
"tags_gender": { "multiple": "or", "display": "list", "label": "Gender", "collapsed": true },
"tags_style": { "multiple": "or", "display": "list", "label": "Style", "collapsed": true },
"variant_inseam": { "multiple": "or", "display": "grid", "label": "Inseam", "collapsed": true },
"variant_size": { "multiple": "or", "display": "grid", "label": "Size", "collapsed": true },
"vendor": { "multiple": "or", "display": "list", "label": "Brand", "collapsed": false }
},
"sortOptions": [{ "type": "relevance", "field": "relevance", "direction": "desc", "label": "Best Match" }],
"pagination": { "defaultPageSize": 40 }
}
Loading

0 comments on commit 7589d7e

Please sign in to comment.