mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 10:52:02 +02:00
vanilla 17.0
This commit is contained in:
parent
d72e748793
commit
a9bcec8e91
1986 changed files with 1613876 additions and 568976 deletions
|
|
@ -45,7 +45,7 @@ QUnit.module("Widgets", (hooks) => {
|
|||
let fileInput;
|
||||
patchWithCleanup(AttachDocumentWidget.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
fileInput = this.fileInput;
|
||||
},
|
||||
});
|
||||
|
|
@ -75,10 +75,10 @@ QUnit.module("Widgets", (hooks) => {
|
|||
assert.deepEqual(args.kwargs.attachment_ids, [5, 2]);
|
||||
return true;
|
||||
}
|
||||
if (args.method === "write") {
|
||||
if (args.method === "web_save") {
|
||||
assert.deepEqual(args.args[1], { display_name: "yop" });
|
||||
}
|
||||
if (args.method === "read") {
|
||||
if (args.method === "web_read") {
|
||||
assert.deepEqual(args.args[0], [1]);
|
||||
}
|
||||
},
|
||||
|
|
@ -88,13 +88,13 @@ QUnit.module("Widgets", (hooks) => {
|
|||
<field name="display_name" required="1"/>
|
||||
</form>`,
|
||||
});
|
||||
assert.verifySteps(["get_views", "read"]);
|
||||
assert.verifySteps(["get_views", "web_read"]);
|
||||
|
||||
await editInput(target, "[name='display_name'] input", "yop");
|
||||
await click(target, ".o_attach_document");
|
||||
fileInput.dispatchEvent(new Event("change"));
|
||||
await nextTick();
|
||||
assert.verifySteps(["write", "read", "post", "my_action", "read"]);
|
||||
assert.verifySteps(["web_save", "post", "my_action", "web_read"]);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
|
|
@ -103,7 +103,7 @@ QUnit.module("Widgets", (hooks) => {
|
|||
let fileInput;
|
||||
patchWithCleanup(AttachDocumentWidget.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
fileInput = this.fileInput;
|
||||
},
|
||||
});
|
||||
|
|
@ -132,10 +132,10 @@ QUnit.module("Widgets", (hooks) => {
|
|||
assert.deepEqual(args.kwargs.attachment_ids, [5, 2]);
|
||||
return true;
|
||||
}
|
||||
if (args.method === "create") {
|
||||
assert.deepEqual(args.args[0], { display_name: "yop" });
|
||||
if (args.method === "web_save") {
|
||||
assert.deepEqual(args.args[1], { display_name: "yop" });
|
||||
}
|
||||
if (args.method === "read") {
|
||||
if (args.method === "web_read") {
|
||||
assert.deepEqual(args.args[0], [2]);
|
||||
}
|
||||
},
|
||||
|
|
@ -151,7 +151,7 @@ QUnit.module("Widgets", (hooks) => {
|
|||
await click(target, ".o_attach_document");
|
||||
fileInput.dispatchEvent(new Event("change"));
|
||||
await nextTick();
|
||||
assert.verifySteps(["create", "read", "post", "my_action", "read"]);
|
||||
assert.verifySteps(["web_save", "post", "my_action", "web_read"]);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
/** @odoo-module **/
|
||||
import { getFixture } from "@web/../tests/helpers/utils";
|
||||
import { makeView, setupViewRegistries } from "@web/../tests/views/helpers";
|
||||
|
||||
let target;
|
||||
let serverData;
|
||||
|
||||
QUnit.module("Widgets", (hooks) => {
|
||||
hooks.beforeEach(() => {
|
||||
target = getFixture();
|
||||
serverData = {
|
||||
models: {
|
||||
partner: {
|
||||
fields: {
|
||||
bar: { string: "Bar", type: "boolean" },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
setupViewRegistries();
|
||||
});
|
||||
|
||||
QUnit.module("DocumentationLink");
|
||||
|
||||
QUnit.test("documentation_link: relative path", async function (assert) {
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
serverData,
|
||||
arch: `
|
||||
<form>
|
||||
<field name="bar"/>
|
||||
<widget name="documentation_link" path="/applications/technical/web/settings/this_is_a_test.html"/>
|
||||
</form>`,
|
||||
});
|
||||
|
||||
assert.hasAttrValue(
|
||||
target.querySelector(".o_doc_link"),
|
||||
"href",
|
||||
"https://www.odoo.com/documentation/1.0/applications/technical/web/settings/this_is_a_test.html"
|
||||
);
|
||||
});
|
||||
QUnit.test("documentation_link: absoluth path (http)", async function (assert) {
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
serverData,
|
||||
arch: `
|
||||
<form>
|
||||
<field name="bar"/>
|
||||
<widget name="documentation_link" path="http://www.odoo.com/"/>
|
||||
</form>`,
|
||||
});
|
||||
|
||||
assert.hasAttrValue(target.querySelector(".o_doc_link"), "href", "http://www.odoo.com/");
|
||||
});
|
||||
QUnit.test("documentation_link: absoluth path (https)", async function (assert) {
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
serverData,
|
||||
arch: `
|
||||
<form>
|
||||
<field name="bar"/>
|
||||
<widget name="documentation_link" path="https://www.odoo.com/"/>
|
||||
</form>`,
|
||||
});
|
||||
|
||||
assert.hasAttrValue(target.querySelector(".o_doc_link"), "href", "https://www.odoo.com/");
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
import { patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
import { makeView, setupViewRegistries } from "@web/../tests/views/helpers";
|
||||
|
||||
const viewData = {
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
serverData: {
|
||||
models: {
|
||||
partner: {
|
||||
records: [
|
||||
{
|
||||
id: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
resId: 1,
|
||||
arch: `<form><widget name="notification_alert"/></form>`,
|
||||
};
|
||||
|
||||
QUnit.module("Widgets", (hooks) => {
|
||||
hooks.beforeEach(setupViewRegistries);
|
||||
|
||||
QUnit.module("NotificationAlert");
|
||||
|
||||
QUnit.test(
|
||||
"notification alert should be displayed when notification denied",
|
||||
async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
patchWithCleanup(browser, { Notification: { permission: "denied" } });
|
||||
await makeView(viewData);
|
||||
assert.containsOnce(
|
||||
document.body,
|
||||
".o_widget_notification_alert .alert",
|
||||
"notification alert should be displayed when notification denied"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"notification alert should not be displayed when notification granted",
|
||||
async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
patchWithCleanup(browser, { Notification: { permission: "granted" } });
|
||||
await makeView(viewData);
|
||||
assert.containsNone(
|
||||
document.body,
|
||||
".o_widget_notification_alert .alert",
|
||||
"notification alert should not be displayed when notification granted"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"notification alert should not be displayed when notification default",
|
||||
async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
patchWithCleanup(browser, { Notification: { permission: "default" } });
|
||||
await makeView(viewData);
|
||||
assert.containsNone(
|
||||
document.body,
|
||||
".o_widget_notification_alert .alert",
|
||||
"notification alert should not be displayed when notification default"
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
@ -19,7 +19,6 @@ QUnit.module("Widgets", (hooks) => {
|
|||
type: "many2one",
|
||||
relation: "product",
|
||||
},
|
||||
__last_update: { type: "datetime" },
|
||||
sign: { string: "Signature", type: "binary" },
|
||||
},
|
||||
records: [
|
||||
|
|
@ -55,7 +54,7 @@ QUnit.module("Widgets", (hooks) => {
|
|||
|
||||
patchWithCleanup(NameAndSignature.prototype, {
|
||||
setup() {
|
||||
this._super.apply(this, arguments);
|
||||
super.setup(...arguments);
|
||||
assert.strictEqual(this.props.signature.name, "");
|
||||
},
|
||||
});
|
||||
|
|
@ -97,7 +96,7 @@ QUnit.module("Widgets", (hooks) => {
|
|||
QUnit.test("Signature widget: full_name option", async function (assert) {
|
||||
patchWithCleanup(NameAndSignature.prototype, {
|
||||
setup() {
|
||||
this._super.apply(this, arguments);
|
||||
super.setup(...arguments);
|
||||
assert.step(this.props.signature.name);
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ QUnit.module("Widgets", ({ beforeEach }) => {
|
|||
</form>
|
||||
`,
|
||||
mockRPC(route, { args, method }) {
|
||||
if (method === "write") {
|
||||
if (method === "web_save") {
|
||||
writeCall++;
|
||||
if (writeCall === 1) {
|
||||
assert.ok(args[1].sun, "value of sunday should be true");
|
||||
|
|
@ -92,7 +92,7 @@ QUnit.module("Widgets", ({ beforeEach }) => {
|
|||
assert.containsNone(
|
||||
fixture,
|
||||
".form-check input:disabled",
|
||||
"all inputs should be enabled in readonly mode"
|
||||
"all inputs should be enabled in edit mode"
|
||||
);
|
||||
|
||||
await click(fixture.querySelector("td:nth-child(7) input"));
|
||||
|
|
@ -136,6 +136,42 @@ QUnit.module("Widgets", ({ beforeEach }) => {
|
|||
);
|
||||
});
|
||||
|
||||
QUnit.test("week recurrence widget readonly modifiers", async (assert) => {
|
||||
registry.category("services", makeFakeLocalizationService({ weekStart: 1 }));
|
||||
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
resId: 1,
|
||||
serverData,
|
||||
arch: `
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<widget name="week_days" readonly="1"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
`,
|
||||
});
|
||||
|
||||
const labelsTexts = [...fixture.querySelectorAll(".o_recurrent_weekday_label")].map((el) =>
|
||||
el.innerText.trim()
|
||||
);
|
||||
assert.deepEqual(
|
||||
labelsTexts,
|
||||
["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
||||
"labels should be short week names"
|
||||
);
|
||||
|
||||
assert.containsN(
|
||||
fixture,
|
||||
".form-check input:disabled",
|
||||
7,
|
||||
"all inputs should be disabled in readonly mode"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"week recurrence widget show week start as per language configuration",
|
||||
async (assert) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue