Commit 4030fcaf authored by S Anand's avatar S Anand

BUG: FormHandler Clear All should remove all params. Fixes #140 @pratap.vardhan

parent ed696e32
Pipeline #75842 passed with stage
in 2 minutes and 16 seconds
......@@ -327,7 +327,7 @@ Each template receives these variables:
_.each(args[key], function(col_name) {
var update = {}
update[key] = col_name
qparts.update(update) %>
qparts.update(update, 'add') %>
<a href="?<%- key %>=<%- col_name %>" data-mode="del" class="badge badge-pill badge-dark urlfilter" title="Clear <%- key %> filter">
<%- key %> = <%- col_name %>
</a>
......
......@@ -64,6 +64,7 @@
<div class="custom_buttons4" data-src="/formhandler-data"></div>
<div class="custom_buttons5" data-src="/formhandler-data"></div>
<div class="fh18" data-src="/formhandler-data"></div>
<div class="fh17" data-src="/formhandler-data"></div>
<div class="fh15" data-src="/formhandler-data"></div>
<div class="fh16" data-src="/formhandler-data"></div>
......@@ -538,6 +539,21 @@
t.end()
})
})
tape('$().formhandler() test clear all for multiple filters', function (t) {
window.history.pushState({}, '', '#')
window.history.pushState({}, '', '#' + g1.url.parse().update({ 'Continent': ['Asia', 'Europe'], _limit: 5 }).toString())
$('.fh18').formhandler()
.on('load', function () {
var filter_badges = $('.fh18 .filters a')
// First two links are the filters ?Continent=Asia and ?Continent=Europe
t.equal(filter_badges[0].text.trim(), 'Continent = Asia')
t.equal(filter_badges[1].text.trim(), 'Continent = Europe')
// 3rd link is the Clear All
t.equal(filter_badges[2].getAttribute('href'), '?Continent=Asia&Continent=Europe')
window.history.pushState({}, '', '#')
t.end()
})
})
// tape('$().formhandler() add new rows', function (t) {
// $('.fh_add1')
// .formhandler({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment