mirror of
https://github.com/penpot/penpot.git
synced 2025-06-28 13:26:58 +02:00
🐛 Fix incorrect decoding of library color
This commit is contained in:
parent
644dd9ff44
commit
a8433bcef3
5 changed files with 51 additions and 3 deletions
|
@ -117,7 +117,7 @@
|
||||||
(sm/decode-fn types.shape/schema:shape-attrs sm/json-transformer))
|
(sm/decode-fn types.shape/schema:shape-attrs sm/json-transformer))
|
||||||
|
|
||||||
(def decode-library-color
|
(def decode-library-color
|
||||||
(sm/decode-fn types.color/schema:color sm/json-transformer))
|
(sm/decode-fn types.color/schema:library-color sm/json-transformer))
|
||||||
|
|
||||||
(def decode-library-typography
|
(def decode-library-typography
|
||||||
(sm/decode-fn types.typography/schema:typography sm/json-transformer))
|
(sm/decode-fn types.typography/schema:typography sm/json-transformer))
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 1.0.6
|
||||||
|
|
||||||
|
- Fix unexpected issue on library color decoding
|
||||||
|
|
||||||
|
|
||||||
## 1.0.5
|
## 1.0.5
|
||||||
|
|
||||||
- Add progress reporting support
|
- Add progress reporting support
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{:paths ["src" "vendor" "resources" "test"]
|
{:paths ["src"]
|
||||||
:deps
|
:deps
|
||||||
{penpot/common
|
{penpot/common
|
||||||
{:local/root "../common"}
|
{:local/root "../common"}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@penpot/library",
|
"name": "@penpot/library",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"author": "Kaleidos INC",
|
"author": "Kaleidos INC",
|
||||||
"packageManager": "yarn@4.9.1+sha512.f95ce356460e05be48d66401c1ae64ef84d163dd689964962c6888a9810865e39097a5e9de748876c2e0bf89b232d583c33982773e9903ae7a76257270986538",
|
"packageManager": "yarn@4.9.1+sha512.f95ce356460e05be48d66401c1ae64ef84d163dd689964962c6888a9810865e39097a5e9de748876c2e0bf89b232d583c33982773e9903ae7a76257270986538",
|
||||||
|
|
|
@ -75,3 +75,46 @@ test("create context with file and page", () => {
|
||||||
assert.ok(rootShape, "root shape should exist");
|
assert.ok(rootShape, "root shape should exist");
|
||||||
assert.equal(rootShape.id, "00000000-0000-0000-0000-000000000000");
|
assert.equal(rootShape.id, "00000000-0000-0000-0000-000000000000");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("create context with color", () => {
|
||||||
|
const context = penpot.createBuildContext();
|
||||||
|
|
||||||
|
const fileId = context.addFile({name: "file 1"});
|
||||||
|
const pageId = context.addPage({name: "page 1"});
|
||||||
|
|
||||||
|
const colorId = context.genId();
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
color: '#000000',
|
||||||
|
gradient: undefined,
|
||||||
|
id: colorId,
|
||||||
|
image: undefined,
|
||||||
|
name: 'Black-8',
|
||||||
|
opacity: 0.800000011920929,
|
||||||
|
path: 'Remote',
|
||||||
|
};
|
||||||
|
|
||||||
|
context.addLibraryColor(params);
|
||||||
|
|
||||||
|
const internalState = context.getInternalState();
|
||||||
|
|
||||||
|
const file = internalState.files[fileId];
|
||||||
|
|
||||||
|
assert.ok(file, "file should exist");
|
||||||
|
|
||||||
|
assert.ok(file.data);
|
||||||
|
assert.ok(file.data.pages);
|
||||||
|
|
||||||
|
const colors = file.data.colors
|
||||||
|
|
||||||
|
assert.ok(colors, "colors should exist");
|
||||||
|
|
||||||
|
const color = colors[colorId];
|
||||||
|
|
||||||
|
assert.ok(color, "color objects should exist");
|
||||||
|
assert.equal(color.color, params.color);
|
||||||
|
assert.equal(color.id, colorId);
|
||||||
|
assert.equal(color.path, params.path);
|
||||||
|
assert.equal(color.opacity, params.opacity);
|
||||||
|
assert.equal(color.name, params.name);
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue