fix matching enable issue in filter manager, add test

This commit is contained in:
Joe Fleming 2015-04-29 15:41:31 -07:00
parent 0a9e50be2e
commit 7955cf61ff
2 changed files with 15 additions and 1 deletions

View file

@ -29,8 +29,8 @@ define(function (require) {
});
if (existing) {
existing.meta.disabled = false;
if (existing.meta.negate !== negate) {
// existing.meta.negate = negate;
queryFilter.invertFilter(existing);
}
return;

View file

@ -66,6 +66,20 @@ define(function (require) {
expect(appState.filters[1].meta.negate).to.be(true);
});
it('should enable matching filters being changed', function () {
_.each([true, false], function (negate) {
appState.filters = [{
query: { match: { myField: { query: 1 } } },
meta: { disabled: true, negate: negate }
}];
expect(appState.filters.length).to.be(1);
expect(appState.filters[0].meta.disabled).to.be(true);
filterManager.add('myField', 1, '+', 'myIndex');
expect(appState.filters.length).to.be(1);
expect(appState.filters[0].meta.disabled).to.be(false);
});
});
});
});