From bb88d48eb3c8951302208c2ac6dc202057b1f2b8 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Sun, 8 Feb 2026 10:27:23 -0500 Subject: [PATCH] feat: Updates tests to include home page snapshot test, updates TODO's. --- Sources/ViewController/Views/Home.swift | 10 +++ TODO.md | 7 +- .../ViewControllerTests.swift | 13 ++++ .../ViewControllerTests/home.1.html | 73 +++++++++++++++++++ .../ViewControllerTests/projectDetail.1.html | 1 + .../ViewControllerTests/projectDetail.2.html | 1 + .../ViewControllerTests/projectDetail.3.html | 1 + .../ViewControllerTests/projectDetail.4.html | 1 + .../ViewControllerTests/projectDetail.5.html | 1 + .../ViewControllerTests/projectDetail.6.html | 1 + .../ViewControllerTests/projectIndex.1.html | 1 + .../ViewControllerTests/userProfile.1.html | 1 + 12 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/home.1.html diff --git a/Sources/ViewController/Views/Home.swift b/Sources/ViewController/Views/Home.swift index 7442eb9..7acd898 100644 --- a/Sources/ViewController/Views/Home.swift +++ b/Sources/ViewController/Views/Home.swift @@ -4,6 +4,16 @@ import ElementaryHTMX struct HomeView: HTML, Sendable { var body: some HTML { + div(.class("flex justify-end me-4")) { + button( + .class("btn btn-ghost btn-secondary text-lg"), + .hx.get(route: .login(.index())), + .hx.target("body"), + .hx.swap(.outerHTML) + ) { + "Login" + } + } div(.class("hero min-h-screen")) { div( .class( diff --git a/TODO.md b/TODO.md index 319e29a..8c53de0 100644 --- a/TODO.md +++ b/TODO.md @@ -3,16 +3,17 @@ - [x] Fix theme not working when selected upon signup. - [x] Pdf generation - [x] Add postgres / mysql support -- [ ] Opensource / license ?? +- [x] Opensource / license ?? - [ ] Figure out domain to host (currently thinking ductcalc.pro) - [ ] Logo / navbar name may have to change if it's not duct-calc. - [ ] MainPage meta items will have to change also -- [ ] Add ability for either sensible or total load while specifying a room load. +- [x] Add ability for either sensible or total load while specifying a room load. - CoolCalc current version specifies the sensible cooling for a room break down, and currently we require the total load and calculate sensible based on project shr. -- [ ] Add ability to associate room load / airflow with another room. +- [x] Add ability to associate room load / airflow with another room. - [ ] Trunk size form, room / register selection is wonky when labels are long. - They will overlap each other making it difficult to read / decipher which checkbox belongs to which label. - [ ] Add select all rooms for trunks, useful for sizing main supply or return trunks. +- [ ] Add way to sponsor the project. diff --git a/Tests/ViewControllerTests/ViewControllerTests.swift b/Tests/ViewControllerTests/ViewControllerTests.swift index 2eab389..c9afb05 100644 --- a/Tests/ViewControllerTests/ViewControllerTests.swift +++ b/Tests/ViewControllerTests/ViewControllerTests.swift @@ -14,6 +14,19 @@ import ViewController @Suite(.snapshots(record: .failed)) struct ViewControllerTests { + @Test + func home() async throws { + try await withDependencies { + $0.viewController = .liveValue + $0.auth = .failing + } operation: { + @Dependency(\.viewController) var viewController + + let home = try await viewController.view(.test(.home)) + assertSnapshot(of: home, as: .html) + } + } + @Test func login() async throws { try await withDependencies { diff --git a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/home.1.html b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/home.1.html new file mode 100644 index 0000000..28155e6 --- /dev/null +++ b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/home.1.html @@ -0,0 +1,73 @@ + + + + Duct Calc + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+
+
+
+
+

Duct Calc

+
+ Pro +
+
+
+ Open source residential duct design program +

Manual-D™ speed sheet, but on the web!

+ +

+ Manual-D™ is a trademark of Air Conditioning Contractors of America (ACCA). + + This site is not designed by or affiliated with ACCA. +

+
+
+
+
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.1.html b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.1.html index ca19d9c..38b64fe 100644 --- a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.1.html +++ b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.1.html @@ -245,6 +245,7 @@ is-drawer-close:justify-center is-drawer-close:mx-auto is-drawer-close:space-y-2 bg-base-300 text-base-content p-4"> diff --git a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.2.html b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.2.html index 33c65b6..28a6303 100644 --- a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.2.html +++ b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.2.html @@ -675,6 +675,7 @@ is-drawer-close:justify-center is-drawer-close:mx-auto is-drawer-close:space-y-2 bg-base-300 text-base-content p-4"> diff --git a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.3.html b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.3.html index 0513085..58c477c 100644 --- a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.3.html +++ b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.3.html @@ -230,6 +230,7 @@ is-drawer-close:justify-center is-drawer-close:mx-auto is-drawer-close:space-y-2 bg-base-300 text-base-content p-4"> diff --git a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.4.html b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.4.html index 443518e..60cfcad 100644 --- a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.4.html +++ b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.4.html @@ -360,6 +360,7 @@ is-drawer-close:justify-center is-drawer-close:mx-auto is-drawer-close:space-y-2 bg-base-300 text-base-content p-4"> diff --git a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.5.html b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.5.html index 4bf598b..12297c1 100644 --- a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.5.html +++ b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.5.html @@ -436,6 +436,7 @@ is-drawer-close:justify-center is-drawer-close:mx-auto is-drawer-close:space-y-2 bg-base-300 text-base-content p-4"> diff --git a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.6.html b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.6.html index 0013fdf..9d10a87 100644 --- a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.6.html +++ b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectDetail.6.html @@ -1555,6 +1555,7 @@ is-drawer-close:justify-center is-drawer-close:mx-auto is-drawer-close:space-y-2 bg-base-300 text-base-content p-4"> diff --git a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectIndex.1.html b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectIndex.1.html index e1f8f9f..fec8abc 100644 --- a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectIndex.1.html +++ b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/projectIndex.1.html @@ -105,6 +105,7 @@ p-6 w-full pb-6"> bg-base-300 text-base-content p-4"> diff --git a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/userProfile.1.html b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/userProfile.1.html index 62a38d4..d06c1c5 100644 --- a/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/userProfile.1.html +++ b/Tests/ViewControllerTests/__Snapshots__/ViewControllerTests/userProfile.1.html @@ -153,6 +153,7 @@ bg-base-300 text-base-content p-4">