[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>
This commit is contained in:
committed by
Aaron Bohy
co-authored by
Aaron Bohy
Christophe Matthieu
Mathieu Duckerts-Antoine
David Monjoie
Martin Geubelle
svs-odoo
parent
2a2f2cfec2
commit
934f054e4c
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user