Skip to content

Commit

Permalink
fixed separated typo
Browse files Browse the repository at this point in the history
  • Loading branch information
sliemeobn committed Dec 6, 2024
1 parent fb76924 commit e9fc427
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Sources/Elementary/Core/Html+Attributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public struct HTMLAttributeMergeAction: Sendable {
public static var ignoring: Self { .init(mergeMode: .ignoreIfSet) }

/// Appends the new value to the existing value, separated by the specified string.
@available(*, deprecated, renamed: "appending(separatedBy:)")
public static func appending(seperatedBy: String) -> Self { .init(mergeMode: .appendValue(seperatedBy)) }

/// Appends the new value to the existing value, separated by the specified string.
public static func appending(separatedBy: String) -> Self { .init(mergeMode: .appendValue(separatedBy)) }
}

public extension HTMLAttribute {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Elementary/HtmlAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public extension HTMLAttribute where Tag: HTMLTrait.Attributes.Global {
}

static func `class`(_ value: String) -> Self {
HTMLAttribute(name: "class", value: value, mergedBy: .appending(seperatedBy: " "))
HTMLAttribute(name: "class", value: value, mergedBy: .appending(separatedBy: " "))
}

static func data(_ key: String, value: String) -> Self {
HTMLAttribute(name: "data-\(key)", value: value)
}

static func style(_ value: String) -> Self {
HTMLAttribute(name: "style", value: value, mergedBy: .appending(seperatedBy: ";"))
HTMLAttribute(name: "style", value: value, mergedBy: .appending(separatedBy: ";"))
}

static func title(_ value: String) -> Self {
Expand Down
4 changes: 2 additions & 2 deletions Tests/ElementaryTests/AttributeRenderingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ final class AttributeRenderingTests: XCTestCase {
func testRespectsCustomMergeMode() async throws {
try await HTMLAssertEqual(
br(.id("1"), .data("bar", value: "baz"))
.attributes(.id("2").mergedBy(.appending(seperatedBy: "-")))
.attributes(.id("2").mergedBy(.appending(separatedBy: "-")))
.attributes(.id("3").mergedBy(.ignoring))
.attributes(.data("bar", value: "baq").mergedBy(.appending(seperatedBy: ""))),
.attributes(.data("bar", value: "baq").mergedBy(.appending(separatedBy: ""))),
#"<br id="1-2" data-bar="bazbaq">"#
)
}
Expand Down

0 comments on commit e9fc427

Please sign in to comment.