Skip to content

Commit

Permalink
feat: Add HasStyle interface to AppLayout #2854 (#2877)
Browse files Browse the repository at this point in the history
* Add HasStyle interface to AppLayout #2854

* Fix imports #2854

* Update vaadin-app-layout-flow-parent/vaadin-app-layout-flow/src/test/java/com/vaadin/flow/component/applayout/AppLayoutTest.java

Co-authored-by: Serhii Kulykov <[email protected]>
  • Loading branch information
krissvaa and web-padawan authored Mar 16, 2022
1 parent c8d1b31 commit b476342
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasElement;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.PropertyDescriptor;
import com.vaadin.flow.component.PropertyDescriptors;
import com.vaadin.flow.component.Synchronize;
Expand All @@ -51,7 +52,7 @@
@NpmPackage(value = "@vaadin/app-layout", version = "23.0.1")
@NpmPackage(value = "@vaadin/vaadin-app-layout", version = "23.0.1")
@JsModule("@vaadin/app-layout/src/vaadin-app-layout.js")
public class AppLayout extends Component implements RouterLayout {
public class AppLayout extends Component implements RouterLayout, HasStyle {
private static final PropertyDescriptor<String, String> primarySectionProperty = PropertyDescriptors
.propertyWithDefault("primarySection",
Section.NAVBAR.toWebcomponentValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasElement;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.dom.Element;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -179,6 +182,11 @@ public void setI18n() {
assertEquals(i18n, systemUnderTest.getI18n());
}

@Test
public void hasStyle() {
Assert.assertTrue(systemUnderTest instanceof HasStyle);
}

private void testDrawerOpened(boolean expectedDrawerOpened) {
assertEquals(expectedDrawerOpened, systemUnderTest.getElement()
.getProperty("drawerOpened", false));
Expand Down

0 comments on commit b476342

Please sign in to comment.