[REF] web: linting pass on kanban tests

This commit is contained in:
Aaron Bohy
2019-02-13 12:23:28 +00:00
committed by Mathieu Duckerts-Antoine
parent 0eaee45659
commit 33207ed452
2 changed files with 32 additions and 20 deletions
@@ -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();
@@ -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,