[model][s]: default string renderer will linkify http://... links.

This commit is contained in:
Rufus Pollock
2012-05-24 00:30:35 +01:00
parent 1394b9affa
commit b4255ef18f
2 changed files with 26 additions and 6 deletions

View File

@@ -43,6 +43,7 @@ test('Field: default renderers', function () {
x: 12.3,
myobject: {a: 1, b: 2},
link: 'http://abc.com/',
link2: 'Some text then https://abc.com/',
markdown: '### ABC'
});
var field = new recline.Model.Field({id: 'myobject', type: 'object'});
@@ -55,11 +56,16 @@ test('Field: default renderers', function () {
var exp = '12.3%';
equal(out, exp);
var field = new recline.Model.Field({id: 'link', type: 'string', format: 'link'});
var field = new recline.Model.Field({id: 'link'});
var out = doc.getFieldValue(field);
var exp = '<a href="http://abc.com/">http://abc.com/</a>';
equal(out, exp);
var field = new recline.Model.Field({id: 'link2'});
var out = doc.getFieldValue(field);
var exp = 'Some text then <a href="https://abc.com/">https://abc.com/</a>';
equal(out, exp);
var field = new recline.Model.Field({id: 'markdown', type: 'string', format: 'markdown'});
var out = doc.getFieldValue(field);
// Showdown is not installed so nothing should happen