@thednp/color-picker 2.0.1 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +25 -14
- package/dist/css/color-picker.css +3 -6
- package/dist/css/color-picker.css.map +1 -0
- package/dist/css/color-picker.min.css +1 -2
- package/dist/css/color-picker.min.css.map +1 -0
- package/dist/css/color-picker.rtl.css +3 -6
- package/dist/css/color-picker.rtl.css.map +1 -0
- package/dist/css/color-picker.rtl.min.css +1 -2
- package/dist/css/color-picker.rtl.min.css.map +1 -0
- package/dist/js/color-picker.cjs +2 -2
- package/dist/js/color-picker.cjs.map +1 -1
- package/dist/js/color-picker.d.ts +307 -300
- package/dist/js/color-picker.js +2 -2
- package/dist/js/color-picker.js.map +1 -1
- package/dist/js/color-picker.mjs +423 -382
- package/dist/js/color-picker.mjs.map +1 -1
- package/package.json +39 -50
- package/.eslintrc.cjs +0 -199
- package/.lgtm.yml +0 -9
- package/.prettierrc.json +0 -15
- package/.stylelintrc.json +0 -236
- package/compile.cjs +0 -51
- package/cypress/e2e/color-palette.cy.ts +0 -128
- package/cypress/e2e/color-picker.cy.ts +0 -909
- package/cypress/fixtures/colorNamesFrench.js +0 -3
- package/cypress/fixtures/componentLabelsFrench.js +0 -21
- package/cypress/fixtures/format.js +0 -3
- package/cypress/fixtures/getMarkup.js +0 -35
- package/cypress/fixtures/getRandomInt.js +0 -6
- package/cypress/fixtures/sampleWebcolors.js +0 -18
- package/cypress/fixtures/testSample.js +0 -8
- package/cypress/plugins/esbuild-istanbul.ts +0 -50
- package/cypress/plugins/tsCompile.ts +0 -34
- package/cypress/support/commands.ts +0 -0
- package/cypress/support/e2e.ts +0 -21
- package/cypress/test.html +0 -23
- package/cypress.config.ts +0 -30
- package/dts.config.ts +0 -15
- package/src/scss/_variables.scss +0 -6
- package/src/scss/color-picker.rtl.scss +0 -27
- package/src/scss/color-picker.scss +0 -536
- package/src/ts/colorPalette.ts +0 -89
- package/src/ts/index.ts +0 -1236
- package/src/ts/interface/ColorNames.ts +0 -20
- package/src/ts/interface/colorPickerLabels.ts +0 -20
- package/src/ts/interface/colorPickerOptions.ts +0 -11
- package/src/ts/interface/paletteOptions.ts +0 -6
- package/src/ts/util/colorNames.ts +0 -21
- package/src/ts/util/colorPickerLabels.ts +0 -24
- package/src/ts/util/getColorControls.ts +0 -90
- package/src/ts/util/getColorForm.ts +0 -75
- package/src/ts/util/getColorMenu.ts +0 -83
- package/src/ts/util/isValidJSON.ts +0 -19
- package/src/ts/util/setMarkup.ts +0 -130
- package/src/ts/util/vHidden.ts +0 -2
- package/tsconfig.json +0 -29
- package/vite.config.mts +0 -35
@@ -1,128 +0,0 @@
|
|
1
|
-
/// <reference types="cypress" />
|
2
|
-
|
3
|
-
import Color from "@thednp/color";
|
4
|
-
import ColorPalette from "../../src/ts/colorPalette";
|
5
|
-
|
6
|
-
describe("ColorPalette Class Test", () => {
|
7
|
-
it("Test init with no parameter, use all default values", () => {
|
8
|
-
cy.wrap(new ColorPalette()).as("cpl")
|
9
|
-
.get("@cpl").should("be.instanceOf", ColorPalette)
|
10
|
-
.get("@cpl").its("hue").should("equal", 0)
|
11
|
-
.get("@cpl").its("hueSteps").should("equal", 12)
|
12
|
-
.get("@cpl").its("lightSteps").should("equal", 10)
|
13
|
-
.get("@cpl").its("colors").its("length").should("equal", 120);
|
14
|
-
});
|
15
|
-
|
16
|
-
it("Test init with 1 parameter, throws error", () => {
|
17
|
-
try {
|
18
|
-
new ColorPalette(0, undefined);
|
19
|
-
} catch (error) {
|
20
|
-
expect(error).to.be.instanceOf(TypeError);
|
21
|
-
expect(error).to.have.property(
|
22
|
-
"message",
|
23
|
-
'ColorPalette: the two minimum arguments must be numbers higher than 0.'
|
24
|
-
);
|
25
|
-
}
|
26
|
-
});
|
27
|
-
|
28
|
-
// it("Test init with 1 parameter, throws error", () => {
|
29
|
-
// try {
|
30
|
-
// // @ts-ignore
|
31
|
-
// new ColorPalette(0, 'a');
|
32
|
-
// } catch (error) {
|
33
|
-
// expect(error).to.be.instanceOf(TypeError);
|
34
|
-
// expect(error).to.have.property(
|
35
|
-
// "message",
|
36
|
-
// 'ColorPalette only accepts numbers.'
|
37
|
-
// );
|
38
|
-
// }
|
39
|
-
// });
|
40
|
-
|
41
|
-
it("Test init with 2 invalid parameters, throws error", () => {
|
42
|
-
try {
|
43
|
-
new ColorPalette(0, 5);
|
44
|
-
} catch (error) {
|
45
|
-
expect(error).to.be.instanceOf(TypeError);
|
46
|
-
expect(error).to.have.property(
|
47
|
-
"message",
|
48
|
-
'ColorPalette: the two minimum arguments must be numbers higher than 0.'
|
49
|
-
);
|
50
|
-
}
|
51
|
-
});
|
52
|
-
|
53
|
-
it("Test init with 2 valid parameters", () => {
|
54
|
-
// generated with new `ColorPalette(1, 5)`
|
55
|
-
const testSample = ["#330000", "#990000", "#ff0000", "#ff6666", "#ffcccc"];
|
56
|
-
|
57
|
-
cy.wrap(new ColorPalette(1, 5)).as("cpl")
|
58
|
-
.get("@cpl").its("hue").should("equal", 0)
|
59
|
-
.get("@cpl").its("hueSteps").should("equal", 1)
|
60
|
-
.get("@cpl").its("lightSteps").should("equal", 5)
|
61
|
-
.get("@cpl").its("saturation").should("equal", 100)
|
62
|
-
.get("@cpl").its("colors").its("length").should("equal", 5)
|
63
|
-
.get("@cpl").its("colors").then((colors) => {
|
64
|
-
// really test every color in the palette
|
65
|
-
colors.forEach((color: Color, i: number) => {
|
66
|
-
cy.log(`${color.ok}`)
|
67
|
-
expect(color).to.be.instanceOf(Color);
|
68
|
-
// expect(color.ok).to.be.true;
|
69
|
-
expect(color.toHexString()).to.equal(testSample[i]);
|
70
|
-
});
|
71
|
-
});
|
72
|
-
});
|
73
|
-
|
74
|
-
it("Test init with 14 lightSteps", () => {
|
75
|
-
// generated with `new ColorPalette(1, 14)`
|
76
|
-
const testSample = [
|
77
|
-
"#330000", "#550000", "#770000", "#990000", "#bb0000",
|
78
|
-
"#dd0000", "#ff0000", "#ff2222", "#ff4444", "#ff6666",
|
79
|
-
"#ff8888", "#ffaaaa", "#ffcccc", "#ffeeee",
|
80
|
-
];
|
81
|
-
|
82
|
-
cy.wrap(new ColorPalette(1, 14)).as("cpl")
|
83
|
-
.get("@cpl").its("hue").should("equal", 0)
|
84
|
-
.get("@cpl").its("hueSteps").should("equal", 1)
|
85
|
-
.get("@cpl").its("lightSteps").should("equal", 14)
|
86
|
-
.get("@cpl").its("colors").its("length").should("equal", 14)
|
87
|
-
.get("@cpl").its("colors").then((colors) => {
|
88
|
-
expect(colors.map((c: Color) => c.toHexString())).to.deep.equal(testSample);
|
89
|
-
});
|
90
|
-
});
|
91
|
-
|
92
|
-
it("Test init with 15 lightSteps", () => {
|
93
|
-
// generated with `new ColorPalette(1, 15)`
|
94
|
-
const testSample = [
|
95
|
-
"#110000", "#330000", "#550000", "#770000",
|
96
|
-
"#990000", "#bb0000", "#dd0000", "#ff0000",
|
97
|
-
"#ff2222", "#ff4444", "#ff6666", "#ff8888",
|
98
|
-
"#ffaaaa", "#ffcccc", "#ffeeee",
|
99
|
-
];
|
100
|
-
|
101
|
-
cy.wrap(new ColorPalette(1, 15)).as("cpl")
|
102
|
-
.get("@cpl").its("hue").should("equal", 0)
|
103
|
-
.get("@cpl").its("hueSteps").should("equal", 1)
|
104
|
-
.get("@cpl").its("lightSteps").should("equal", 15)
|
105
|
-
.get("@cpl").its("colors").its("length").should("equal", 15)
|
106
|
-
.get("@cpl").its("colors").then((colors) => {
|
107
|
-
expect(colors.map((c: Color) => c.toHexString())).to.deep.equal(testSample);
|
108
|
-
});
|
109
|
-
});
|
110
|
-
|
111
|
-
it("Test init with 3 valid parameters", () => {
|
112
|
-
// generated with `new ColorPalette(270, 1, 10)`
|
113
|
-
const testSample = [
|
114
|
-
"#240047", "#3b0075", "#5200a3", "#6900d1",
|
115
|
-
"#8000ff", "#962eff", "#ad5cff", "#c48aff",
|
116
|
-
"#dbb8ff", "#f2e6ff",
|
117
|
-
];
|
118
|
-
|
119
|
-
cy.wrap(new ColorPalette(270, 1, 10)).as("cpl")
|
120
|
-
.get("@cpl").its("hue").should("equal", 270)
|
121
|
-
.get("@cpl").its("hueSteps").should("equal", 1)
|
122
|
-
.get("@cpl").its("lightSteps").should("equal", 10)
|
123
|
-
.get("@cpl").its("colors").its("length").should("equal", 10)
|
124
|
-
.get("@cpl").its("colors").then((colors) => {
|
125
|
-
expect(colors.map((c: Color) => c.toHexString())).to.deep.equal(testSample);
|
126
|
-
});
|
127
|
-
});
|
128
|
-
});
|