Skip to content

Commit df77502

Browse files
authored
Merge pull request #760 from JPToroDev/links
Restore default plain `Link` appearance for result builder-based initializers.
2 parents 073a549 + db18484 commit df77502

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Sources/Ignite/Elements/Link.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public struct Link: InlineElement, NavigationItem, DropdownItem {
8686
public init(target: String, @HTMLBuilder content: @escaping () -> some HTML) {
8787
self.content = content()
8888
self.url = target
89+
self.role = .none
8990
}
9091

9192
/// Creates a Link wrapping the provided content and pointing to the given page
@@ -95,6 +96,7 @@ public struct Link: InlineElement, NavigationItem, DropdownItem {
9596
public init(target: any StaticPage, @HTMLBuilder content: @escaping () -> some HTML) {
9697
self.content = content()
9798
self.url = target.path
99+
self.role = .none
98100
}
99101

100102
/// Creates a `Link` wrapping the provided content and pointing to the path
@@ -105,6 +107,7 @@ public struct Link: InlineElement, NavigationItem, DropdownItem {
105107
public init(target article: Article, @HTMLBuilder content: @escaping () -> some HTML) {
106108
self.content = content()
107109
self.url = article.path
110+
self.role = .none
108111
}
109112

110113
/// Controls in which window this page should be opened.

Tests/IgniteTesting/Elements/Link.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import Testing
5151

5252
let expectedPath = PublishingContext.shared.path(for: URL(string: page.path)!)
5353

54-
#expect(output == "<a href=\"\(expectedPath)\">MORE <p>CONTENT</p></a>")
54+
#expect(output == "<a href=\"\(expectedPath)\" class=\"link-plain\">MORE <p>CONTENT</p></a>")
5555
}
5656

5757
@Test("Link Warning Role", arguments: zip(await pages, await Self.sites))

Tests/IgniteTesting/Subsite/Subsite.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ class SubsiteTests: IgniteSubsiteTestSuite {
9090
}
9191
let output = element.render()
9292

93-
#expect(output == "<a href=\"\(page.path)\">MORE <p>CONTENT</p></a>")
93+
#expect(output == "<a href=\"\(page.path)\" class=\"link-plain\">MORE <p>CONTENT</p></a>")
9494
}
9595
}

0 commit comments

Comments
 (0)