-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add title API to dashboard widget (#6560)
* feat: add title for widget * chore: run formatter * refactor: use properties instead of attributes * docs: fix the widget title property name
- Loading branch information
1 parent
c2214cc
commit e57495a
Showing
6 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...on-tests/src/main/java/com/vaadin/flow/component/dashboard/tests/DashboardWidgetPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright 2000-2024 Vaadin Ltd. | ||
* | ||
* This program is available under Vaadin Commercial License and Service Terms. | ||
* | ||
* See {@literal <https://vaadin.com/commercial-license-and-service-terms>} for the full | ||
* license. | ||
*/ | ||
package com.vaadin.flow.component.dashboard.tests; | ||
|
||
import com.vaadin.flow.component.dashboard.DashboardWidget; | ||
import com.vaadin.flow.component.html.Div; | ||
import com.vaadin.flow.router.Route; | ||
|
||
/** | ||
* @author Vaadin Ltd | ||
*/ | ||
@Route("vaadin-dashboard-widget") | ||
public class DashboardWidgetPage extends Div { | ||
|
||
public DashboardWidgetPage() { | ||
DashboardWidget widget = new DashboardWidget(); | ||
widget.setTitle("Widget"); | ||
add(widget); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...tion-tests/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardWidgetIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright 2000-2024 Vaadin Ltd. | ||
* | ||
* This program is available under Vaadin Commercial License and Service Terms. | ||
* | ||
* See {@literal <https://vaadin.com/commercial-license-and-service-terms>} for the full | ||
* license. | ||
*/ | ||
package com.vaadin.flow.component.dashboard.tests; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import com.vaadin.flow.component.dashboard.testbench.DashboardWidgetElement; | ||
import com.vaadin.flow.testutil.TestPath; | ||
import com.vaadin.tests.AbstractComponentIT; | ||
|
||
/** | ||
* @author Vaadin Ltd | ||
*/ | ||
@TestPath("vaadin-dashboard-widget") | ||
public class DashboardWidgetIT extends AbstractComponentIT { | ||
|
||
private DashboardWidgetElement widget; | ||
|
||
@Before | ||
public void init() { | ||
open(); | ||
widget = $(DashboardWidgetElement.class).waitForFirst(); | ||
} | ||
|
||
@Test | ||
public void titleIsSetCorrectly() { | ||
Assert.assertEquals("Widget", widget.getTitle()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters