Skip to content

Commit

Permalink
copy over icon name and author when upgrading document versions
Browse files Browse the repository at this point in the history
  • Loading branch information
effortlessmountain committed Apr 19, 2020
1 parent 948d8e1 commit 067901a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h3>How do I add an icon to my asset?</h3>
<div class="container">
<div class="assets"></div>
<div class="interface">
<h2>Ironsworn Asset Workbench v0.6.0</h2>
<h2>Ironsworn Asset Workbench v0.6.1</h2>
<div class="top-row-controls">
<div>
<label>Scale (also affects Download size)</label>
Expand Down
12 changes: 12 additions & 0 deletions src/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ describe("transforming from schema v1 to v2", () => {
viewBox: "0 0 512 512"
}

test("name gets copied over", () => {
const result = transformToLatest(createV1Asset())

expect((result.icon as SvgIcon).name).toBe((v2Asset.icon as SvgIcon).name)
})

test("author gets copied over", () => {
const result = transformToLatest(createV1Asset())

expect((result.icon as SvgIcon).author).toBe((v2Asset.icon as SvgIcon).author)
})

const svgProperties = ["d", "fill", "fillOpacity", "viewBox"]

svgProperties.forEach((prop) => {
Expand Down
4 changes: 2 additions & 2 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ function transformToV2(v1: AssetDocumentV1): AssetDocumentV2 {
} else if (typeof v1.icon === "object") {
v2.icon = {
type: "svg",
author: "",
name: "",
author: v1.icon.author,
name: v1.icon.name,
svg: transformSvgString(v1.icon.svg)
}

Expand Down

0 comments on commit 067901a

Please sign in to comment.