diff --git a/cypress/.gitignore b/cypress/.gitignore new file mode 100644 index 0000000..de68fb1 --- /dev/null +++ b/cypress/.gitignore @@ -0,0 +1 @@ +screenshots diff --git a/src/components/ColorValues/HexEditorTest.cy.tsx b/src/components/ColorValues/HexEditorTest.cy.tsx new file mode 100644 index 0000000..7db6f55 --- /dev/null +++ b/src/components/ColorValues/HexEditorTest.cy.tsx @@ -0,0 +1,84 @@ +import { useReducer } from "react"; + +import { Color } from "colorlib"; + +import { colorReducer, createColorActions } from "@hooks/color"; + +import { HexEditor } from "./ValueEditor"; + +const initialState = { + color: Color.from_hex("000"), +}; + +function TestWrapper() { + const [state, dispatch] = useReducer(colorReducer, initialState); + const actions = createColorActions(dispatch); + + return ( +
+ Color: #{state.color.hex.to_code()} +
++ HCL ({roundTo(state.color.hcl.h, 0)}, {roundTo(state.color.hcl.c, 2)},{" "} + {roundTo(state.color.hcl.l, 2)}) +
++ HSV ({roundTo(state.color.hsv.h, 0)}, {roundTo(state.color.hsv.s, 2)},{" "} + {roundTo(state.color.hsv.v, 2)}) +
++ RGB ({roundTo(state.color.rgb.r, 0)}, {roundTo(state.color.rgb.g, 0)},{" "} + {roundTo(state.color.rgb.b, 0)}) +
+HEX: #{state.color.hex.to_code()}
+