-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
! gradient calculation if both values are in the same color range
+ recommended temperature colors export !! TypeScript `lib` field updated to `es2023`
- Loading branch information
Showing
6 changed files
with
72 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,21 @@ | ||
import must from "must"; | ||
|
||
import { getColor } from "./index"; | ||
|
||
const myColors = [ | ||
{ | ||
value: -30, | ||
color: "#0046B9", | ||
}, | ||
{ | ||
value: 0, | ||
color: "#00FFFF", | ||
}, | ||
{ | ||
value: 10, | ||
color: "#01cc01", | ||
}, | ||
{ | ||
value: 20, | ||
color: "#FFFF00", | ||
}, | ||
{ | ||
value: 30, | ||
color: "#FF4D00", | ||
}, | ||
]; | ||
import { getColor, getCSSGradient, recommendedTemperatureColors as myColors } from "./index"; | ||
|
||
// @TODO more tests | ||
|
||
describe("getColor", () => { | ||
it("should return first color if value less than the range", () => { | ||
must(getColor(myColors, -40)).equal("#0046B9"); | ||
}); | ||
|
||
it("should return last color if value greater than the range", () => { | ||
must(getColor(myColors, 40)).equal("#FF4D00"); | ||
}); | ||
}); | ||
|
||
describe("getCSSGradient", () => { | ||
it("must work with values from a single entry", () => { | ||
must(getCSSGradient(myColors, 21, 25)).equal("linear-gradient(to right, #ffed00 0%, #ffa600 100%)"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
"isolatedModules": true, | ||
"jsx": "react-jsx", | ||
"lib": [ | ||
"es2022", | ||
"es2023", | ||
"dom" | ||
], | ||
"mapRoot": null, | ||
|