@@ -123,6 +123,24 @@ describe("FieldRadios.vue", () => {
123123 expect ( labelList . at ( 6 ) . classes ( ) ) . to . not . include ( "is-checked" ) ;
124124 } ) ;
125125 } ) ;
126+
127+ describe ( "test 'name' attribute for the radio group" , ( ) => {
128+ it ( "should render the same 'name' attribute for all input[type=radio] within an instance" , ( ) => {
129+ const nameAttribute = radios . at ( 0 ) . attributes ( ) . name ;
130+ expect ( radios . is ( `input[name="${ nameAttribute } "]` ) ) ;
131+ } ) ;
132+ it ( "should render different 'name' attribute for all input[type=radio] across different instances" , ( ) => {
133+ const nameAttribute = radios . at ( 0 ) . attributes ( ) . name ;
134+ expect ( radios . is ( `input[name="${ nameAttribute } "]` ) ) ;
135+
136+ createField2 ( { schema, model, disabled : false } ) ;
137+
138+ const nameAttribute2 = radios . at ( 0 ) . attributes ( ) . name ;
139+ expect ( radios . is ( `input[name="${ nameAttribute2 } "]` ) ) ;
140+
141+ expect ( nameAttribute ) . not . to . equal ( nameAttribute2 ) ;
142+ } ) ;
143+ } ) ;
126144 } ) ;
127145
128146 describe ( "check static values with { value, name } objects (default key name)" , ( ) => {
@@ -221,6 +239,24 @@ describe("FieldRadios.vue", () => {
221239 expect ( labelList . at ( 6 ) . classes ( ) ) . to . not . include ( "is-checked" ) ;
222240 } ) ;
223241 } ) ;
242+
243+ describe ( "test 'name' attribute for the radio group" , ( ) => {
244+ it ( "should render the same 'name' attribute for all input[type=radio] within an instance" , ( ) => {
245+ const nameAttribute = radios . at ( 0 ) . attributes ( ) . name ;
246+ expect ( radios . is ( `input[name="${ nameAttribute } "]` ) ) ;
247+ } ) ;
248+ it ( "should render different 'name' attribute for all input[type=radio] across different instances" , ( ) => {
249+ const nameAttribute = radios . at ( 0 ) . attributes ( ) . name ;
250+ expect ( radios . is ( `input[name="${ nameAttribute } "]` ) ) ;
251+
252+ createField2 ( { schema, model, disabled : false } ) ;
253+
254+ const nameAttribute2 = radios . at ( 0 ) . attributes ( ) . name ;
255+ expect ( radios . is ( `input[name="${ nameAttribute2 } "]` ) ) ;
256+
257+ expect ( nameAttribute ) . not . to . equal ( nameAttribute2 ) ;
258+ } ) ;
259+ } ) ;
224260 } ) ;
225261
226262 describe ( "check static values with { id, label } objects (custom key name with `radiosOptions`)" , ( ) => {
@@ -323,5 +359,23 @@ describe("FieldRadios.vue", () => {
323359 expect ( labelList . at ( 6 ) . classes ( ) ) . to . not . include ( "is-checked" ) ;
324360 } ) ;
325361 } ) ;
362+
363+ describe ( "test 'name' attribute for the radio group" , ( ) => {
364+ it ( "should render the same 'name' attribute for all input[type=radio] within an instance" , ( ) => {
365+ const nameAttribute = radios . at ( 0 ) . attributes ( ) . name ;
366+ expect ( radios . is ( `input[name="${ nameAttribute } "]` ) ) ;
367+ } ) ;
368+ it ( "should render different 'name' attribute for all input[type=radio] across different instances" , ( ) => {
369+ const nameAttribute = radios . at ( 0 ) . attributes ( ) . name ;
370+ expect ( radios . is ( `input[name="${ nameAttribute } "]` ) ) ;
371+
372+ createField2 ( { schema, model, disabled : false } ) ;
373+
374+ const nameAttribute2 = radios . at ( 0 ) . attributes ( ) . name ;
375+ expect ( radios . is ( `input[name="${ nameAttribute2 } "]` ) ) ;
376+
377+ expect ( nameAttribute ) . not . to . equal ( nameAttribute2 ) ;
378+ } ) ;
379+ } ) ;
326380 } ) ;
327381} ) ;
0 commit comments