This MR introduces an UnchartedPhoenix.TestRenderer module that is meant to be imported into test files for UnchartedPhoenix in place of using LiveViewTests's live_component/3 macro.
The UnchartedPhoenix.TestRenderer module exposes a render_chart/1 function that can take in any Uncharted chart type and render it using the appropriate UnchartedPhoenix live component. This is predicated on the Uncharted.Component protocol being implemented for the chart type you are trying to render.
The render_chart/1 function will pipe everything through a call to UnchartedPhoenix.render/2, ensuring that component ids are added to the component, thus preventing us from having to manually pass an id: #{some_value} option to every call to live_component/3 we would otherwise need to test our LiveView components.
This MR introduces an
UnchartedPhoenix.TestRenderer
module that is meant to be imported into test files for UnchartedPhoenix in place of using LiveViewTests'slive_component/3
macro.The
UnchartedPhoenix.TestRenderer
module exposes arender_chart/1
function that can take in any Uncharted chart type and render it using the appropriate UnchartedPhoenix live component. This is predicated on theUncharted.Component
protocol being implemented for the chart type you are trying to render.The
render_chart/1
function will pipe everything through a call toUnchartedPhoenix.render/2
, ensuring that component ids are added to the component, thus preventing us from having to manually pass anid: #{some_value}
option to every call tolive_component/3
we would otherwise need to test our LiveView components.