Skip to content

Commit b941c5a

Browse files
Documentation and unit test updates.
1 parent edbab03 commit b941c5a

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

Workflow/Sources/WorkflowHost.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ public final class WorkflowHost<WorkflowType: Workflow> {
9494
///
9595
/// This property can be used when fine-grained control over the rendering
9696
/// of a `WorkflowHost` is needed, like cases where a container maintains
97-
/// its hosts and propagates their output & renderings to the main Workflow
97+
/// hosts and propagates their output & renderings to the main Workflow
9898
/// tree. Without this mechanism, detached hosts may render extra times:
9999
/// once for the applied action and again when the main tree renders.
100100
@_spi(WorkflowHostManagement)
101101
public var managedRenderings: Bool = false
102102

103-
/// Executes `update(workflow:)` when `managedRenderings` is `true`, and
104-
/// temporarily allows the `rootNode` to be rendered.
103+
/// Executes `update(workflow:)`, temporarily allowing the `rootNode` to be
104+
/// rendered when `managedRenderings` is `true`.
105105
@_spi(WorkflowHostManagement)
106106
public func managedUpdate(workflow: WorkflowType) {
107107
let previousValue = managedRenderings

Workflow/Tests/WorkflowHostTests.swift

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,32 @@ extension WorkflowHostTests {
9898
host.managedRenderings = true
9999
XCTAssertEqual(host.rendering.value, 1)
100100

101-
// Example of a traditional render pass not rendering the underlying
102-
// workflow when its renderings are managed. This render pass may also
101+
// Example of a standard render pass. This will not render the hosted
102+
// workflow when renderings are managed. This render pass could also
103103
// come from an action applied to the workflow.
104104
host.update(workflow: TestWorkflow(step: .second))
105105
XCTAssertEqual(host.rendering.value, 1)
106106

107-
// A managed update will render the workflow.
107+
// A managed update will always render the workflow.
108108
host.managedUpdate(workflow: TestWorkflow(step: .second))
109109
XCTAssertEqual(host.rendering.value, 2)
110+
111+
// Ensure that the flag is still enabled.
112+
XCTAssertTrue(host.managedRenderings)
113+
}
114+
115+
func test_managed_renderings_when_not_set() {
116+
let host = WorkflowHost(
117+
workflow: TestWorkflow(step: .first)
118+
)
119+
XCTAssertEqual(host.rendering.value, 1)
120+
121+
// A managed update will always render the workflow.
122+
host.managedUpdate(workflow: TestWorkflow(step: .second))
123+
XCTAssertEqual(host.rendering.value, 2)
124+
125+
// Ensure that the flag wasn't inadvertently enabled.
126+
XCTAssertFalse(host.managedRenderings)
110127
}
111128
}
112129

0 commit comments

Comments
 (0)