Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
fix: make all components SSR ready
Browse files Browse the repository at this point in the history
Closes: #259
  • Loading branch information
rayrutjes committed Aug 8, 2017
1 parent 71a511b commit 4db0720
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/Rating.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default {
blockClassName: 'ais-rating',
};
},
mounted() {
created() {
this.searchStore.addFacet(this.attributeName, FACET_OR);
},
destroyed() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/RefinementList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
blockClassName: 'ais-refinement-list',
};
},
mounted() {
created() {
this.searchStore.addFacet(this.attributeName, this.operator);
},
destroyed() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Results.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
blockClassName: 'ais-results',
};
},
mounted() {
created() {
this.updateResultsPerPage();
},
watch: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ResultsPerPageSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
},
},
},
mounted() {
created() {
if (this.options.indexOf(this.searchStore.resultsPerPage) === -1) {
this.searchStore.resultsPerPage = this.options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TreeMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
blockClassName: 'ais-tree-menu',
};
},
mounted() {
created() {
this.searchStore.addFacet(
{
name: this.attribute,
Expand Down
4 changes: 1 addition & 3 deletions src/components/__tests__/menu-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,13 @@ test('should add a tree facet to the store when mounted', () => {
const Component = Vue.extend(TreeMenu);
const addFacetMock = jest.fn();
const store = Object.assign({}, searchStore, { addFacet: addFacetMock });
const vm = new Component({
new Component({ // eslint-disable-line
propsData: {
attributes: ['category.lvl1', 'category.lvl2'],
searchStore: store,
},
});

expect(addFacetMock).not.toBeCalled();
vm.$mount();
expect(addFacetMock).toBeCalledWith(
{
name: 'tree-menu',
Expand Down
5 changes: 1 addition & 4 deletions src/components/__tests__/refinement-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,12 @@ test('should add a facet to the store when mounted', () => {
const Component = Vue.extend(RefinementList);
const addFacetMock = jest.fn();
const store = Object.assign({}, searchStore, { addFacet: addFacetMock });
const vm = new Component({
new Component({ // eslint-disable-line
propsData: {
attributeName: 'color',
searchStore: store,
},
});

expect(addFacetMock).not.toBeCalled();
vm.$mount();
expect(addFacetMock).toBeCalledWith('color', 'or');
});

Expand Down

0 comments on commit 4db0720

Please sign in to comment.