Skip to content

Commit

Permalink
Attempt to fix rendering tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carson-katri committed Jun 15, 2022
1 parent 63a2526 commit 52eba18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Sources/TokamakStaticHTML/Shapes/Path.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extension Path: _HTMLPrimitive {
func svgFrom(
storage: Storage,
strokeStyle: StrokeStyle = .zero
) -> HTML<EmptyView> {
) -> HTML<EmptyView>? {
let stroke: [HTMLAttribute: String] = [
"stroke-width": "\(strokeStyle.lineWidth)",
]
Expand All @@ -40,7 +40,7 @@ extension Path: _HTMLPrimitive {
let flexibleCenterY: String? = sizing == .flexible ? "50%" : nil
switch storage {
case .empty:
return HTML("g")
return nil
case let .rect(rect):
return HTML(
"rect",
Expand Down Expand Up @@ -115,8 +115,8 @@ extension Path: _HTMLPrimitive {
func svgFrom(
elements: [Element],
strokeStyle: StrokeStyle = .zero
) -> HTML<EmptyView> {
if elements.isEmpty { return HTML("g") }
) -> HTML<EmptyView>? {
if elements.isEmpty { return nil }
var d = [String]()
for element in elements {
switch element {
Expand All @@ -143,7 +143,7 @@ extension Path: _HTMLPrimitive {
@ViewBuilder
func svgBody(
strokeStyle: StrokeStyle = .zero
) -> HTML<EmptyView> {
) -> HTML<EmptyView>? {
svgFrom(storage: storage, strokeStyle: strokeStyle)
}

Expand Down Expand Up @@ -184,6 +184,6 @@ extension Path: HTMLConvertible {
}

public var innerHTML: String? {
svgBody().outerHTML(shouldSortAttributes: false, children: [])
svgBody()?.outerHTML(shouldSortAttributes: false, children: [])
}
}
2 changes: 1 addition & 1 deletion Sources/TokamakStaticHTML/Shapes/_ShapeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ extension _ShapeView: _HTMLPrimitive {
role: Content.role
)

if let view = mapAnyView(path, transform: { (html: HTML<AnyView>) -> AnyView in
if let view = mapAnyView(path, transform: { (html: HTML<HTML<EmptyView>?>) -> AnyView in
let uniqueKeys = { (first: String, second: String) in "\(first) \(second)" }
let mergedAttributes = html.attributes.merging(
attributes(resolvedStyle: resolvedStyle),
Expand Down

0 comments on commit 52eba18

Please # to comment.