1cbd9db0 by Adam Heath

Fix test cases when the singleton facet instance change was previously

implemented.
1 parent 65fd1e2a
...@@ -225,7 +225,7 @@ define(function(require) { ...@@ -225,7 +225,7 @@ define(function(require) {
225 var f; 225 var f;
226 beforeEach(function() { 226 beforeEach(function() {
227 if (typeof builder.nameOrBuilder === 'string') { 227 if (typeof builder.nameOrBuilder === 'string') {
228 f = SolrSpecData.facetsBuilder(builder.nameOrBuilder); 228 f = SolrSpecData.facetsInstance(builder.nameOrBuilder);
229 } else { 229 } else {
230 f = builder.nameOrBuilder(); 230 f = builder.nameOrBuilder();
231 } 231 }
......
...@@ -24,7 +24,7 @@ define(function(require) { ...@@ -24,7 +24,7 @@ define(function(require) {
24 _.now = function() { return new Date().getTime(); }; 24 _.now = function() { return new Date().getTime(); };
25 spyOn(Backbone, 'ajax'); 25 spyOn(Backbone, 'ajax');
26 onItemChange = jasmine.createSpy('onItemChange'); 26 onItemChange = jasmine.createSpy('onItemChange');
27 f = new Facets(SolrSpecData.facetsBuilder(), {search: {url: '/'}}); 27 f = new Facets(SolrSpecData.facetsInstance(), {search: {url: '/'}});
28 f.on('item-change', onItemChange); 28 f.on('item-change', onItemChange);
29 }); 29 });
30 afterEach(function() { 30 afterEach(function() {
......
...@@ -357,6 +357,17 @@ define(function(require) { ...@@ -357,6 +357,17 @@ define(function(require) {
357 357
358 function facetsBuilder(wantedFacetName) { 358 function facetsBuilder(wantedFacetName) {
359 if (wantedFacetName) { 359 if (wantedFacetName) {
360 return {data: definedFacets[wantedFacetName].facetData, options: definedFacets[wantedFacetName].facetOptions};
361 }
362 var result = {};
363 _.each(_.keys(definedFacets), function(facetName) {
364 result[facetName] = {data: definedFacets[facetName].facetData, options: definedFacets[facetName].facetOptions};
365 });
366 return result;
367 }
368
369 function facetsInstance(wantedFacetName) {
370 if (wantedFacetName) {
360 return new Facet(definedFacets[wantedFacetName].facetData, definedFacets[wantedFacetName].facetOptions); 371 return new Facet(definedFacets[wantedFacetName].facetData, definedFacets[wantedFacetName].facetOptions);
361 } 372 }
362 var result = {}; 373 var result = {};
...@@ -440,6 +451,7 @@ define(function(require) { ...@@ -440,6 +451,7 @@ define(function(require) {
440 testSearchBuilder: testSearchBuilder, 451 testSearchBuilder: testSearchBuilder,
441 expectItem: expectItem, 452 expectItem: expectItem,
442 facetsBuilder: facetsBuilder, 453 facetsBuilder: facetsBuilder,
454 facetsInstance: facetsInstance,
443 responses: responses, 455 responses: responses,
444 extractFacetData: extractFacetData, 456 extractFacetData: extractFacetData,
445 }; 457 };
......