Skip to content

Commit

Permalink
Remove test dependency with TextField and add test for Focusable impl…
Browse files Browse the repository at this point in the history
…ementation
  • Loading branch information
brunovianarezende committed Nov 22, 2023
1 parent 807707b commit 5a08277
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
<artifactId>flow-html-components</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-text-field-flow</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-test-generic</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
import org.junit.Before;
import org.junit.Test;

import com.vaadin.flow.component.Focusable;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Input;
import com.vaadin.flow.component.orderedlayout.Scroller;
import com.vaadin.flow.component.orderedlayout.Scroller.ScrollDirection;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;

public class ScrollerTest {

Expand Down Expand Up @@ -86,14 +87,20 @@ public void setNullScrollDirection_NullPointerExceptionIsThrown() {
scroller.setScrollDirection(null);
}

@Test
public void implementsFocusable() {
Assert.assertTrue("Scroller should be focusable",
Focusable.class.isAssignableFrom(scroller.getClass()));
}

@Test
public void setEnabled_disableChildren() {
TextField textField = new TextField();
Input input = new Input();

scroller.setContent(new VerticalLayout(textField));
Assert.assertTrue(textField.isEnabled());
scroller.setContent(new VerticalLayout(input));
Assert.assertTrue(input.isEnabled());

scroller.setEnabled(false);
Assert.assertFalse(textField.isEnabled());
Assert.assertFalse(input.isEnabled());
}
}

0 comments on commit 5a08277

Please sign in to comment.