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) {
var f;
beforeEach(function() {
if (typeof builder.nameOrBuilder === 'string') {
f = SolrSpecData.facetsBuilder(builder.nameOrBuilder);
f = SolrSpecData.facetsInstance(builder.nameOrBuilder);
} else {
f = builder.nameOrBuilder();
}
......
......@@ -24,7 +24,7 @@ define(function(require) {
_.now = function() { return new Date().getTime(); };
spyOn(Backbone, 'ajax');
onItemChange = jasmine.createSpy('onItemChange');
f = new Facets(SolrSpecData.facetsBuilder(), {search: {url: '/'}});
f = new Facets(SolrSpecData.facetsInstance(), {search: {url: '/'}});
f.on('item-change', onItemChange);
});
afterEach(function() {
......
......@@ -357,6 +357,17 @@ define(function(require) {
function facetsBuilder(wantedFacetName) {
if (wantedFacetName) {
return {data: definedFacets[wantedFacetName].facetData, options: definedFacets[wantedFacetName].facetOptions};
}
var result = {};
_.each(_.keys(definedFacets), function(facetName) {
result[facetName] = {data: definedFacets[facetName].facetData, options: definedFacets[facetName].facetOptions};
});
return result;
}
function facetsInstance(wantedFacetName) {
if (wantedFacetName) {
return new Facet(definedFacets[wantedFacetName].facetData, definedFacets[wantedFacetName].facetOptions);
}
var result = {};
......@@ -440,6 +451,7 @@ define(function(require) {
testSearchBuilder: testSearchBuilder,
expectItem: expectItem,
facetsBuilder: facetsBuilder,
facetsInstance: facetsInstance,
responses: responses,
extractFacetData: extractFacetData,
};
......