[#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:
Rufus Pollock
2012-10-12 22:06:56 +01:00
parent aaae34f91d
commit 7819b3b185
5 changed files with 45 additions and 10 deletions

View File

@@ -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,