mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Respect cluster avatars entity background color (#7365)
* Add iconBackgroundColor cluster preference type Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Set custom backround for hotbar entities Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Remove unused code from Catalog Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Update entity background if preferences background changes Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Set avatar backgrounds from entity Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Clean up Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Clean up in hotbar entity icon Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Fix setting up entity background Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Use single icon prop Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Cleaning up hotbar entity icon Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Fixing test to ensure icon has data:image Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Add more test cases Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> --------- Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
1 parent
1a6b11525d
commit
763816f71f
6 files changed
+52
-65
No files matched your search
@@ -52,9 +52,21 @@ describe("update-entity-spec", () => {
|
||||
});
|
||||
|
||||
it("given cluster has icon, updates entity spec with icon", () => {
|
||||
cluster.preferences.icon = "some-icon";
|
||||
cluster.preferences.icon = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/";
|
||||
updateEntitySpec(entity, cluster);
|
||||
expect(entity.spec.icon?.src).toEqual("some-icon");
|
||||
expect(entity.spec.icon?.src).toEqual("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/");
|
||||
});
|
||||
|
||||
it("given cluster has custom icon background color set, updates entity spec with icon", () => {
|
||||
cluster.preferences.icon = "#ff0000";
|
||||
updateEntitySpec(entity, cluster);
|
||||
expect(entity.spec.icon?.background).toEqual("#ff0000");
|
||||
});
|
||||
|
||||
it("given cluster has custom icon background color set, does not update entity icon src", () => {
|
||||
cluster.preferences.icon = "#ff0000";
|
||||
updateEntitySpec(entity, cluster);
|
||||
expect(entity.spec.icon?.src).toBeUndefined();
|
||||
});
|
||||
|
||||
it("given cluster icon is null, deletes icon from both", () => {
|
||||
|
||||
Reference in new issue
Block a user