Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore default plain Link appearance for result builder-based initializers. #760

Merged
merged 1 commit into from
Mar 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Sources/Ignite/Elements/Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public struct Link: InlineElement, NavigationItem, DropdownItem {
public init(target: String, @HTMLBuilder content: @escaping () -> some HTML) {
self.content = content()
self.url = target
self.role = .none
}

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

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

/// Controls in which window this page should be opened.
Expand Down
2 changes: 1 addition & 1 deletion Tests/IgniteTesting/Elements/Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import Testing

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

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

@Test("Link Warning Role", arguments: zip(await pages, await Self.sites))
Expand Down
2 changes: 1 addition & 1 deletion Tests/IgniteTesting/Subsite/Subsite.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ class SubsiteTests: IgniteSubsiteTestSuite {
}
let output = element.render()

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