Skip to content

Commit 9ee9830

Browse files
committed
cleanup
1 parent 4ced3f4 commit 9ee9830

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
@@ -50,40 +50,4 @@ protected void testHasAriaLabelIsNotImplemented() {
5050
void testNonDefaultConstructor() {
5151
assertEquals("text", new Div("text").getText());
5252
}
53-
54-
@Test
55-
public void testAddTypedCollectionOfComponents() {
56-
// Test for the GitHub issue fix - should compile and work with typed collections
57-
Div container = new Div();
58-
59-
// Create a List<Span> (subtype of Component)
60-
java.util.List<Span> typedSpans = java.util.List
61-
.of(new Span("span1"), new Span("span2"), new Span("span3"));
62-
63-
// This should now compile with Collection<? extends Component>
64-
container.add(typedSpans);
65-
66-
Assert.assertEquals(3, container.getChildren().count());
67-
}
68-
69-
@Test
70-
public void testRemoveTypedCollectionOfComponents() {
71-
// Test for the GitHub issue fix - should compile and work with typed collections
72-
Div container = new Div();
73-
74-
Span span1 = new Span("span1");
75-
Span span2 = new Span("span2");
76-
Span span3 = new Span("span3");
77-
78-
container.add(span1, span2, span3);
79-
Assert.assertEquals(3, container.getChildren().count());
80-
81-
// Create a List<Span> (subtype of Component)
82-
java.util.List<Span> typedSpans = java.util.List.of(span1, span2);
83-
84-
// This should now compile with Collection<? extends Component>
85-
container.remove(typedSpans);
86-
87-
Assert.assertEquals(1, container.getChildren().count());
88-
}
8953
}

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.jupiter.api.AfterAll;
1921
import org.junit.jupiter.api.BeforeAll;
2022
import 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

Comments
 (0)