Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/core/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ describe("utils", function () {
'{"criteria":[{"i":"SearchableText","o":"plone.app.querystring.operation.string.contains","v":"foobar*"}],"sort_on":"is_folderish","sort_order":"reverse"}'
);
});
it("getCriterias keeps non-ASCII term raw (encode-exactly-once)", function () {
var qh = new utils.QueryHelper({
vocabularyUrl: "http://foobar.com/",
});
var criterias = qh.getCriterias("täst");
expect(criterias[0].v).toEqual("täst*");
expect(criterias[0].v).not.toContain("%");
});
it("getQueryData use attributes correctly", function () {
var qh = new utils.QueryHelper({
vocabularyUrl: "http://foobar.com/",
Expand Down Expand Up @@ -166,7 +174,15 @@ describe("utils", function () {
"http://foobar.com/?foo=bar&query=%7B%22criteria%22%3A%5B%5D%2C%22sort_on%22%3A%22is_folderish%22%2C%22sort_order%22%3A%22reverse%22%7D&attributes=%5B%22UID%22%2C%22Title%22%2C%22Description%22%2C%22getURL%22%2C%22portal_type%22%5D"
);
});

it("getCriterias keeps non-ASCII terms raw (encode-exactly-once)", function () {
var qh = new utils.QueryHelper({
vocabularyUrl: "http://foobar.com/",
});
var criterias = qh.getCriterias("täst");
var crit = criterias[criterias.length - 1];
expect(crit.v).toEqual("täst*");
expect(crit.v).not.toContain("%");
});
it("browsing adds path criteria", function () {
var qh = new utils.QueryHelper({
vocabularyUrl: "http://foobar.com/?foo=bar",
Expand Down
2 changes: 1 addition & 1 deletion src/pat/structure/js/views/textfilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default BaseView.extend({

setTerm: function (term, set_input) {
const term_el = this.$el[0].querySelector(".search-query");
this.term = encodeURIComponent(term);
this.term = term;
if (set_input) {
term_el.value = term;
}
Expand Down