mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX][web_duplicate_visibility] Run tests.
Tests were not run in bots. Includes some cosmetic fixes.
This commit is contained in:
@@ -46,10 +46,7 @@ Bug Tracker
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/web/issues>`_. In case of trouble, please
|
||||
check there if your issue has already been reported. If you spotted it first,
|
||||
help us smashing it by providing a detailed and welcomed `feedback
|
||||
<https://github.com/OCA/web/issues/new?body=module:%20web_duplicate_visibility%0
|
||||
Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20
|
||||
behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
help us smashing it by providing a detailed and welcomed feedback.
|
||||
|
||||
Credits
|
||||
=======
|
||||
@@ -66,6 +63,7 @@ Contributors
|
||||
* Pierre Verkest <pverkest@anybox.fr>
|
||||
* Christophe Combelles <ccomb@anybox.fr>
|
||||
* Simon André <sandre@anybox.fr>
|
||||
* Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
{
|
||||
"name": "web duplicate visibility",
|
||||
"summary": "Manage the duplicate button visibiliy",
|
||||
"version": "9.0.1.0.0",
|
||||
"version": "9.0.1.0.1",
|
||||
"category": "web",
|
||||
"website": "https://odoo-community.org/",
|
||||
"author": "Pierre Verkest <pverkest@anybox.fr>,"
|
||||
" Odoo Community Association (OCA)",
|
||||
"author": "Pierre Verkest <pverkest@anybox.fr>, "
|
||||
"Tecnativa, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"application": False,
|
||||
"installable": True,
|
||||
"depends": [
|
||||
"base",
|
||||
"web",
|
||||
],
|
||||
"data": [
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"use strict";
|
||||
/* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||
odoo.define_section('web_duplicate_visibility',
|
||||
['web.data', 'web.FormView'],
|
||||
function(test, mock){
|
||||
"use strict";
|
||||
|
||||
function assertDuplicate(data, FormView, form_tag, visible){
|
||||
function assertDuplicate(assert, data, FormView, form_tag, visible) {
|
||||
mock.add('test.model:read', function () {
|
||||
return [{ id: 1, a: 'foo', b: 'bar', c: 'baz' }];
|
||||
});
|
||||
@@ -45,38 +47,32 @@ odoo.define_section('web_duplicate_visibility',
|
||||
return obj.text.trim() == "Duplicate";
|
||||
}
|
||||
);
|
||||
strictEqual(
|
||||
assert.strictEqual(
|
||||
actions.length, visible, "duplicate state is not as expected"
|
||||
);
|
||||
};
|
||||
|
||||
function compare(form_tag, visible) {
|
||||
return function (assert, data, FormView) {
|
||||
return assertDuplicate(assert, data, FormView, form_tag, visible);
|
||||
}
|
||||
}
|
||||
|
||||
test('Duplicate button visible when nothing set',
|
||||
function(assert, data, FormView){
|
||||
assertDuplicate(data, FormView, '<form>', 1);
|
||||
});
|
||||
compare('<form>', 1));
|
||||
|
||||
test('Duplicate button visible when create="1"',
|
||||
function(assert, data, FormView){
|
||||
assertDuplicate(data, FormView, '<form create="1">', 1);
|
||||
});
|
||||
compare('<form create="1">', 1));
|
||||
|
||||
test('Duplicate button visible when duplicate="1"',
|
||||
function(assert, data, FormView){
|
||||
assertDuplicate(data, FormView, '<form duplicate="1">', 1);
|
||||
});
|
||||
compare('<form duplicate="1">', 1));
|
||||
|
||||
test('Duplicate button not displayed when create="0"',
|
||||
function(assert, data, FormView){
|
||||
assertDuplicate(data, FormView, '<form create="0">', 0);
|
||||
});
|
||||
compare('<form create="0">', 0));
|
||||
|
||||
test('Duplicate button not displayed when create="1" duplicate="0"',
|
||||
function(assert, data, FormView){
|
||||
assertDuplicate(data, FormView, '<form create="1" duplicate="0">', 0);
|
||||
});
|
||||
compare('<form create="1" duplicate="0">', 0));
|
||||
|
||||
test('Duplicate button not displayed when duplicate="0"',
|
||||
function(assert, data, FormView){
|
||||
assertDuplicate(data, FormView, '<form duplicate="0">', 0);
|
||||
});
|
||||
compare('<form duplicate="0">', 0));
|
||||
});
|
||||
|
||||
5
web_duplicate_visibility/tests/__init__.py
Normal file
5
web_duplicate_visibility/tests/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import test_js
|
||||
14
web_duplicate_visibility/tests/test_js.py
Normal file
14
web_duplicate_visibility/tests/test_js.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp.tests import HttpCase
|
||||
|
||||
|
||||
class TestJS(HttpCase):
|
||||
def test_js(self):
|
||||
self.phantom_js(
|
||||
"/web/tests?module=web_duplicate_visibility",
|
||||
"",
|
||||
login="admin",
|
||||
)
|
||||
Reference in New Issue
Block a user