1515 */
1616package com .vaadin .flow .component ;
1717
18+ import java .util .List ;
19+
1820import org .junit .jupiter .api .AfterAll ;
1921import org .junit .jupiter .api .BeforeAll ;
2022import org .junit .jupiter .api .Test ;
@@ -334,18 +336,15 @@ public void bindChildren_removeThrowsWhileBindingActive() {
334336 }
335337
336338 @ Test
337- public void addTypedCollection_allowsAddingListOfSubtypes () {
338- // Test the fix for GitHub issue - should compile and work
339+ public void add_typedCollectionOfSubtypes_addsAllChildren () {
339340 TestComponent container = new TestComponent ();
340-
341- // Create a List<TestComponent> (subtype of Component)
342- java .util .List <TestComponent > typedComponents = java .util .List
343- .of (new TestComponent ("comp1" ), new TestComponent ("comp2" ),
344- new TestComponent ("comp3" ));
345-
346- // This should now compile with Collection<? extends Component>
341+
342+ List <TestComponent > typedComponents = List .of (
343+ new TestComponent ("comp1" ), new TestComponent ("comp2" ),
344+ new TestComponent ("comp3" ));
345+
347346 container .add (typedComponents );
348-
347+
349348 assertEquals (3 , container .getChildren ().count ());
350349 assertEquals ("comp1" ,
351350 container .getChildren ().toList ().get (0 ).getId ().orElse (null ));
@@ -356,24 +355,20 @@ public void addTypedCollection_allowsAddingListOfSubtypes() {
356355 }
357356
358357 @ Test
359- public void removeTypedCollection_allowsRemovingListOfSubtypes () {
360- // Test the fix for GitHub issue - should compile and work
358+ public void remove_typedCollectionOfSubtypes_removesMatchingChildren () {
361359 TestComponent container = new TestComponent ();
362-
360+
363361 TestComponent comp1 = new TestComponent ("comp1" );
364362 TestComponent comp2 = new TestComponent ("comp2" );
365363 TestComponent comp3 = new TestComponent ("comp3" );
366-
364+
367365 container .add (comp1 , comp2 , comp3 );
368366 assertEquals (3 , container .getChildren ().count ());
369-
370- // Create a List<TestComponent> (subtype of Component)
371- java .util .List <TestComponent > typedComponents = java .util .List
372- .of (comp1 , comp2 );
373-
374- // This should now compile with Collection<? extends Component>
367+
368+ List <TestComponent > typedComponents = List .of (comp1 , comp2 );
369+
375370 container .remove (typedComponents );
376-
371+
377372 assertEquals (1 , container .getChildren ().count ());
378373 assertEquals ("comp3" ,
379374 container .getChildren ().toList ().get (0 ).getId ().orElse (null ));
0 commit comments