[#248,model][s]: normalize Field types where possible by mapping standard type aliases to default type name - fixes #248.
* view.graph.js improve graph view by making sure datetime for an axis is judged by whether it is date, datetime or time not just date! * backend.ckan.js some type conversions now done in core model so can be removed
This commit is contained in:
@@ -38,6 +38,28 @@ test('Field: basics', function () {
|
||||
equal('XX', out[0].label);
|
||||
});
|
||||
|
||||
test('Field: type mapping', function () {
|
||||
var tests = [
|
||||
{ input: 'text', exp: 'string'},
|
||||
{ input: 'int', exp: 'integer'},
|
||||
{ input: 'float', exp: 'number'},
|
||||
{ input: 'double', exp: 'number'},
|
||||
{ input: 'datetime', exp: 'date-time'},
|
||||
{ input: 'dateTime', exp: 'date-time'},
|
||||
{ input: 'bool', exp: 'boolean'},
|
||||
{ input: 'timestamp', exp: 'date-time'},
|
||||
{ input: 'json', exp: 'object'}
|
||||
];
|
||||
|
||||
_.each(tests, function(data) {
|
||||
var field = new recline.Model.Field({
|
||||
id: 'x',
|
||||
type: data.input
|
||||
});
|
||||
equal(field.get('type'), data.exp);
|
||||
});
|
||||
});
|
||||
|
||||
test('Field: default renderers', function () {
|
||||
var doc = new recline.Model.Record({
|
||||
x: 12.3,
|
||||
|
||||
Reference in New Issue
Block a user