From 8d1cd7533e61091b929d5429e3566d7284714903 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Fri, 28 Apr 2023 11:18:31 -0400 Subject: [PATCH] print beam --- .../print/PrintShip/Firecons/index.svelte | 19 +++++++++++++++ .../print/PrintShip/Weapons/Beam.svelte} | 17 +------------ .../PrintShip/Weapons/index.story.svelte | 24 +++++++++++++++++++ .../print/PrintShip/Weapons/index.svelte | 10 ++++++++ .../print/PrintShip/Weapons/index.test.js | 12 ++++++++++ .../print/PrintShip/Weapons/printComps.js | 5 ++++ .../export/print/PrintShip/index.svelte | 12 ++++++++++ 7 files changed, 83 insertions(+), 16 deletions(-) create mode 100644 src/routes/export/print/PrintShip/Firecons/index.svelte rename src/{lib/components/Output/Print/Weapons/Beam/index.svelte => routes/export/print/PrintShip/Weapons/Beam.svelte} (57%) create mode 100644 src/routes/export/print/PrintShip/Weapons/index.story.svelte create mode 100644 src/routes/export/print/PrintShip/Weapons/index.svelte create mode 100644 src/routes/export/print/PrintShip/Weapons/index.test.js create mode 100644 src/routes/export/print/PrintShip/Weapons/printComps.js diff --git a/src/routes/export/print/PrintShip/Firecons/index.svelte b/src/routes/export/print/PrintShip/Firecons/index.svelte new file mode 100644 index 0000000..a777156 --- /dev/null +++ b/src/routes/export/print/PrintShip/Firecons/index.svelte @@ -0,0 +1,19 @@ +
+ {#each Array.from({ length: stations }) as firecon} + firecon + {/each} +
+ + + + diff --git a/src/lib/components/Output/Print/Weapons/Beam/index.svelte b/src/routes/export/print/PrintShip/Weapons/Beam.svelte similarity index 57% rename from src/lib/components/Output/Print/Weapons/Beam/index.svelte rename to src/routes/export/print/PrintShip/Weapons/Beam.svelte index 635f66e..ab51c34 100644 --- a/src/lib/components/Output/Print/Weapons/Beam/index.svelte +++ b/src/routes/export/print/PrintShip/Weapons/Beam.svelte @@ -1,11 +1,4 @@ -
+
{weaponClass} @@ -14,20 +7,12 @@
diff --git a/src/routes/export/print/PrintShip/Weapons/index.test.js b/src/routes/export/print/PrintShip/Weapons/index.test.js new file mode 100644 index 0000000..75d5c26 --- /dev/null +++ b/src/routes/export/print/PrintShip/Weapons/index.test.js @@ -0,0 +1,12 @@ +import { render, fireEvent } from "@testing-library/svelte"; +import "@testing-library/jest-dom"; +import { weaponTypes } from "$lib/store/ship/weaponry/rules"; + +import printComp from "./printComp.js"; + +describe("all weapons have a print component", () => { + test.each(weaponTypes)("$type", ({ type, initial }) => { + expect(printComp).toHaveProperty(type); + render(printComp[type], { props: initial }); + }); +}); diff --git a/src/routes/export/print/PrintShip/Weapons/printComps.js b/src/routes/export/print/PrintShip/Weapons/printComps.js new file mode 100644 index 0000000..511ba3b --- /dev/null +++ b/src/routes/export/print/PrintShip/Weapons/printComps.js @@ -0,0 +1,5 @@ +import Beam from "./Beam.svelte"; + +export default { + beam: Beam, +}; diff --git a/src/routes/export/print/PrintShip/index.svelte b/src/routes/export/print/PrintShip/index.svelte index bcdacaf..3d92946 100644 --- a/src/routes/export/print/PrintShip/index.svelte +++ b/src/routes/export/print/PrintShip/index.svelte @@ -3,6 +3,8 @@