summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJairo Llopis <yajo.sk8@gmail.com>2019-04-16 11:53:47 +0000
committerJairo Llopis <yajo.sk8@gmail.com>2019-04-16 11:53:47 +0000
commit94e35a19b3f7973c5ac3e2b0e6aca2facbb6eb07 (patch)
treec78884b307b2b8cfb07fdef829ae90b39ed0b862 /addons
parentecae2fc9ca319774afc75ecbae5899eb617a971b (diff)
[FIX] web: Trim spaces when selecting option by text
It's quite common that the `$().text()` method returns lots of random whitespaces at the beginning and end of the string. They're pretty unpredictable (extension views can add or remove them) and invisible to the end user. This code chunk should allow to select an `<option>` based on its raw text content, but most of them will just fail without this patch. And most chances are that current ones just work equally with this patch. This will make frontend tours more pleasant to write. closes odoo/odoo#32718 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/web_tour/static/src/js/running_tour_action_helper.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web_tour/static/src/js/running_tour_action_helper.js b/addons/web_tour/static/src/js/running_tour_action_helper.js
index 1c4df6c27db..ef958ef1d1f 100644
--- a/addons/web_tour/static/src/js/running_tour_action_helper.js
+++ b/addons/web_tour/static/src/js/running_tour_action_helper.js
@@ -87,7 +87,7 @@ var RunningTourActionHelper = core.Class.extend({
$options.prop("selected", false).removeProp("selected");
var $selectedOption = $options.filter(function () { return $(this).val() === text; });
if ($selectedOption.length === 0) {
- $selectedOption = $options.filter(function () { return $(this).text() === text; });
+ $selectedOption = $options.filter(function () { return $(this).text().trim() === text; });
}
$selectedOption.prop("selected", true);
this._click(values);