[FIX] web: take into account orientation classes on radio button field

Before this commit, all radio buttons were on horizontal style,
the o_vertical class was not taken into account.

closes odoo/odoo#95553

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2022-07-08 13:21:53 +02:00
parent a1897042fc
commit cd9ba6b06a
2 changed files with 13 additions and 3 deletions
@@ -1,5 +1,4 @@
.o_field_radio > div {
display: inline-flex;
.o_field_radio {
> span, > button {
flex: 0 0 auto;
}
@@ -15,6 +14,7 @@
}
.o_horizontal {
display: inline-flex;
.o_radio_item {
margin-right: $o-form-spacing-unit * 2;
}
@@ -226,11 +226,21 @@ QUnit.module("Fields", (hooks) => {
".o_field_radio > div.o_vertical",
"should have o_vertical class"
);
const verticalRadio = target.querySelector(".o_field_radio > div.o_vertical");
assert.strictEqual(
verticalRadio.querySelector(".o_radio_item:first-child").getBoundingClientRect().right,
verticalRadio.querySelector(".o_radio_item:last-child").getBoundingClientRect().right
);
assert.containsOnce(
target,
".o_field_radio div.o_horizontal",
".o_field_radio > div.o_horizontal",
"should have o_horizontal class"
);
const horizontalRadio = target.querySelector(".o_field_radio > div.o_horizontal");
assert.strictEqual(
horizontalRadio.querySelector(".o_radio_item:first-child").getBoundingClientRect().top,
horizontalRadio.querySelector(".o_radio_item:last-child").getBoundingClientRect().top
);
});
QUnit.test("fieldradio widget with numerical keys encoded as strings", async function (assert) {