Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Testing Your CanvasLifecycleHandler Implementation
Use Canvas.Test to create a test Canvas.RenderContext with mock application and environment context data. Call Canvas.Test.testCanvasLifecycle() with the mock RenderContext and your CanvasLifecycleHandler implementation to verify that your CanvasLifecycleHandler is being invoked correctly.
When you’ve got a mock RenderContext, you can call Canvas.Test.testCanvasLifecycleHandler() with the RenderContext and your CanvasLifecycleHandler. This call invokes the handler’s onRender() method, and passies the mock RenderContext as context data.
- testDefaultMockValues() invokes MyCanvasLifecycleHandler, using the default Canvas.Test mock context data.
- testOverriddenAppValues() invokes MyCanvasLifecycleHandler, using a custom mock RenderContext with mock app URL and version application context data.
- testOverriddenEnvironmentValues() invokes MyCanvasLifecycleHandler, using a custom mock RenderContext with mock display location, location URL, and custom parameter environment context data. The custom parameters are set through the Canvas.EnvironmentContext interface after the mock RenderContext is created.