Skip to content

Commit

Permalink
[IMP] color_picker : added accessibility to custom color picker
Browse files Browse the repository at this point in the history
Enabled custom color picker to open by clicking on Custom part no matter
where we click (not only on the +), beside the already added colors.

Task-3223388

closes #2276

Signed-off-by: Rémi Rahir (rar) <[email protected]>
  • Loading branch information
khpa-odoo committed Apr 3, 2023
1 parent bbf4f48 commit d3234a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/components/color_picker/color_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
</div>
</div>
<div class="o-separator"/>
<div class="o-color-picker-section-name">
<div
class="o-color-picker-section-name o-color-picker-toggler"
t-on-click="toggleColorPicker">
<span>Custom</span>
</div>
<div class="colors-grid">
<div
class="o-color-picker-toggler o-color-picker-line-item"
t-on-click.stop="toggleColorPicker">
<div class="colors-grid o-color-picker-toggler" t-on-click.stop="toggleColorPicker">
<div class="o-color-picker-line-item o-color-picker-toggler">
<div align="center">+</div>
</div>
<div
Expand Down
13 changes: 8 additions & 5 deletions tests/components/color_picker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ describe("Color Picker buttons", () => {
expect(onColorPicked).toHaveBeenCalledWith("");
});

test("Click on '+' button toggle the custom color part", async () => {
test("Clicking on '+', custom section except custom added colors must toggle the custom color picker", async () => {
await mountColorPicker();
await simulateClick(".o-color-picker-toggler");
expect(fixture.querySelector(".o-custom-selector")).toBeDefined();
await simulateClick(".o-color-picker-toggler");
expect(fixture.querySelector(".o-custom-selector")).toBeNull();
const elements = fixture.querySelectorAll(".o-color-picker-toggler");
for (const element of elements) {
await simulateClick(element);
expect(fixture.querySelector(".o-custom-selector")).toBeDefined();
await simulateClick(element);
expect(fixture.querySelector(".o-custom-selector")).toBeNull();
}
});

test("Can pick a standard color", async () => {
Expand Down

0 comments on commit d3234a5

Please sign in to comment.