[FIX] web: add missing semicolons and typo in multi company files
Before this commit: - Some semicolon where missing - There was a typo in the variable name After this commit: - The above problems are solved task-2168337 Closes: #66551
This commit is contained in:
@@ -362,7 +362,7 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
|
||||
},
|
||||
|
||||
setCompanies: function (main_company_id, company_ids) {
|
||||
var hash = $.bbq.getState()
|
||||
var hash = $.bbq.getState();
|
||||
hash.cids = company_ids.sort(function(a, b) {
|
||||
if (a === main_company_id) {
|
||||
return -1;
|
||||
|
||||
@@ -7,11 +7,11 @@ var testUtils = require('web.test_utils');
|
||||
|
||||
async function createSwitchCompanyMenu(params) {
|
||||
params = params || {};
|
||||
var target = params.debug ? document.body : $('#qunit-fixture');
|
||||
var target = params.debug ? document.body : $('#qunit-fixture');
|
||||
var menu = new SwitchCompanyMenu();
|
||||
await testUtils.mock.addMockEnvironment(menu, params);
|
||||
await menu.appendTo(target)
|
||||
return menu
|
||||
await menu.appendTo(target);
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ async function initMockCompanyMenu(assert, params) {
|
||||
...params.session,
|
||||
setCompanies: function (mainCompanyId, companyIds) {
|
||||
assert.equal(mainCompanyId, params.assertMainCompany[0], params.assertMainCompany[1]);
|
||||
assert.equal(_.intersection(companyIds, params.asserCompanies[0]).length, params.asserCompanies[0].length, params.asserCompanies[1]);
|
||||
assert.equal(_.intersection(companyIds, params.assertCompanies[0]).length, params.assertCompanies[0].length, params.assertCompanies[1]);
|
||||
},
|
||||
}
|
||||
})
|
||||
await testUtils.dom.click(menu.$('.dropdown-toggle')); // open company switcher dropdown
|
||||
return menu
|
||||
});
|
||||
await testUtils.dom.click(menu.$('.dropdown-toggle')); // open company switcher dropdown
|
||||
return menu;
|
||||
}
|
||||
|
||||
async function testSwitchCompany(assert, params) {
|
||||
@@ -50,15 +50,15 @@ QUnit.module('widgets', {
|
||||
current_company: [1, "Company 1"],
|
||||
allowed_companies: [[1, "Company 1"], [2, "Company 2"], [3, "Company 3"]],
|
||||
},
|
||||
user_context: { allowed_company_ids: [1, 3] },
|
||||
},
|
||||
user_context: {allowed_company_ids: [1, 3]},
|
||||
};
|
||||
this.session_mock_single = {
|
||||
user_companies: {
|
||||
current_company: [1, "Company 1"],
|
||||
allowed_companies: [[1, "Company 1"], [2, "Company 2"], [3, "Company 3"]],
|
||||
},
|
||||
user_context: { allowed_company_ids: [1] },
|
||||
}
|
||||
user_context: {allowed_company_ids: [1]},
|
||||
};
|
||||
},
|
||||
|
||||
}, function () {
|
||||
@@ -68,13 +68,13 @@ QUnit.module('widgets', {
|
||||
QUnit.test("Company switcher basic rendering", async function (assert) {
|
||||
assert.expect(6);
|
||||
var menu = await createSwitchCompanyMenu({ session: this.session_mock_multi });
|
||||
assert.equal(menu.$('.company_label:contains(Company 1)').length, 1, "it should display Company 1")
|
||||
assert.equal(menu.$('.company_label:contains(Company 2)').length, 1, "it should display Company 2")
|
||||
assert.equal(menu.$('.company_label:contains(Company 3)').length, 1, "it should display Company 3")
|
||||
assert.equal(menu.$('.company_label:contains(Company 1)').length, 1, "it should display Company 1");
|
||||
assert.equal(menu.$('.company_label:contains(Company 2)').length, 1, "it should display Company 2");
|
||||
assert.equal(menu.$('.company_label:contains(Company 3)').length, 1, "it should display Company 3");
|
||||
|
||||
assert.equal(menu.$('div[data-company-id=1] .fa-check-square').length, 1, "Company 1 should be checked")
|
||||
assert.equal(menu.$('div[data-company-id=2] .fa-square-o').length, 1, "Company 2 should not be checked")
|
||||
assert.equal(menu.$('div[data-company-id=3] .fa-check-square').length, 1, "Company 3 should be checked")
|
||||
assert.equal(menu.$('div[data-company-id=1] .fa-check-square').length, 1, "Company 1 should be checked");
|
||||
assert.equal(menu.$('div[data-company-id=2] .fa-square-o').length, 1, "Company 2 should not be checked");
|
||||
assert.equal(menu.$('div[data-company-id=3] .fa-check-square').length, 1, "Company 3 should be checked");
|
||||
menu.destroy();
|
||||
});
|
||||
});
|
||||
@@ -91,7 +91,7 @@ QUnit.module('widgets', {
|
||||
company: 2,
|
||||
session: this.session_mock_multi,
|
||||
assertMainCompany: [1, "Main company should not have changed"],
|
||||
asserCompanies: [[1, 2, 3], "All companies should be activated"],
|
||||
assertCompanies: [[1, 2, 3], "All companies should be activated"],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -105,7 +105,7 @@ QUnit.module('widgets', {
|
||||
company: 3,
|
||||
session: this.session_mock_multi,
|
||||
assertMainCompany: [1, "Main company should not have changed"],
|
||||
asserCompanies: [[1], "Companies 3 should be unactivated"],
|
||||
assertCompanies: [[1], "Companies 3 should be unactivated"],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -119,7 +119,7 @@ QUnit.module('widgets', {
|
||||
company: 3,
|
||||
session: this.session_mock_multi,
|
||||
assertMainCompany: [3, "Main company should switch to Company 3"],
|
||||
asserCompanies: [[1, 3], "Companies 1 and 3 should still be active"],
|
||||
assertCompanies: [[1, 3], "Companies 1 and 3 should still be active"],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ QUnit.module('widgets', {
|
||||
company: 2,
|
||||
session: this.session_mock_multi,
|
||||
assertMainCompany: [2, "Company 2 should become the main company"],
|
||||
asserCompanies: [[1, 2, 3], "Companies 1 and 3 should still be active"],
|
||||
assertCompanies: [[1, 2, 3], "Companies 1 and 3 should still be active"],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -147,7 +147,7 @@ QUnit.module('widgets', {
|
||||
company: 3,
|
||||
session: this.session_mock_single,
|
||||
assertMainCompany: [3, "Main company should switch to Company 3"],
|
||||
asserCompanies: [[3], "Companies 1 should no longer be active"],
|
||||
assertCompanies: [[3], "Companies 1 should no longer be active"],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -161,7 +161,7 @@ QUnit.module('widgets', {
|
||||
company: 3,
|
||||
session: this.session_mock_single,
|
||||
assertMainCompany: [1, "Company 1 should still be the main company"],
|
||||
asserCompanies: [[1, 3], "Company 3 should be activated"],
|
||||
assertCompanies: [[1, 3], "Company 3 should be activated"],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user