diff --git a/Sources/Plot/API/Node.swift b/Sources/Plot/API/Node.swift index acd0100..245883e 100644 --- a/Sources/Plot/API/Node.swift +++ b/Sources/Plot/API/Node.swift @@ -184,7 +184,9 @@ internal extension Node where Context == Any { static func components(_ components: [Component]) -> Node { Node { renderer in components.forEach { - renderer.renderComponent($0) + renderer.renderComponent($0, + deferredAttributes: renderer.deferredAttributes + ) } } } diff --git a/Tests/PlotTests/HTMLComponentTests.swift b/Tests/PlotTests/HTMLComponentTests.swift index 6491c62..1c6d3d2 100644 --- a/Tests/PlotTests/HTMLComponentTests.swift +++ b/Tests/PlotTests/HTMLComponentTests.swift @@ -116,6 +116,21 @@ final class HTMLComponentTests: XCTestCase { XCTAssertEqual(html, #"

Hello

"#) } + func testAppendingClassToWrappingComponentContainingGroup() { + struct Wrapper: Component { + var body: Component { + ComponentGroup { + Paragraph("One") + Paragraph("Two") + } + .class("one") + } + } + + let html = Wrapper().class("two").render() + XCTAssertEqual(html, #"

One

Two

"#) + } + func testReplacingClass() { let html = Paragraph("Hello") .class("one")