@@ -181,4 +181,94 @@ describe("calcite-radio-group", () => {
181181 expect ( role ) . toEqualText ( "radiogroup" ) ;
182182 } ) ;
183183 } ) ;
184+
185+ it ( "renders requested props" , async ( ) => {
186+ const page = await newE2EPage ( ) ;
187+ await page . setContent (
188+ "<calcite-radio-group theme='dark' scale='l'></calcite-radio-group>"
189+ ) ;
190+ const element = await page . find ( "calcite-radio-group" ) ;
191+ expect ( element ) . toEqualAttribute ( "theme" , "dark" ) ;
192+ expect ( element ) . toEqualAttribute ( "scale" , "l" ) ;
193+ } ) ;
194+
195+ it ( "validates incorrect props" , async ( ) => {
196+ const page = await newE2EPage ( ) ;
197+ await page . setContent (
198+ "<calcite-radio-group theme='zip' scale='zap'></calcite-radio-group>"
199+ ) ;
200+
201+ const element = await page . find ( "calcite-radio-group" ) ;
202+ expect ( element ) . toEqualAttribute ( "theme" , "light" ) ;
203+ expect ( element ) . toEqualAttribute ( "scale" , "m" ) ;
204+ } ) ;
205+
206+ it ( "renders default props" , async ( ) => {
207+ const page = await newE2EPage ( ) ;
208+ await page . setContent (
209+ "<calcite-radio-group></calcite-radio-group>"
210+ ) ;
211+ const element = await page . find ( "calcite-radio-group" ) ;
212+ expect ( element ) . toEqualAttribute ( "theme" , "light" ) ;
213+ expect ( element ) . toEqualAttribute ( "scale" , "m" ) ;
214+ } ) ;
215+
216+ it ( "passes requested scale prop to child components" , async ( ) => {
217+ const page = await newE2EPage ( ) ;
218+ await page . setContent (
219+ `<calcite-radio-group scale="l">
220+ <calcite-radio-group-item id="child-1" value="1" checked>one</calcite-radio-group-item>
221+ <calcite-radio-group-item id="child-2" value="2">two</calcite-radio-group-item>
222+ <calcite-radio-group-item id="child-3" value="3">three</calcite-radio-group-item>
223+ </calcite-radio-group>`
224+ ) ;
225+ const element = await page . find ( "calcite-radio-group" ) ;
226+ const child1 = await page . find ( "#child-1" ) ;
227+ const child2 = await page . find ( "#child-2" ) ;
228+ const child3 = await page . find ( "#child-3" ) ;
229+ expect ( element ) . toEqualAttribute ( "scale" , "l" ) ;
230+ expect ( child1 ) . toEqualAttribute ( "scale" , "l" ) ;
231+ expect ( child2 ) . toEqualAttribute ( "scale" , "l" ) ;
232+ expect ( child3 ) . toEqualAttribute ( "scale" , "l" ) ;
233+ } ) ;
234+
235+ it ( "passes validated incorrect scale prop to child components" , async ( ) => {
236+ const page = await newE2EPage ( ) ;
237+ await page . setContent (
238+ `<calcite-radio-group scale="zip">
239+ <calcite-radio-group-item id="child-1" value="1" checked>one</calcite-radio-group-item>
240+ <calcite-radio-group-item id="child-2" value="2">two</calcite-radio-group-item>
241+ <calcite-radio-group-item id="child-3" value="3">three</calcite-radio-group-item>
242+ </calcite-radio-group>`
243+ ) ;
244+
245+ const element = await page . find ( "calcite-radio-group" ) ;
246+ const child1 = await page . find ( "#child-1" ) ;
247+ const child2 = await page . find ( "#child-2" ) ;
248+ const child3 = await page . find ( "#child-3" ) ;
249+ expect ( element ) . toEqualAttribute ( "scale" , "m" ) ;
250+ expect ( child1 ) . toEqualAttribute ( "scale" , "m" ) ;
251+ expect ( child2 ) . toEqualAttribute ( "scale" , "m" ) ;
252+ expect ( child3 ) . toEqualAttribute ( "scale" , "m" ) ;
253+ } ) ;
254+
255+ it ( "passes default scale prop to child components" , async ( ) => {
256+ const page = await newE2EPage ( ) ;
257+ await page . setContent (
258+ `<calcite-radio-group>
259+ <calcite-radio-group-item id="child-1" value="1" checked>one</calcite-radio-group-item>
260+ <calcite-radio-group-item id="child-2" value="2">two</calcite-radio-group-item>
261+ <calcite-radio-group-item id="child-3" value="3">three</calcite-radio-group-item>
262+ </calcite-radio-group>`
263+ ) ;
264+
265+ const element = await page . find ( "calcite-radio-group" ) ;
266+ const child1 = await page . find ( "#child-1" ) ;
267+ const child2 = await page . find ( "#child-2" ) ;
268+ const child3 = await page . find ( "#child-3" ) ;
269+ expect ( element ) . toEqualAttribute ( "scale" , "m" ) ;
270+ expect ( child1 ) . toEqualAttribute ( "scale" , "m" ) ;
271+ expect ( child2 ) . toEqualAttribute ( "scale" , "m" ) ;
272+ expect ( child3 ) . toEqualAttribute ( "scale" , "m" ) ;
273+ } ) ;
184274} ) ;
0 commit comments