Skip to content
Permalink
Browse files

kanban view tests

  • Loading branch information
Arcasias committed Feb 13, 2020
1 parent 1b1df7f commit bce3b63e11cf77c7806d9d7050b2248a7ac8e68e
@@ -19,7 +19,7 @@ html {
height: 100%;
display: flex;
flex-flow: column nowrap;
> .o_cp_controller {
> .o_control_panel {
flex: 0 0 auto;
}
> .o_content {
@@ -423,8 +423,8 @@ odoo.define('web.test_utils_create', function (require) {
});

// Wait for the components to properly call their patched callbacks.
await concurrency.delay(0);
await new Promise(r => window.requestAnimationFrame(r));
// await concurrency.delay(0);
// await new Promise(r => window.requestAnimationFrame(r));

if (!params.doNotDisableAHref) {
[...viewController.el.getElementsByTagName('A')].forEach(elem => {
@@ -345,10 +345,12 @@ QUnit.module('Views', {
'</t></templates></kanban>',
groupBy: ['bar'],
});
await kanban.renderPager();
// Update will retreive current pager information and update it.
// It should not allow it to be displayed.
await kanban.update({});

assert.containsNone(kanban, '.o_pager');

assert.isNotVisible(kanban.pager.$el,
"pager should be hidden in grouped kanban");
kanban.destroy();
});

@@ -368,10 +370,10 @@ QUnit.module('Views', {
return this._super.apply(this, arguments);
},
});
const cpHelpers = testUtils.controlPanel.getHelpers(kanban.el);

assert.isVisible(kanban.pager.$el,
"pager should be visible in ungrouped kanban");
assert.strictEqual(kanban.pager.state.size, 4, "pager's size should be 4");
assert.containsOnce(kanban, '.o_pager');
assert.strictEqual(cpHelpers.getPagerSize(), "4", "pager's size should be 4");
kanban.destroy();
});

@@ -394,9 +396,10 @@ QUnit.module('Views', {
limit: 2,
},
});
const cpHelpers = testUtils.controlPanel.getHelpers(kanban.el);

assert.strictEqual(kanban.pager.state.limit, 2, "pager's limit should be 2");
assert.strictEqual(kanban.pager.state.size, 4, "pager's size should be 4");
assert.strictEqual(cpHelpers.getPagerValue(), "1-2", "pager's limit should be 2");
assert.strictEqual(cpHelpers.getPagerSize(), "4", "pager's size should be 4");
kanban.destroy();
});

@@ -420,9 +423,10 @@ QUnit.module('Views', {
limit: 2,
},
});
const cpHelpers = testUtils.controlPanel.getHelpers(kanban.el);

assert.strictEqual(kanban.pager.state.limit, 3, "pager's limit should be 3");
assert.strictEqual(kanban.pager.state.size, 4, "pager's size should be 4");
assert.strictEqual(cpHelpers.getPagerValue(), "1-3", "pager's limit should be 3");
assert.strictEqual(cpHelpers.getPagerSize(), "4", "pager's size should be 4");
kanban.destroy();
});

@@ -577,7 +581,7 @@ QUnit.module('Views', {
},
});

assert.containsOnce(kanban, '.o_cp_controller', 'should have one control panel');
assert.containsOnce(kanban, '.o_control_panel', 'should have one control panel');
assert.containsOnce(kanban, '.o_kanban_group:first .o_kanban_record',
"first column should contain one record");

@@ -589,7 +593,7 @@ QUnit.module('Views', {
"should have a quick create element in the first column");
assert.strictEqual($quickCreate.find('.o_form_view.o_xxs_form_view').length, 1,
"should have rendered an XXS form view");
assert.containsOnce(kanban, '.o_cp_controller', 'should not have instantiated an extra control panel');
assert.containsOnce(kanban, '.o_control_panel', 'should not have instantiated an extra control panel');
assert.strictEqual($quickCreate.find('input').length, 2,
"should have two inputs");
assert.strictEqual($quickCreate.find('.o_field_widget').length, 3,

0 comments on commit bce3b63

Please sign in to comment.
You can’t perform that action at this time.