Skip to content

Commit

Permalink
fix(color-picker): fix error caused by initial value with a different…
Browse files Browse the repository at this point in the history
… format (#11351)

**Related Issue:** #10731  

## Summary  

Adds missing check to skip internal, equal values after transitioning to
getters/setters in #10310.
  • Loading branch information
jcfranco authored Jan 22, 2025
1 parent 3d0816e commit 1d187da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2470,4 +2470,14 @@ describe("calcite-color-picker", () => {
});
});
});

it("does not throw when initialized with different format value (format='auto')", async () => {
async function doTest(): Promise<void> {
const page = await newE2EPage();
await page.setContent(`<calcite-color-picker value="rgb(89, 77, 77)"></calcite-color-picker>`);
await page.waitForChanges();
}

await expect(doTest()).resolves.toBeUndefined();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,8 @@ export class ColorPicker extends LitElement implements InteractiveComponent, Loa
if (modeChanged || colorChanged) {
this.internalColorSet(
color,
this.alphaChannel && !(this.mode.endsWith("a") || this.mode.endsWith("a-css")),
(this.alphaChannel && !(this.mode.endsWith("a") || this.mode.endsWith("a-css"))) ||
this.internalColorUpdateContext === "internal",
"internal",
);
}
Expand Down

0 comments on commit 1d187da

Please sign in to comment.