Skip to content

Commit 7c0d61a

Browse files
committed
Add link tests
1 parent 4563cff commit 7c0d61a

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Tests/RenderingTests/LinkTests.swift

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Carson Katri on 1/17/23.
6+
//
7+
8+
import XCTest
9+
import SwiftUI
10+
@testable import LiveViewNative
11+
12+
@MainActor
13+
final class LinkTests: XCTestCase {
14+
func testSimple() throws {
15+
try assertMatch(#"<lvn-link destination="https://apple.com">Hello, world!</lvn-link>"#) {
16+
Link("Hello, world!", destination: URL(string: "https://apple.com")!)
17+
}
18+
}
19+
20+
func testComplexBody() throws {
21+
try assertMatch(#"""
22+
<lvn-link destination="https://apple.com">
23+
<hstack>
24+
<image system-name="link" />
25+
<text>Click the link</text>
26+
</hstack>
27+
</lvn-link>
28+
"""#) {
29+
Link(destination: URL(string: "https://apple.com")!) {
30+
HStack {
31+
Image(systemName: "link")
32+
Text("Click the link")
33+
}
34+
}
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)