summaryrefslogtreecommitdiff
path: root/addons/web/static/tests
diff options
context:
space:
mode:
authormgh-odoo <mgh@odoo.com>2018-10-29 08:42:59 +0000
committermgh-odoo <mgh@odoo.com>2019-01-10 12:31:53 +0000
commit9ee9724a10fc5e835d8d42da0e9e83fe687848d8 (patch)
tree362c7afc5f90e1c90746df80835355793e55733f /addons/web/static/tests
parent80f3eb27f7a0ad0390eca6ac9b7bd03df71c4ec2 (diff)
[Generic] unaccent search
- added unaccent search on POS customer/partner and product - moved unaccent from "mail.utils" to "web.utils" - added more character to make function accurate We might use str.normalize(from ES6) but the problem is str.normalize method can not consider some double characters i.e. accented character when normalized it returns 2 normal characters and normalize method returns single character, so here custom unaccent method is used to normalize the string What we can improve here: We can use str.normalize method and check if string is still have unaccented charaters that we can call our unaccent method but this unaccent method is also working and performing well closes odoo/odoo#27671
Diffstat (limited to 'addons/web/static/tests')
-rw-r--r--addons/web/static/tests/core/util_tests.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/addons/web/static/tests/core/util_tests.js b/addons/web/static/tests/core/util_tests.js
index c7158083dcb..3dd0a54b5e3 100644
--- a/addons/web/static/tests/core/util_tests.js
+++ b/addons/web/static/tests/core/util_tests.js
@@ -55,6 +55,18 @@ QUnit.module('core', {}, function () {
assert.strictEqual(is_bin_size('64.2 Кб'), true);
});
+ QUnit.test('unaccent', function (assert) {
+ assert.expect(3);
+
+ var singleCharacters = utils.unaccent("ⱮɀꝾƶⱵȥ");
+ var doubledCharacters = utils.unaccent("DZDŽꝎꜩꝡƕ");
+ var caseSensetiveCharacters = utils.unaccent("ⱮɀꝾƶⱵȥ", true);
+
+ assert.strictEqual("mzgzhz", singleCharacters);
+ assert.strictEqual("dzdzootzvyhv", doubledCharacters);
+ assert.strictEqual("MzGzHz", caseSensetiveCharacters);
+ });
+
});
-}); \ No newline at end of file
+});