[#147,widget/filtereditor][s]: setting of term filter value and removal of filter working again (and tested!) - fixes #147.

This commit is contained in:
Rufus Pollock
2012-06-07 00:18:08 +01:00
parent ed734d90e4
commit 9b583b8397
2 changed files with 22 additions and 7 deletions

View File

@@ -13,14 +13,29 @@ test('basics', function () {
ok(!view.el.find('.js-add-filter').is(":visible"));
ok($addForm.is(":visible"));
// submit the form
$addForm.find('select.fields').val('country');
$addForm.submit();
// now check we have new filter
ok(!$addForm.is(":visible"));
$editForm = view.el.find('form.js-edit');
equal($editForm.find('.filter-term').length, 1)
equal(_.keys(dataset.queryState.attributes.filters[0].term)[0], 'country');
// now set filter value and apply
$editForm.find('input').val('UK');
$editForm.submit();
equal(dataset.queryState.attributes.filters[0].term.country, 'UK');
equal(dataset.currentRecords.length, 3);
// now remove filter
$editForm.find('.js-remove-filter').click();
// hmmm, not working yet but works by eye!
// $editForm = view.el.find('form.js-edit');
// equal($editForm.find('.filter-term').length, 0)
// equal(dataset.currentRecords.length, 6);
view.remove();
});