carto/test/quoted.test.js
Sandro Santilli d6585d3691 Quote all needed XML chars. See #263.
Includes testcase.
2013-03-27 12:36:25 +01:00

24 lines
870 B
JavaScript

var assert = require('assert');
var tree = require('../lib/carto/tree.js');
require('../lib/carto/tree/quoted');
describe('Quoted', function() {
describe('basic functionality', function() {
it('should be constructed', function() {
var f = new tree.Quoted("Tom's & \"<quoted>\"");
assert.ok(f);
assert.equal(f.is, 'string');
});
it('should produce normal output', function() {
var f = new tree.Quoted("Tom's & \"<quoted>\"");
assert.ok(f);
assert.equal(f.toString(), "Tom's & \"<quoted>\"");
});
it('should produce xml-friendly output', function() {
var f = new tree.Quoted("Tom's & \"<quoted>\"");
assert.ok(f);
assert.equal(f.toString(true), "'Tom&apos;s &amp; &quot;&lt;quoted&gt;&quot;'");
});
});
});