-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing HasEnabled implementation to HighchartsWidget.java (#600)
- Add missing HasEnabled implementation to HighchartsWidget.java - Add missing styles for disabled Charts component Fixes: #427
- Loading branch information
Showing
5 changed files
with
101 additions
and
1 deletion.
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
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
6 changes: 6 additions & 0 deletions
6
addon/src/main/resources/com/vaadin/addon/charts/public/charts/styles.css
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,6 @@ | ||
.v-disabled { | ||
.vaadin-chart { | ||
pointer-events: none; | ||
opacity: 70%; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...les/src/main/java/com/vaadin/addon/charts/examples/columnandbar/BarWithDisabledState.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,29 @@ | ||
package com.vaadin.addon.charts.examples.columnandbar; | ||
|
||
import com.vaadin.addon.charts.examples.SkipFromDemo; | ||
import com.vaadin.ui.Button; | ||
import com.vaadin.ui.Component; | ||
|
||
@SuppressWarnings("serial") | ||
@SkipFromDemo | ||
public class BarWithDisabledState extends BasicBarNoTitle { | ||
|
||
private Component chart; | ||
|
||
@Override | ||
protected Component getChart() { | ||
chart = super.getChart(); | ||
chart.setId("bar-with-disabled-state"); | ||
|
||
return chart; | ||
} | ||
|
||
@Override | ||
protected void setup() { | ||
super.setup(); | ||
|
||
Button button = new Button("toggle enabled", e -> chart.setEnabled(!chart.isEnabled())); | ||
button.setId("disable-button"); | ||
addComponent(button); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...ests/src/test/java/com/vaadin/addon/charts/testbenchtests/BarWithDisabledStateTBTest.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,47 @@ | ||
package com.vaadin.addon.charts.testbenchtests; | ||
|
||
import java.io.IOException; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
|
||
import com.vaadin.addon.charts.examples.columnandbar.BarWithDisabledState; | ||
import com.vaadin.client.StyleConstants; | ||
import com.vaadin.testbench.elements.ButtonElement; | ||
|
||
public class BarWithDisabledStateTBTest extends AbstractParallelTest { | ||
|
||
@Test | ||
public void test() throws IOException, AssertionError { | ||
driver.get(getTestUrl()); | ||
|
||
waitForVaadin(); | ||
|
||
WebElement chart = findElement(By.id("bar-with-disabled-state")); | ||
|
||
ButtonElement disableButton = $(ButtonElement.class).id("disable-button"); | ||
disableButton.click(); | ||
waitForVaadin(); | ||
|
||
Assert.assertTrue(chart.getAttribute("class").contains(StyleConstants.DISABLED)); | ||
|
||
disableButton.click(); | ||
waitForVaadin(); | ||
|
||
Assert.assertFalse(chart.getAttribute("class").contains(StyleConstants.DISABLED)); | ||
|
||
} | ||
|
||
@Override | ||
protected String getTestViewName() { | ||
return BarWithDisabledState.class.getSimpleName(); | ||
} | ||
|
||
@Override | ||
protected String getPackageName() { | ||
return "columnandbar"; | ||
} | ||
|
||
} |