diff options
| author | Vincent Schippefilt <vsc@odoo.com> | 2019-03-06 14:02:03 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-03-06 20:07:17 +0100 |
| commit | 934f054e4cee44ddb5bd23153e3d33b0bdc53548 (patch) | |
| tree | cde1dc72bdc01345fc1be1e35620c33b40c4422a /addons | |
| parent | 2a2f2cfec25f1789c1f830a7213c24d79d28e62e (diff) | |
[REF] hr_org_chart: adapt code after jQuery update
Part of task 1896658
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Co-authored-by: svs-odoo <svs@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/hr_org_chart/static/src/js/hr_org_chart.js | 8 | ||||
| -rw-r--r-- | addons/hr_org_chart/static/tests/hr_org_chart_tests.js | 21 |
2 files changed, 15 insertions, 14 deletions
diff --git a/addons/hr_org_chart/static/src/js/hr_org_chart.js b/addons/hr_org_chart/static/src/js/hr_org_chart.js index 39565570c84..c4f200d1ea9 100644 --- a/addons/hr_org_chart/static/src/js/hr_org_chart.js +++ b/addons/hr_org_chart/static/src/js/hr_org_chart.js @@ -34,7 +34,7 @@ var FieldOrgChart = AbstractField.extend({ * * @private * @param {integer} employee_id - * @returns {Deferred} + * @returns {Promise} */ _getOrgData: function (employee_id) { var self = this; @@ -52,7 +52,7 @@ var FieldOrgChart = AbstractField.extend({ * * @private * @param {integer} employee_id - * @returns {Deferred} + * @returns {Promise} */ _getSubordinatesData: function (employee_id, type) { return this.dm.add(this._rpc({ @@ -134,7 +134,7 @@ var FieldOrgChart = AbstractField.extend({ * * @private * @param {MouseEvent} event - * @returns {Deferred} action loaded + * @returns {Promise} action loaded */ _onEmployeeRedirect: function (event) { event.preventDefault(); @@ -154,7 +154,7 @@ var FieldOrgChart = AbstractField.extend({ * * @private * @param {MouseEvent} event - * @returns {Deferred} action loaded + * @returns {Promise} action loaded */ _onEmployeeSubRedirect: function (event) { event.preventDefault(); diff --git a/addons/hr_org_chart/static/tests/hr_org_chart_tests.js b/addons/hr_org_chart/static/tests/hr_org_chart_tests.js index d84cf293ae6..e536f0b587b 100644 --- a/addons/hr_org_chart/static/tests/hr_org_chart_tests.js +++ b/addons/hr_org_chart/static/tests/hr_org_chart_tests.js @@ -21,10 +21,10 @@ QUnit.module('hr_org_chart', { }; }, }, function () { - QUnit.test("hr org chart: empty render", function (assert) { + QUnit.test("hr org chart: empty render", async function (assert) { assert.expect(2); - var form = createView({ + var form = await createView({ View: FormView, model: 'hr_employee', data: this.data, @@ -36,7 +36,7 @@ QUnit.module('hr_org_chart', { mockRPC: function (route, args) { if (route === '/hr/get_org_chart') { assert.ok('employee_id' in args, "it should have 'employee_id' as argument"); - return $.when({ + return Promise.resolve({ children: [], managers: [], managers_more: false, @@ -45,13 +45,14 @@ QUnit.module('hr_org_chart', { return this._super(route, args); } }); - assert.strictEqual(form.$('[name="child_ids"]').children().length, 1, "the chart should have 1 child"); + assert.strictEqual(form.$('[name="child_ids"]').children().length, 1, + "the chart should have 1 child"); form.destroy(); }); - QUnit.test("hr org chart: basic render", function (assert) { + QUnit.test("hr org chart: basic render", async function (assert) { assert.expect(3); - var form = createView({ + var form = await createView({ View: FormView, model: 'hr_employee', data: this.data, @@ -69,7 +70,7 @@ QUnit.module('hr_org_chart', { mockRPC: function (route, args) { if (route === '/hr/get_org_chart') { assert.ok('employee_id' in args, "it should have 'employee_id' as argument"); - return $.when({ + return Promise.resolve({ children: [{ direct_sub_count: 0, indirect_sub_count: 0, @@ -101,10 +102,10 @@ QUnit.module('hr_org_chart', { "the current employee should only be displayed once in the chart"); form.destroy(); }); - QUnit.test("hr org chart: basic manager render", function (assert) { + QUnit.test("hr org chart: basic manager render", async function (assert) { assert.expect(4); - var form = createView({ + var form = await createView({ View: FormView, model: 'hr_employee', data: this.data, @@ -122,7 +123,7 @@ QUnit.module('hr_org_chart', { mockRPC: function (route, args) { if (route === '/hr/get_org_chart') { assert.ok('employee_id' in args, "should have 'employee_id' as argument"); - return $.when({ + return Promise.resolve({ children: [{ direct_sub_count: 0, indirect_sub_count: 0, |
