Implemented phase 2 for the POC prototype in the Website service.
This commit is contained in:
1 parent
09c7b8a1a7
commit
43dcc03da6
28 files changed
+1468
-65
No files matched your search
@@ -121,8 +121,71 @@ struct CataloguePagesTests {
|
||||
#expect(html.contains("<dt>Condition</dt>"))
|
||||
}
|
||||
|
||||
@Test
|
||||
func `listing page opens its actions to a signed-in viewer`() {
|
||||
let html = ListingPage(
|
||||
listing: .stub(),
|
||||
related: [],
|
||||
viewer: .init(displayName: "Mara Visser")
|
||||
).render()
|
||||
|
||||
#expect(html.contains(#"href="/listing/nightward-1/buy""#))
|
||||
#expect(html.contains(#"href="/listing/nightward-1/offer""#))
|
||||
#expect(html.contains(#"href="/messages/new?listing=nightward-1""#))
|
||||
#expect(html.contains(#"aria-label="Account of Mara Visser""#))
|
||||
#expect(!html.contains("gate-note"))
|
||||
#expect(html.contains(#"disabled title="Not part of the prototype">Save"#))
|
||||
}
|
||||
|
||||
// MARK: ShopPage tests
|
||||
|
||||
@Test
|
||||
func `shop page opens its actions to a signed-in viewer`() {
|
||||
let html = ShopPage(
|
||||
shop: .stub(),
|
||||
inventory: [],
|
||||
matches: [],
|
||||
parameters: .init(),
|
||||
viewer: .init(displayName: "Mara Visser")
|
||||
).render()
|
||||
|
||||
#expect(html.contains(#"href="/messages/new?shop=kestrel-row-comics""#))
|
||||
#expect(!html.contains("Both need a passkey sign-in"))
|
||||
#expect(!html.contains("/sign-in?return="))
|
||||
}
|
||||
|
||||
// MARK: SignInPage tests
|
||||
|
||||
@Test
|
||||
func `sign-in page is bare, states the intent, and carries the return path`() {
|
||||
let html = SignInPage(
|
||||
returnPath: "/listing/nightward-1",
|
||||
intent: "To buy Nightward #1"
|
||||
).render()
|
||||
|
||||
#expect(html.contains("To buy Nightward #1"))
|
||||
#expect(html.contains(#"action="/sign-in" method="post""#))
|
||||
#expect(html.contains(#"name="return" value="/listing/nightward-1""#))
|
||||
#expect(html.contains(#"href="/listing/nightward-1" aria-label="Close and go back""#))
|
||||
#expect(html.contains(#"content="noindex""#))
|
||||
#expect(html.contains("/css/sign-in.css"))
|
||||
#expect(!html.contains("site-header"))
|
||||
#expect(!html.contains("site-footer"))
|
||||
#expect(!html.contains("aria-invalid"))
|
||||
#expect(!html.contains("style="))
|
||||
}
|
||||
|
||||
@Test
|
||||
func `sign-in page ties an error to the email field`() {
|
||||
let html = SignInPage(
|
||||
returnPath: "/",
|
||||
error: "That doesn't look like an email address."
|
||||
).render()
|
||||
|
||||
#expect(html.contains(#"aria-invalid="true" aria-describedby="email-error""#))
|
||||
#expect(html.contains(#"id="email-error">That doesn't look like an email address.</p>"#))
|
||||
}
|
||||
|
||||
@Test
|
||||
func `shop page counts its tabs from the whole inventory and lists the matches`() {
|
||||
let inventory = [
|
||||
|
||||
Reference in new issue
Block a user