feat: Moves vendor branch views to their own files, starts to implement snapshot testing for html

This commit is contained in:
2025-01-21 09:51:11 -05:00
parent 40726c8bd7
commit 97b231767e
15 changed files with 231 additions and 71 deletions

View File

@@ -0,0 +1,12 @@
@testable import App
import Elementary
import HtmlSnapshotTesting
import SnapshotTesting
import XCTest
final class SnapshotTestingTests: XCTestCase {
func testSimple() {
let doc = MainPage.loggedIn(next: nil)
assertSnapshot(of: doc, as: .html)
}
}

View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Purchase Orders</title>
<meta charset="UTF-8">
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
<script src="/js/main.js"></script>
<link rel="stylesheet" href="/css/main.css">
<link rel="icon" href="/images/favicon.ico" type="image/x-icon">
</head>
<body>
<header class="header">
<div id="logo">HHE - Purchase Orders</div>
<div class="sidepanel" id="sidepanel">
<a href="javascript:void(0)" class="closebtn" onclick="closeSidepanel()">x</a><a hx-get="/purchase-orders?page=1&amp;limit=50" hx-target="body" hx-push-url="true">Purchase Orders</a><a hx-get="/users" hx-target="body" hx-push-url="true">Users</a><a hx-get="/employees" hx-target="body" hx-push-url="true">Employees</a><a hx-get="/vendors" hx-target="body" hx-push-url="true">Vendors</a>
<div style="border-bottom: 1px solid grey; margin-bottom: 5px;"></div>
Logout<a hx-post="/logout" hx-target="#content" hx-swap="outerHTML" hx-trigger="click"></a>
</div>
<button class="openbtn" onclick="openSidepanel()">
<img src="/images/menu.svg" style="width: 30px;, height: 30px;">
</button>
</header>
<div class="container" style="padding: 20px 20px;">
<h1>Purchase Orders</h1>
<br>
<p class="secondary"><i></i></p>
<br>
</div>
<div hx-get="/purchase-orders" hx-push-url="true" hx-target="body" hx-trigger="revealed" hx-indicator=".hx-indicator">
<img src="/images/spinner.svg" width="30" height="30" class="hx-indicator">
</div>
</body>
</html>