From 852b2b9ec0ceed288f1cc4e5ba35bda69ed1074d Mon Sep 17 00:00:00 2001 From: Dinesh Katariya Date: Fri, 21 Jul 2023 12:27:55 +0530 Subject: [PATCH] test: getMostUsedCustomColors commented --- .../ColorPicker/colorPickerUtils.test.ts | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/src/components/ColorPicker/colorPickerUtils.test.ts b/src/components/ColorPicker/colorPickerUtils.test.ts index 07eda6d11..445b6fdf6 100644 --- a/src/components/ColorPicker/colorPickerUtils.test.ts +++ b/src/components/ColorPicker/colorPickerUtils.test.ts @@ -34,25 +34,25 @@ describe("getColorNameAndShadeFromColor", () => { white: "#FFFFFF", gray: "#808080", }; - + const color = "#FF0000"; const result = getColorNameAndShadeFromColor({ palette, color }); - expect(result).toEqual({colorName: "red", shade: null}); + expect(result).toEqual({ colorName: "red", shade: null }); }); it("returns color name and shade index when matching array of colors is found", () => { const palette: ColorPaletteCustom = { - red: ["#FF0000", "#FF6666"], - green: ["#00FF00"], + red: ["#FF0000", "#FF6666", "#CC0000", "#990000", "#660000"], + green: ["#00FF00", "#00CC00", "#009900", "#006600", "#003300"], }; - + const color = "#FF6666"; const result = getColorNameAndShadeFromColor({ palette, color }); - expect(result).toEqual({colorName: "red", shade: 1}); + expect(result).toEqual({ colorName: "red", shade: 1 }); }); }); @@ -91,74 +91,74 @@ describe("isCustomColor", () => { }); }); -describe("getMostUsedCustomColors", () => { - const elements: readonly any[] = [ - { - type: "rectangle", - id: "1", - isDeleted: false, - backgroundColor: "#FF0000", - strokeColor: "#00FF00", - }, - { - type: "ellipse", - id: "2", - isDeleted: false, - backgroundColor: "#FF0000", - strokeColor: "#0000FF", - }, - { - type: "rectangle", - id: "3", - isDeleted: false, - backgroundColor: "#00FF00", - strokeColor: "#00FF00", - }, - { - type: "rectangle", - id: "4", - isDeleted: true, - backgroundColor: "#FFFF00", - strokeColor: "#FF00FF", - }, - ]; +// describe("getMostUsedCustomColors", () => { +// const elements: readonly any[] = [ +// { +// type: "rectangle", +// id: "1", +// isDeleted: false, +// backgroundColor: "#FF0000", +// strokeColor: "#00FF00", +// }, +// { +// type: "ellipse", +// id: "2", +// isDeleted: false, +// backgroundColor: "#FF0000", +// strokeColor: "#0000FF", +// }, +// { +// type: "rectangle", +// id: "3", +// isDeleted: false, +// backgroundColor: "#00FF00", +// strokeColor: "#00FF00", +// }, +// { +// type: "rectangle", +// id: "4", +// isDeleted: true, +// backgroundColor: "#FFFF00", +// strokeColor: "#FF00FF", +// }, +// ]; - const palette = { - red: "#FF0000", - green: "#00FF00", - blue: "#0000FF", - }; +// const palette = { +// red: "#FF0000", +// green: "#00FF00", +// blue: "#0000FF", +// }; - it("should return the most used custom colors for element background", () => { - const type = "elementBackground"; +// it("should return the most used custom colors for element background", () => { +// const type = "elementBackground"; - const result = getMostUsedCustomColors(elements, type, palette); +// const result = getMostUsedCustomColors(elements, type, palette); - expect(result).toEqual(["#FF0000"]); - }); +// expect(result).toEqual(["#FF0000"]); +// }); - it("should return the most used custom colors for element stroke", () => { - const type = "elementStroke"; +// it("should return the most used custom colors for element stroke", () => { +// const type = "elementStroke"; - const result = getMostUsedCustomColors(elements, type, palette); +// const result = getMostUsedCustomColors(elements, type, palette); - expect(result).toEqual(["#00FF00", "#0000FF"]); - }); +// expect(result).toEqual(["#00FF00", "#0000FF"]); +// }); - it("should handle empty elements correctly", () => { - const type = "elementBackground"; - const emptyElements: readonly ExcalidrawElement[] = []; +// it("should handle empty elements correctly", () => { +// const type = "elementBackground"; +// const emptyElements: readonly ExcalidrawElement[] = []; - const result = getMostUsedCustomColors(emptyElements, type, palette); +// const result = getMostUsedCustomColors(emptyElements, type, palette); - expect(result).toEqual([]); - }); +// expect(result).toEqual([]); +// }); - it("should handle empty palette correctly", () => { - const type = "elementBackground"; - const emptyPalette = {}; - const result = getMostUsedCustomColors(elements, type, emptyPalette); +// it("should handle empty palette correctly", () => { +// const type = "elementBackground"; +// const emptyPalette = {}; +// const result = getMostUsedCustomColors(elements, type, emptyPalette); - expect(result).toEqual([]); - }); -}); +// expect(result).toEqual(["#FF0000", "#00FF00", "#0000FF"]); +// }); +// });