Skip to content

Commit 842eeff

Browse files
committed
cleanup
1 parent eb848ef commit 842eeff

2 files changed

Lines changed: 16 additions & 57 deletions

File tree

flow-html-components/src/test/java/com/vaadin/flow/component/html/DivTest.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,40 +49,4 @@ public void testHasAriaLabelIsNotImplemented() {
4949
public void testNonDefaultConstructor() {
5050
Assert.assertEquals("text", new Div("text").getText());
5151
}
52-
53-
@Test
54-
public void testAddTypedCollectionOfComponents() {
55-
// Test for the GitHub issue fix - should compile and work with typed collections
56-
Div container = new Div();
57-
58-
// Create a List<Span> (subtype of Component)
59-
java.util.List<Span> typedSpans = java.util.List
60-
.of(new Span("span1"), new Span("span2"), new Span("span3"));
61-
62-
// This should now compile with Collection<? extends Component>
63-
container.add(typedSpans);
64-
65-
Assert.assertEquals(3, container.getChildren().count());
66-
}
67-
68-
@Test
69-
public void testRemoveTypedCollectionOfComponents() {
70-
// Test for the GitHub issue fix - should compile and work with typed collections
71-
Div container = new Div();
72-
73-
Span span1 = new Span("span1");
74-
Span span2 = new Span("span2");
75-
Span span3 = new Span("span3");
76-
77-
container.add(span1, span2, span3);
78-
Assert.assertEquals(3, container.getChildren().count());
79-
80-
// Create a List<Span> (subtype of Component)
81-
java.util.List<Span> typedSpans = java.util.List.of(span1, span2);
82-
83-
// This should now compile with Collection<? extends Component>
84-
container.remove(typedSpans);
85-
86-
Assert.assertEquals(1, container.getChildren().count());
87-
}
8852
}

flow-server/src/test/java/com/vaadin/flow/component/HasComponentsTest.java

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package com.vaadin.flow.component;
1717

18+
import java.util.List;
19+
1820
import org.junit.AfterClass;
1921
import org.junit.Assert;
2022
import org.junit.BeforeClass;
@@ -329,18 +331,15 @@ public void bindChildren_removeThrowsWhileBindingActive() {
329331
}
330332

331333
@Test
332-
public void addTypedCollection_allowsAddingListOfSubtypes() {
333-
// Test the fix for GitHub issue - should compile and work
334+
public void add_typedCollectionOfSubtypes_addsAllChildren() {
334335
TestComponent container = new TestComponent();
335-
336-
// Create a List<TestComponent> (subtype of Component)
337-
java.util.List<TestComponent> typedComponents = java.util.List
338-
.of(new TestComponent("comp1"), new TestComponent("comp2"),
339-
new TestComponent("comp3"));
340-
341-
// This should now compile with Collection<? extends Component>
336+
337+
List<TestComponent> typedComponents = List.of(
338+
new TestComponent("comp1"), new TestComponent("comp2"),
339+
new TestComponent("comp3"));
340+
342341
container.add(typedComponents);
343-
342+
344343
assertEquals(3, container.getChildren().count());
345344
assertEquals("comp1",
346345
container.getChildren().toList().get(0).getId().orElse(null));
@@ -351,24 +350,20 @@ public void addTypedCollection_allowsAddingListOfSubtypes() {
351350
}
352351

353352
@Test
354-
public void removeTypedCollection_allowsRemovingListOfSubtypes() {
355-
// Test the fix for GitHub issue - should compile and work
353+
public void remove_typedCollectionOfSubtypes_removesMatchingChildren() {
356354
TestComponent container = new TestComponent();
357-
355+
358356
TestComponent comp1 = new TestComponent("comp1");
359357
TestComponent comp2 = new TestComponent("comp2");
360358
TestComponent comp3 = new TestComponent("comp3");
361-
359+
362360
container.add(comp1, comp2, comp3);
363361
assertEquals(3, container.getChildren().count());
364-
365-
// Create a List<TestComponent> (subtype of Component)
366-
java.util.List<TestComponent> typedComponents = java.util.List
367-
.of(comp1, comp2);
368-
369-
// This should now compile with Collection<? extends Component>
362+
363+
List<TestComponent> typedComponents = List.of(comp1, comp2);
364+
370365
container.remove(typedComponents);
371-
366+
372367
assertEquals(1, container.getChildren().count());
373368
assertEquals("comp3",
374369
container.getChildren().toList().get(0).getId().orElse(null));

0 commit comments

Comments
 (0)