@@ -5,6 +5,7 @@ import { DDisplay, DType } from "../../../types/dtypes";
55import { Color , Font } from "../../../types" ;
66import { ThemeProvider } from "@mui/material" ;
77import { phoebusTheme } from "../../../phoebusTheme" ;
8+ import { PvDatum } from "../../../redux/csState" ;
89
910const ChoiceButtonRenderer = ( choiceButtonProps : any ) : JSX . Element => {
1011 return (
@@ -17,7 +18,14 @@ const ChoiceButtonRenderer = (choiceButtonProps: any): JSX.Element => {
1718describe ( "<ChoiceButton />" , ( ) : void => {
1819 test ( "it renders ChoiceButton with default props" , ( ) : void => {
1920 const choiceButtonProps = {
20- value : null
21+ pvData : [
22+ {
23+ effectivePvName : "TEST:PV" ,
24+ connected : true ,
25+ readonly : true ,
26+ value : undefined
27+ } as Partial < PvDatum > as PvDatum
28+ ]
2129 } ;
2230 const { getAllByRole } = render ( ChoiceButtonRenderer ( choiceButtonProps ) ) ;
2331 const buttons = getAllByRole ( "button" ) as Array < HTMLButtonElement > ;
@@ -37,7 +45,14 @@ describe("<ChoiceButton />", (): void => {
3745
3846 test ( "pass props to widget" , ( ) : void => {
3947 const choiceButtonProps = {
40- value : new DType ( { doubleValue : 0 } ) ,
48+ pvData : [
49+ {
50+ effectivePvName : "TEST:PV" ,
51+ connected : true ,
52+ readonly : true ,
53+ value : new DType ( { doubleValue : 0 } )
54+ } as Partial < PvDatum > as PvDatum
55+ ] ,
4156 width : 60 ,
4257 height : 140 ,
4358 font : new Font ( 12 ) ,
@@ -68,12 +83,19 @@ describe("<ChoiceButton />", (): void => {
6883
6984 test ( "pass props to widget, using itemsFromPv" , ( ) : void => {
7085 const choiceButtonProps = {
71- value : new DType (
72- { doubleValue : 0 } ,
73- undefined ,
74- undefined ,
75- new DDisplay ( { choices : [ "hi" , "Hello" ] } )
76- ) ,
86+ pvData : [
87+ {
88+ effectivePvName : "TEST:PV" ,
89+ connected : true ,
90+ readonly : true ,
91+ value : new DType (
92+ { doubleValue : 0 } ,
93+ undefined ,
94+ undefined ,
95+ new DDisplay ( { choices : [ "hi" , "Hello" ] } )
96+ )
97+ } as Partial < PvDatum > as PvDatum
98+ ] ,
7799 items : [ "one" , "two" , "three" ] ,
78100 horizontal : false ,
79101 itemsFromPv : true ,
@@ -90,7 +112,7 @@ describe("<ChoiceButton />", (): void => {
90112
91113 test ( "selecting a button" , ( ) : void => {
92114 const choiceButtonProps = {
93- value : null
115+ pvData : [ ]
94116 } ;
95117 const { getAllByRole } = render ( ChoiceButtonRenderer ( choiceButtonProps ) ) ;
96118 const buttons = getAllByRole ( "button" ) as Array < HTMLButtonElement > ;
0 commit comments