]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add class name for not editable editor cells (#18021)
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Wed, 27 May 2015 08:07:00 +0000 (11:07 +0300)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Wed, 27 May 2015 09:41:35 +0000 (09:41 +0000)
Change-Id: Ib9bfb1fd3fe2f3caef745aa0d8fad5913759cb9e

client/src/com/vaadin/client/widgets/Grid.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java

index f1edefc8bafe12afa4744a4ba3290be896e1365a..274daeacb4206ca8bccbe382036283f9df0de55c 100644 (file)
@@ -1105,6 +1105,7 @@ public class Grid<T> extends ResizeComposite implements
         public static final int KEYCODE_HIDE = KeyCodes.KEY_ESCAPE;
 
         private static final String ERROR_CLASS_NAME = "error";
+        private static final String NOT_EDITABLE_CLASS_NAME = "not-editable";
 
         protected enum State {
             INACTIVE, ACTIVATING, BINDING, ACTIVE, SAVING
@@ -1488,6 +1489,8 @@ public class Grid<T> extends ResizeComposite implements
                         columnToWidget.put(column, editor);
                         attachWidget(editor, cell);
                     }
+                } else {
+                    cell.addClassName(NOT_EDITABLE_CLASS_NAME);
                 }
             }
 
index 2d9d4018e6d3de56a2f09afb5da295d3057ca43a..5f42bd66d310ab1bcc180aa8c64627f722970c00 100644 (file)
@@ -298,8 +298,16 @@ public class GridEditorTest extends GridBasicFeaturesTest {
         selectMenuPath(EDIT_ITEM_5);
         assertEditorOpen();
 
+        GridEditorElement editor = getGridElement().getEditor();
         assertFalse("Uneditable column should not have an editor widget",
-                getGridElement().getEditor().isEditable(3));
+                editor.isEditable(3));
+        assertEquals(
+                "Not editable cell did not contain correct classname",
+                "not-editable",
+                editor.findElement(By.className("v-grid-editor-cells"))
+                        .findElements(By.xpath("./div")).get(3)
+                        .getAttribute("class"));
+
     }
 
     private WebElement getSaveButton() {