-
+
diff --git a/addons/web/static/tests/views/kanban_mobile_tests.js b/addons/web/static/tests/views/kanban_mobile_tests.js
index ecc986eb0e4..dbd4ac95af7 100644
--- a/addons/web/static/tests/views/kanban_mobile_tests.js
+++ b/addons/web/static/tests/views/kanban_mobile_tests.js
@@ -112,11 +112,11 @@ QUnit.module('Views', {
}).get();
assert.deepEqual(column_ids, tab_ids, "all columns data-id should match mobile tabs data-id");
- // kanban tabs with tab with lower width then available with have justify-content-around class
- assert.containsN(kanban, '.o_kanban_mobile_tabs.justify-content-around', 1,
- "should have justify-content-around class");
- assert.hasClass(kanban.$('.o_kanban_mobile_tabs'), 'justify-content-around',
- "the mobile tabs have the class 'justify-content-around'");
+ // kanban tabs with tab with lower width then available with have justify-content-between class
+ assert.containsN(kanban, '.o_kanban_mobile_tabs.justify-content-between', 1,
+ "should have justify-content-between class");
+ assert.hasClass(kanban.$('.o_kanban_mobile_tabs'), 'justify-content-between',
+ "the mobile tabs have the class 'justify-content-between'");
kanban.destroy();
});
@@ -167,7 +167,7 @@ QUnit.module('Views', {
// first column should be undefined with framework unique identifier
assert.containsN(kanban, '.o_kanban_group', 3, "should have 3 columns");
- assert.containsOnce(kanban, '.o_kanban_mobile_tabs + .o_kanban_group[data-id^="partner_"]',
+ assert.containsOnce(kanban, '.o_kanban_columns_content .o_kanban_group:first-child[data-id^="partner_"]',
"Undefined column should be first and have unique framework identifier as data-id");
// kanban column should match kanban mobile tabs
@@ -179,11 +179,11 @@ QUnit.module('Views', {
}).get();
assert.deepEqual(column_ids, tab_ids, "all columns data-id should match mobile tabs data-id");
- // kanban tabs with tab with lower width then available with have justify-content-around class
- assert.containsN(kanban, '.o_kanban_mobile_tabs.justify-content-around', 1,
- "should have justify-content-around class");
- assert.hasClass(kanban.$('.o_kanban_mobile_tabs'), 'justify-content-around',
- "the mobile tabs have the class 'justify-content-around'");
+ // kanban tabs with tab with lower width then available with have justify-content-between class
+ assert.containsN(kanban, '.o_kanban_mobile_tabs.justify-content-between', 1,
+ "should have justify-content-between class");
+ assert.hasClass(kanban.$('.o_kanban_mobile_tabs'), 'justify-content-between',
+ "the mobile tabs have the class 'justify-content-between'");
kanban.destroy();
});
@@ -217,13 +217,88 @@ QUnit.module('Views', {
}).get();
assert.deepEqual(column_ids, tab_ids, "all columns data-id should match mobile tabs data-id");
- // kanban tabs with tab with lower width then available with have justify-content-around class
- assert.containsN(kanban, '.o_kanban_mobile_tabs.justify-content-around', 1,
- "should have justify-content-around class");
- assert.hasClass(kanban.$('.o_kanban_mobile_tabs'), 'justify-content-around',
- "the mobile tabs have the class 'justify-content-around'");
+ // kanban tabs with tab with lower width then available with have justify-content-between class
+ assert.containsN(kanban, '.o_kanban_mobile_tabs.justify-content-between', 1,
+ "should have justify-content-between class");
+ assert.hasClass(kanban.$('.o_kanban_mobile_tabs'), 'justify-content-between',
+ "the mobile tabs have the class 'justify-content-between'");
kanban.destroy();
});
+
+ QUnit.test('mobile quick create column view rendering', async function (assert) {
+ assert.expect(12);
+
+ var kanban = await createView({
+ View: KanbanView,
+ model: 'partner',
+ data: this.data,
+ arch: '
' +
+ '' +
+ '
' +
+ '' +
+ '',
+ domain: [['product_id', '!=', false]],
+ groupBy: ['product_id'],
+ });
+
+ // basic rendering tests
+ assert.containsN(kanban, '.o_kanban_group', 2, "should have 2 columns");
+ assert.hasClass(kanban.$('.o_kanban_view > .o_kanban_mobile_tabs_container > .o_kanban_mobile_tabs > div:last'), 'o_kanban_mobile_add_column',
+ "should have column quick create tab and should be displayed as last tab");
+ assert.hasClass(kanban.$('.o_kanban_mobile_tab:first'), 'o_current',
+ "should have first tab as active tab with class 'o_current'");
+ assert.hasClass(kanban.$('.o_kanban_group:first'), 'o_current',
+ "should have first group as active group with class 'o_current'");
+ assert.hasClass(kanban.$('.o_kanban_group:first'), 'o_current',
+ "should have first column as active column with left 0");
+
+ // quick create record in first column(tab)
+ await testUtils.dom.click(kanban.$('.o-kanban-button-new'));
+ assert.hasClass(kanban.$('.o_kanban_group[data-id="3"].o_current > div:nth(1)'), 'o_kanban_quick_create',
+ "should open record quick create when clicking on create button in first column");
+
+ // quick create record not allowed in quick create column tab
+ // clicking quick create record should move to first column and create record in first column
+ await testUtils.dom.click(kanban.$('.o_kanban_mobile_tab:last'));
+ await testUtils.dom.click(kanban.$('.o-kanban-button-new'));
+ assert.hasClass(kanban.$('.o_kanban_group[data-id="5"].o_current > div:nth(1)'), 'o_kanban_quick_create',
+ "should open record quick create when clicking on create button in new column quick create");
+
+ // new quick create column
+ await testUtils.dom.click(kanban.$('.o_kanban_mobile_add_column'));
+ assert.isVisible(kanban.$('.o_quick_create_unfolded'), "kanban quick create should be unfolded by default");
+ assert.isVisible(kanban.$('.o_column_quick_create input'), "the quick create column input should be visible");
+ assert.containsNone(kanban, '.o_kanban_examples', "Should not have See Examples link in mobile");
+ assert.containsNone(kanban, '.o_discard_msg', "Should not have Esc to Discard in mobile kanban");
+ kanban.$('.o_column_quick_create input').val('msh');
+ await testUtils.dom.click(kanban.$('.o_column_quick_create button.o_kanban_add'));
+
+ assert.strictEqual(kanban.$('.o_kanban_group:last span:contains(msh)').length, 1,
+ "the last column(tab) should be the newly created one");
+ kanban.destroy();
+ });
+
+ QUnit.test('mobile no quick create column when grouping on non m2o field', async function (assert) {
+ assert.expect(2);
+
+ var kanban = await createView({
+ View: KanbanView,
+ model: 'partner',
+ data: this.data,
+ arch: '
' +
+ '' +
+ '
' +
+ '
' +
+ '' +
+ '',
+ groupBy: ['int_field'],
+ });
+
+ assert.containsNone(kanban, '.o_kanban_mobile_add_column', "should not have the add column button");
+ assert.containsNone(kanban.$('.o_column_quick_create'),
+ "should not have column quick create tab as we grouped records on integer field");
+ kanban.destroy();
+ });
});
});