Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
twm committed Oct 30, 2024
1 parent 4b41920 commit 082b76e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
18 changes: 9 additions & 9 deletions src/lib/FracInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@
<button
disabled={min == null || value - step < min}
on:click={() => {
value -= step;
rawValue = frac(value);
}}
>-{frac(step)}</button>
value -= step
rawValue = frac(value)
}}>-{frac(step)}</button
>
<button
disabled={max == null || value + step > max}
on:click={() => {
value += step;
rawValue = frac(value);
}}
>+{frac(step)}</button>
value += step
rawValue = frac(value)
}}>+{frac(step)}</button
>
{/if}
</span>

Expand Down Expand Up @@ -113,7 +113,7 @@
background: white;
}
button:active {
border-style: inset; /* even prettier ✨ */
border-style: inset; /* even prettier ✨ */
}
button:disabled {
opacity: 0.5;
Expand Down
28 changes: 14 additions & 14 deletions src/lib/frac.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { frac, parseFrac } from "$lib/frac"

describe("frac renders numbers as mixed fractions", () => {
const cases: [number, string][] = [
[-1 - 3 / 8, "-1\u20093⁄8\""],
[-1, "-1\""],
[0, "0\""],
[1, "1\""],
[1.5, "1\u20091⁄2\""],
[12.25, "12\u20091⁄4\""],
[-6.125, "-6\u20091⁄8\""],
[1 / 4, "1⁄4\""],
[7 / 8, "7⁄8\""],
[15 / 16, "15⁄16\""],
[1 + 17 / 32, "1\u200917⁄32\""],
[23 / 32, "23⁄32\""],
[3 + 61.5 / 64, "3\u200931⁄32\""],
[-1 - 3 / 8, '-1\u20093⁄8"'],
[-1, '-1"'],
[0, '0"'],
[1, '1"'],
[1.5, '1\u20091⁄2"'],
[12.25, '12\u20091⁄4"'],
[-6.125, '-6\u20091⁄8"'],
[1 / 4, '1⁄4"'],
[7 / 8, '7⁄8"'],
[15 / 16, '15⁄16"'],
[1 + 17 / 32, '1\u200917⁄32"'],
[23 / 32, '23⁄32"'],
[3 + 61.5 / 64, '3\u200931⁄32"'],
]
test.for(cases)("renders %d as %s", ([n, s]) => {
expect(frac(n)).toEqual(s)
Expand Down Expand Up @@ -70,7 +70,7 @@ describe("parseFrac converts strings to numbers", () => {
["1' + 2", 14],
["1'+2\"", 14],
["1/2' +12\"", 18],
["3'4'5'6'1/2'", (3 + 4 + 5 + 6 + 0.5) * 12]
["3'4'5'6'1/2'", (3 + 4 + 5 + 6 + 0.5) * 12],
]
test.for(cases)("parses %j as %d", ([s, n]) => {
expect(parseFrac(s)).toEqual(n)
Expand Down

0 comments on commit 082b76e

Please # to comment.