summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/widgets/model_field_selector_tests.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/tests/widgets/model_field_selector_tests.js')
-rw-r--r--addons/web/static/tests/widgets/model_field_selector_tests.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/addons/web/static/tests/widgets/model_field_selector_tests.js b/addons/web/static/tests/widgets/model_field_selector_tests.js
index d92e41760dc..d331f898d42 100644
--- a/addons/web/static/tests/widgets/model_field_selector_tests.js
+++ b/addons/web/static/tests/widgets/model_field_selector_tests.js
@@ -50,7 +50,7 @@ QUnit.module('ModelFieldSelector', {
}, function () {
QUnit.test("creating a field chain from scratch", function (assert) {
- assert.expect(10);
+ assert.expect(13);
var $target = $("#qunit-fixture");
@@ -124,6 +124,33 @@ QUnit.module('ModelFieldSelector', {
"field selector popover should be closed now");
assert.strictEqual(getValueFromDOM($value), "Product -> Product Name",
"field selector value should be displayed with two tags: 'Product' and 'Product Name'");
+
+ // Remove the current selection and recreate it again
+ fieldSelector.$el.trigger('focusin');
+ fieldSelector.$('.o_field_selector_prev_page').click();
+ fieldSelector.$('.o_field_selector_close').click();
+
+ fieldSelector.$el.trigger('focusin');
+ $fieldSelectorPopover = fieldSelector.$(".o_field_selector_popover:visible");
+ $lis = $fieldSelectorPopover.find("li");
+ $productLi = $();
+ $lis.each(function () {
+ var $li = $(this);
+ if ($li.html().indexOf("Product") >= 0) {
+ $productLi = $li;
+ }
+ });
+ assert.strictEqual($productLi.length, 1,
+ "field selector popover should contain the 'Product' field");
+
+ $productLi.click();
+ $lis = $fieldSelectorPopover.find("li");
+ $lis.first().click();
+ assert.notOk($fieldSelectorPopover.is("visible"),
+ "field selector popover should be closed now");
+ assert.strictEqual(getValueFromDOM($value), "Product -> Product Name",
+ "field selector value should be displayed with two tags: 'Product' and 'Product Name'");
+
fieldSelector.destroy();
function getValueFromDOM($dom) {