From 33207ed452cb1f3f2dc05a447a137b8cc8cee9ed Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 17 Jan 2019 10:09:03 +0000 Subject: [PATCH] [REF] web: linting pass on kanban tests --- .../static/tests/views/kanban_mobile_tests.js | 40 ++++++++++++------- addons/web/static/tests/views/kanban_tests.js | 12 +++--- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/addons/web/static/tests/views/kanban_mobile_tests.js b/addons/web/static/tests/views/kanban_mobile_tests.js index d6c9a6d9a26..f20c4296a42 100644 --- a/addons/web/static/tests/views/kanban_mobile_tests.js +++ b/addons/web/static/tests/views/kanban_mobile_tests.js @@ -72,8 +72,8 @@ QUnit.module('Views', { }); // basic rendering tests - assert.containsN(kanban, '.o_kanban_group', 2, "should have 2 columns" ); - assert.hasClass(kanban.$('.o_kanban_mobile_tab:first'),'o_current', + assert.containsN(kanban, '.o_kanban_group', 2, "should have 2 columns"); + assert.hasClass(kanban.$('.o_kanban_mobile_tab:first'), 'o_current', "first tab is the active tab with class 'o_current'"); assert.hasClass(kanban.$('.o_kanban_group:first'),'o_current', "first column is the active column with class 'o_current'"); @@ -84,12 +84,12 @@ QUnit.module('Views', { // quick create in first column testUtils.dom.click(kanban.$buttons.find('.o-kanban-button-new')); - assert.hasClass(kanban.$('.o_kanban_group:nth(0) > div:nth(1)'),'o_kanban_quick_create', + assert.hasClass(kanban.$('.o_kanban_group:nth(0) > div:nth(1)'), 'o_kanban_quick_create', "clicking on create should open the quick_create in the first column"); // move to second column kanban.$('.o_kanban_mobile_tab:nth(1)').trigger('click'); - assert.hasClass(kanban.$('.o_kanban_mobile_tab:nth(1)'),'o_current', + assert.hasClass(kanban.$('.o_kanban_mobile_tab:nth(1)'), 'o_current', "second tab is now active with class 'o_current'"); assert.hasClass(kanban.$('.o_kanban_group:nth(1)'),'o_current', "second column is now active with class 'o_current'"); @@ -98,12 +98,16 @@ QUnit.module('Views', { // quick create in second column testUtils.dom.click(kanban.$buttons.find('.o-kanban-button-new')); - assert.hasClass(kanban.$('.o_kanban_group:nth(1) > div:nth(1)'),'o_kanban_quick_create', + assert.hasClass(kanban.$('.o_kanban_group:nth(1) > div:nth(1)'), 'o_kanban_quick_create', "clicking on create should open the quick_create in the second column"); // kanban column should match kanban mobile tabs - var column_ids = kanban.$('.o_kanban_group').map(function(){ return $(this).data('id') }).get(); - var tab_ids = kanban.$('.o_kanban_mobile_tab').map(function(){ return $(this).data('id') }).get(); + var column_ids = kanban.$('.o_kanban_group').map(function () { + return $(this).data('id'); + }).get(); + var tab_ids = kanban.$('.o_kanban_mobile_tab').map(function () { + return $(this).data('id'); + }).get(); assert.deepEqual(column_ids, tab_ids, "all columns data-id should match mobile tabs data-id"); kanban.destroy(); @@ -124,13 +128,17 @@ QUnit.module('Views', { }); // first column should be undefined with framework unique identifier - assert.containsN(kanban, '.o_kanban_group', 3, "should have 3 columns" ); + assert.containsN(kanban, '.o_kanban_group', 3, "should have 3 columns"); assert.containsOnce(kanban, '.o_kanban_mobile_tabs + .o_kanban_group[data-id^="partner_"]', - "Undefined column should be first and have unique framework identifier as data-id") + "Undefined column should be first and have unique framework identifier as data-id"); // kanban column should match kanban mobile tabs - var column_ids = kanban.$('.o_kanban_group').map(function(){ return $(this).data('id') }).get(); - var tab_ids = kanban.$('.o_kanban_mobile_tab').map(function(){ return $(this).data('id') }).get(); + var column_ids = kanban.$('.o_kanban_group').map(function () { + return $(this).data('id'); + }).get(); + var tab_ids = kanban.$('.o_kanban_mobile_tab').map(function () { + return $(this).data('id'); + }).get(); assert.deepEqual(column_ids, tab_ids, "all columns data-id should match mobile tabs data-id"); kanban.destroy(); @@ -151,13 +159,17 @@ QUnit.module('Views', { }); // basic rendering tests - assert.containsN(kanban, '.o_kanban_group', 4, "should have 4 columns" ); + assert.containsN(kanban, '.o_kanban_group', 4, "should have 4 columns"); assert.containsN(kanban, '.o_kanban_group[data-id^="partner_"]', 4, "all column should have framework unique identifiers"); // kanban column should match kanban mobile tabs - var column_ids = kanban.$('.o_kanban_group').map(function(){ return $(this).data('id') }).get(); - var tab_ids = kanban.$('.o_kanban_mobile_tab').map(function(){ return $(this).data('id') }).get(); + var column_ids = kanban.$('.o_kanban_group').map(function () { + return $(this).data('id'); + }).get(); + var tab_ids = kanban.$('.o_kanban_mobile_tab').map(function () { + return $(this).data('id'); + }).get(); assert.deepEqual(column_ids, tab_ids, "all columns data-id should match mobile tabs data-id"); kanban.destroy(); diff --git a/addons/web/static/tests/views/kanban_tests.js b/addons/web/static/tests/views/kanban_tests.js index 5483e296f67..7aefee4db0d 100644 --- a/addons/web/static/tests/views/kanban_tests.js +++ b/addons/web/static/tests/views/kanban_tests.js @@ -3710,7 +3710,6 @@ QUnit.module('Views', { kanban.destroy(); }); - QUnit.test('nocontent helper for grouped kanban with no records with no group_create', function (assert) { assert.expect(4); @@ -4741,7 +4740,7 @@ QUnit.module('Views', { kanban.destroy(); }); - QUnit.test('progress bar subgroup count recompute', function(assert) { + QUnit.test('progress bar subgroup count recompute', function (assert) { assert.expect(2); var kanban = createView({ @@ -5098,6 +5097,7 @@ QUnit.module('Views', { kanban.destroy(); }); + QUnit.test('keyboard navigation on kanban grouped rendering with empty columns', function (assert) { assert.expect(2); @@ -5166,9 +5166,9 @@ QUnit.module('Views', { kanban.destroy(); }); - QUnit.test('keyboard navigation on kanban when the focus is on a link that' + - 'has an action and the kanban has no oe_kanban_global_... class', function(assert){ - assert.expect(1) + QUnit.test('keyboard navigation on kanban when the focus is on a link that ' + + 'has an action and the kanban has no oe_kanban_global_... class', function (assert) { + assert.expect(1); var kanban = createView({ View: KanbanView, model: 'partner', @@ -5184,7 +5184,7 @@ QUnit.module('Views', { res_id: 1, mode: 'edit', model: 'partner', - },'When selecting focusing a card and hitting ENTER, the first link or button is clicked'); + }, 'When selecting focusing a card and hitting ENTER, the first link or button is clicked'); }); kanban.$('.o_kanban_record').first().focus().trigger($.Event('keydown', { keyCode: $.ui.keyCode.ENTER,