diff --git a/addon/src/main/scala/vaadin/scala/Grid.scala b/addon/src/main/scala/vaadin/scala/Grid.scala index d7ff7cc9..3a7be645 100644 --- a/addon/src/main/scala/vaadin/scala/Grid.scala +++ b/addon/src/main/scala/vaadin/scala/Grid.scala @@ -49,10 +49,13 @@ object Grid { val p: com.vaadin.ui.Grid.Column + def propertyId: Any = p.getColumnProperty + def headerCaption: String = p.getHeaderCaption + def headerCaption_=(headerCaption: String): Unit = p.setHeaderCaption(headerCaption) - def width = p.getWidth - def width_=(pixelWidth: Int): Unit = p.setWidth(pixelWidth) + def width: Double = p.getWidth + def width_=(pixelWidth: Double): Unit = p.setWidth(pixelWidth) def widthUndefined() = p.setWidthUndefined() diff --git a/addon/src/test/scala/vaadin/scala/tests/GridTests.scala b/addon/src/test/scala/vaadin/scala/tests/GridTests.scala index 96eab229..0d100ed2 100644 --- a/addon/src/test/scala/vaadin/scala/tests/GridTests.scala +++ b/addon/src/test/scala/vaadin/scala/tests/GridTests.scala @@ -79,7 +79,44 @@ class GridTests extends ScaladinTestSuite { Mockito.verify(spy).removeColumn("propertyId") } + test("Column.propertyId") { + val column = grid.addColumn[String]("myColumn") + assert("myColumn" == column.propertyId) + } + + test("Column.headerCaption") { + val column = grid.addColumn[String]("myColumn") + assert("My Column" == column.headerCaption) + + column.headerCaption = "Header for Column" + assert("Header for Column" == column.headerCaption) + } + + test("Column.width") { + val column = grid.addColumn[String]("myColumn") + assert(-1 == column.width) + + column.width = 25.6 + assert(25.6 == column.width) + } + + test("Column.widthUndefined") { + val column = grid.addColumn[String]("myColumn") + column.width = 25.6 + + column.widthUndefined() + assert(-1 == column.width) + } + + test("sortable") { + val column = grid.addColumn[String]("myColumn") + + assert(column.sortable) + + column.sortable = false + assert(!column.sortable) + } // TODO tests for Grid.Column class