[#145,widget/fields,model][m]: working fields widget with field summary data generated by Dataset.getFieldsSummary function.

* Layout is still not right -- need to put widget in sidebar (though looks a lot better)
* Datset.getFieldsSummary to compute facets for fields
* Remove facet usage in the demo
This commit is contained in:
Rufus Pollock
2012-06-04 23:57:24 +01:00
parent a7b6a6ac5d
commit 58cac002dc
5 changed files with 103 additions and 16 deletions

View File

@@ -125,6 +125,21 @@ test('Dataset _prepareQuery', function () {
deepEqual(out, exp);
});
test('Dataset getFieldsSummary', function () {
var dataset = Fixture.getDataset();
dataset.getFieldsSummary().done(function() {
var countryField = dataset.fields.get('country');
var facet = countryField.facets.models[0];
equal(facet.get('terms').length, 3);
var exp = [
{ count: 3, term: 'UK' },
{ count: 2, term: 'DE' },
{ count: 1, term: 'US' }
];
deepEqual(facet.get('terms'), exp);
});
});
// =================================
// Query