Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make Scroller implement Focusable #5738

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.vaadin.flow.component.orderedlayout;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Focusable;
import com.vaadin.flow.component.HasSize;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.Tag;
Expand All @@ -39,8 +40,8 @@
@JsModule("@vaadin/polymer-legacy-adapter/style-modules.js")
@NpmPackage(value = "@vaadin/scroller", version = "24.3.0-alpha11")
@JsModule("@vaadin/scroller/src/vaadin-scroller.js")
public class Scroller extends Component
implements HasSize, HasStyle, HasThemeVariant<ScrollerVariant> {
public class Scroller extends Component implements Focusable<Scroller>, HasSize,
HasStyle, HasThemeVariant<ScrollerVariant> {

private static final String SCROLL_DIRECTION_PROPERTY = "scrollDirection";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +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;

public class ScrollerTest {

Expand Down Expand Up @@ -84,4 +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() {
web-padawan marked this conversation as resolved.
Show resolved Hide resolved
Input input = new Input();

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

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