Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.52.2 #1012

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading