summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/mobile_control_panel_tests.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/tests/views/mobile_control_panel_tests.js')
-rw-r--r--addons/web/static/tests/views/mobile_control_panel_tests.js68
1 files changed, 63 insertions, 5 deletions
diff --git a/addons/web/static/tests/views/mobile_control_panel_tests.js b/addons/web/static/tests/views/mobile_control_panel_tests.js
index 19226741474..be0d197ef44 100644
--- a/addons/web/static/tests/views/mobile_control_panel_tests.js
+++ b/addons/web/static/tests/views/mobile_control_panel_tests.js
@@ -39,8 +39,61 @@ QUnit.module('Mobile Search view Screen', {
};
},
}, function () {
- QUnit.test('can activate a filter with mobile search view', async function (assert) {
- assert.expect(3);
+ QUnit.test('can activate a filter with mobile search view in quick search mode', async function (assert) {
+ assert.expect(7);
+
+ var searchRPCFlag = false;
+
+ var actionManager = await createActionManager({
+ actions: this.actions,
+ archs: this.archs,
+ data: this.data,
+ mockRPC: function (route, args) {
+ if (searchRPCFlag) {
+ assert.deepEqual(args.domain, [['foo', 'ilike', 'A']],
+ "domain should have been properly transferred to list view");
+ }
+ return this._super.apply(this, arguments);
+ },
+ });
+
+ await actionManager.doAction(1);
+
+ assert.strictEqual($('button.o_enable_searchview.fa-search').length, 1,
+ "should display a button to open the searchview");
+ assert.deepEqual($('.o_searchview_input_container:visible').length, 0,
+ "Quick search input should be hidden");
+
+ // open the search view
+ await testUtils.dom.click($('button.o_enable_searchview'));
+ assert.deepEqual($('.o_toggle_searchview_full:visible').length, 1,
+ "should display a button to expand the searchview");
+ assert.deepEqual($('.o_searchview_input_container:visible').length, 1,
+ "Quick search input should now be visible");
+
+ searchRPCFlag = true;
+
+ // use quick search input
+ $('.o_searchview_input')
+ .val("A")
+ .trigger($.Event('keypress', { which: 65, keyCode: 65 }));
+ await testUtils.nextTick();
+ actionManager.$('.o_searchview_input')
+ .trigger($.Event('keydown', { which: $.ui.keyCode.ENTER, keyCode: $.ui.keyCode.ENTER }));
+ await testUtils.nextTick();
+
+ // close quick search
+ await testUtils.dom.click($('button.o_enable_searchview.fa-close'));
+ assert.deepEqual($('.o_toggle_searchview_full:visible').length, 0,
+ "Expand icon shoud be hidden");
+ assert.deepEqual($('.o_searchview_input_container:visible').length, 0,
+ "Quick search input should be hidden");
+
+ actionManager.destroy();
+ });
+
+ QUnit.test('can activate a filter with mobile search view in full screen mode', async function (assert) {
+ assert.expect(4);
var filterActiveFlag = false;
@@ -61,20 +114,25 @@ QUnit.module('Mobile Search view Screen', {
assert.ok(!$('.o_mobile_search').is(':visible'),
'mobile search view is not visible');
+
// open the search view
await testUtils.dom.click($('button.o_enable_searchview'));
-
+ // open it in full screen
+ await testUtils.dom.click($('.o_toggle_searchview_full'));
assert.ok($('.o_mobile_search').is(':visible'),
'mobile search view is visible');
// open filter sub menu
await testUtils.dom.click($('button.o_dropdown_toggler_btn').first());
-
filterActiveFlag = true;
-
// click on Active filter
await testUtils.dom.click($('.o_filters_menu a:contains(Active)'));
+ // closing search view
+ await testUtils.dom.click($('.o_mobile_search_close'));
+ assert.ok(!$('.o_mobile_search').is(':visible'),
+ 'mobile search view is not visible');
+
actionManager.destroy();
});