use of org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithDateColumn in project scout.rt by eclipse.
the class JsonCellToJsonTest method testDateColumn_jsonDatePattern.
/**
* Don't send value and text if they are equal. They may be equal if the date column uses the same pattern as
* {@link JsonDate}.
*/
@Test
public void testDateColumn_jsonDatePattern() throws JSONException {
TableWithDateColumn table = new TableWithDateColumn();
table.initTable();
ITableRow row = table.addRow(table.createRow());
table.getColumn().setFormat(JsonDate.JSON_PATTERN_DATE_ONLY);
table.getColumn().setValue(row, DateUtility.parse("01.01.2015", "dd.MM.yyyy"));
JsonTable<ITable> jsonTable = UiSessionTestUtility.newJsonAdapter(m_uiSession, table, null);
Object jsonObj = jsonTable.cellToJson(row, table.getColumn());
assertTrue(jsonObj instanceof String);
}
use of org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithDateColumn in project scout.rt by eclipse.
the class JsonCellToJsonTest method testDateColumn.
@Test
public void testDateColumn() throws JSONException {
TableWithDateColumn table = new TableWithDateColumn();
table.initTable();
ITableRow row = table.addRow(table.createRow());
table.getColumn().setFormat("dd.MM.yyyy");
table.getColumn().setValue(row, DateUtility.parse("01.01.2015", "dd.MM.yyyy"));
JsonTable<ITable> jsonTable = UiSessionTestUtility.newJsonAdapter(m_uiSession, table, null);
JSONObject jsonObj = (JSONObject) jsonTable.cellToJson(row, table.getColumn());
Assert.assertEquals("01.01.2015", jsonObj.get("text"));
// Pattern used by JsonDate
Assert.assertEquals("2015-01-01", jsonObj.get("value"));
}
Aggregations