@@ -115,3 +115,48 @@ it("renders block without run control without tick or cross", () => {
115115 . innerHTML ,
116116 ) . toBe ( "" ) ;
117117} ) ;
118+
119+ it ( "renders block with SP and shows SP value" , ( ) => {
120+ const expectedValue = 123 ;
121+ const expectedSpValue = 124 ;
122+ const aBlock : IfcBlock = {
123+ pvaddress : "SOME:PV" ,
124+ visible : true ,
125+ human_readable_name : "MyBlock" ,
126+ runcontrol_inrange : false ,
127+ runcontrol_enabled : false ,
128+ sp_value : expectedSpValue ,
129+ value : expectedValue ,
130+ } ;
131+ const { container } = render (
132+ < Block pv = { aBlock } instName = { "" } showHiddenBlocks = { false } /> ,
133+ {
134+ container : tableBody ,
135+ } ,
136+ ) ;
137+ expect (
138+ container . querySelector ( `#${ aBlock . human_readable_name } _VALUE` ) ! . innerHTML ,
139+ ) . toContain ( `${ expectedValue } (SP: ${ expectedSpValue } )` ) ;
140+ } ) ;
141+
142+ it ( "renders block without SP and hides SP value" , ( ) => {
143+ const expectedValue = 123 ;
144+ const expectedSpValue = 124 ;
145+ const aBlock : IfcBlock = {
146+ pvaddress : "SOME:PV" ,
147+ visible : true ,
148+ human_readable_name : "MyBlock" ,
149+ runcontrol_inrange : false ,
150+ runcontrol_enabled : false ,
151+ value : expectedValue ,
152+ } ;
153+ const { container } = render (
154+ < Block pv = { aBlock } instName = { "" } showHiddenBlocks = { false } /> ,
155+ {
156+ container : tableBody ,
157+ } ,
158+ ) ;
159+ expect (
160+ container . querySelector ( `#${ aBlock . human_readable_name } _VALUE` ) ! . innerHTML ,
161+ ) . toContain ( `${ expectedValue } ` ) ;
162+ } ) ;
0 commit comments