summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAutomerge <automerge@vaadin.com>2012-02-13 09:45:38 +0000
committerAutomerge <automerge@vaadin.com>2012-02-13 09:45:38 +0000
commite30dd1df30163aae265ff1eb80c2ef04fc8349f6 (patch)
treebe1119809e1d2be04574a827230ab11abafc5706
parentbec9a1e9656bf6a0d32f2e90e73fbbb3e87ba7e3 (diff)
downloadvaadin-framework-e30dd1df30163aae265ff1eb80c2ef04fc8349f6.tar.gz
vaadin-framework-e30dd1df30163aae265ff1eb80c2ef04fc8349f6.zip
[merge from 6.7] #8362 Ensure value is not toggled when checkbox is disabled
svn changeset:22978/svn branch:6.8
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java5
-rw-r--r--tests/testbench/com/vaadin/tests/components/checkbox/CheckBoxDisabledReadOnlyValueChange.html147
2 files changed, 151 insertions, 1 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java b/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java
index c43c4d3dba..b1eda728dc 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java
@@ -162,7 +162,10 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements
public void onBrowserEvent(Event event) {
if (icon != null && (event.getTypeInt() == Event.ONCLICK)
&& (DOM.eventGetTarget(event) == icon.getElement())) {
- setValue(!getValue());
+ // Click on icon should do nothing if widget is disabled
+ if (isEnabled()) {
+ setValue(!getValue());
+ }
}
super.onBrowserEvent(event);
if (event.getTypeInt() == Event.ONLOAD) {
diff --git a/tests/testbench/com/vaadin/tests/components/checkbox/CheckBoxDisabledReadOnlyValueChange.html b/tests/testbench/com/vaadin/tests/components/checkbox/CheckBoxDisabledReadOnlyValueChange.html
new file mode 100644
index 0000000000..ddcdc68691
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/checkbox/CheckBoxDisabledReadOnlyValueChange.html
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.checkbox.CheckBoxes2?restartApplication</td>
+ <td></td>
+</tr>
+<!--add icon-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td>
+ <td>32,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item1</td>
+ <td>50,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item3</td>
+ <td>48,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>24,9</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td>
+ <td>off</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[1]</td>
+ <td>9,7</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td>
+ <td>on</td>
+</tr>
+<!--disable-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td>
+ <td>22,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>33,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>51,9</td>
+</tr>
+<!--click on caption and icon and assert checked state does not change. Cannot test checkbox click due to Opera problems-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[2]</td>
+ <td>8,7</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td>
+ <td>on</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[1]</td>
+ <td>5,10</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td>
+ <td>on</td>
+</tr>
+<!--enable and set to read only-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td>
+ <td>33,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>30,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>62,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td>
+ <td>42,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>40,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+ <td>58,14</td>
+</tr>
+<!--click on caption and icon and assert checked state does not change. Cannot test checkbox click due to Opera problems-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[2]</td>
+ <td>8,7</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td>
+ <td>on</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[1]</td>
+ <td>5,10</td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td>
+ <td>on</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>