Skip to content

Commit

Permalink
conform <link> to HasCrossorigin (#87)
Browse files Browse the repository at this point in the history
Co-authored-by: atacan <[email protected]>
Co-authored-by: Stephen Celis <[email protected]>
  • Loading branch information
3 people authored Oct 21, 2024
1 parent d84ff12 commit 45bc3e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions Sources/Html/Attributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ public protocol HasCrossorigin {}

extension Tag.Img: HasCrossorigin {}
extension Tag.Script: HasCrossorigin {}
extension Tag.Link: HasCrossorigin {}

extension Attribute where Element: HasCrossorigin {
public enum Crossorigin: String {
Expand Down
7 changes: 6 additions & 1 deletion Tests/HtmlTests/AttributesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,12 @@ final class AttributesTests: XCTestCase {
XCTAssertEqual("<base href=\"blob\">", render(.base(attributes: [.href("blob")])))
XCTAssertEqual(
"<link href=\"blob\" rel=\"alternate\">",
render(.link(attributes: [.href("blob"), .rel(.alternate)])))
render(.link(attributes: [.href("blob"), .rel(.alternate)]))
)
XCTAssertEqual(
"<link href=\"blob\" rel=\"alternate\" crossorigin>",
render(.link(attributes: [.href("blob"), .rel(.alternate), .crossorigin(.anonymous)]))
)

XCTAssertEqual(
"<a href=\"mailto:[email protected]\"></a>",
Expand Down

0 comments on commit 45bc3e5

Please sign in to comment.