module("tinymce.html.Writer"); test('Comment', function() { var writer; expect(2); writer = new tinymce.html.Writer(); writer.comment('text'); equal(writer.getContent(), ''); writer = new tinymce.html.Writer(); writer.comment(''); equal(writer.getContent(), ''); }); test('CDATA', function() { var writer; expect(2); writer = new tinymce.html.Writer(); writer.cdata('text'); equal(writer.getContent(), ''); writer = new tinymce.html.Writer(); writer.cdata(''); equal(writer.getContent(), ''); }); test('PI', function() { var writer; expect(2); writer = new tinymce.html.Writer(); writer.pi('xml', 'someval'); equal(writer.getContent(), ''); writer = new tinymce.html.Writer(); writer.pi('xml'); equal(writer.getContent(), ''); }); test('Doctype', function() { var writer; expect(2); writer = new tinymce.html.Writer(); writer.doctype(' text'); equal(writer.getContent(), ''); writer = new tinymce.html.Writer(); writer.doctype(''); equal(writer.getContent(), ''); }); test('Text', function() { var writer; expect(2); writer = new tinymce.html.Writer(); writer.text('te'); writer = new tinymce.html.Writer(); writer.start('b', [{name: 'attr1', value: 'value1'}, {name: 'attr2', value: 'value2'}]); equal(writer.getContent(), ''); writer = new tinymce.html.Writer(); writer.start('b', [{name: 'attr1', value: 'val<"ue1'}]); equal(writer.getContent(), ''); writer = new tinymce.html.Writer(); writer.start('img', [{name: 'attr1', value: 'value1'}, {name: 'attr2', value: 'value2'}], true); equal(writer.getContent(), ''); writer = new tinymce.html.Writer(); writer.start('br', null, true); equal(writer.getContent(), '
'); }); test('End', function() { var writer; expect(1); writer = new tinymce.html.Writer(); writer.end('b'); equal(writer.getContent(), '
'); }); test('Indentation', function() { var writer; expect(2); writer = new tinymce.html.Writer({indent: true, indent_before: 'p', indent_after:'p'}); writer.start('p'); writer.start('span'); writer.text('a'); writer.end('span'); writer.end('p'); writer.start('p'); writer.text('a'); writer.end('p'); equal(writer.getContent(), '

a

\n

a

'); writer = new tinymce.html.Writer({indent: true, indent_before: 'p', indent_after:'p'}); writer.start('p'); writer.text('a'); writer.end('p'); equal(writer.getContent(), '

a

'); }); test('Entities', function() { var writer; expect(3); writer = new tinymce.html.Writer(); writer.start('p', [{name: "title", value: '<>"\'&\u00e5\u00e4\u00f6'}]); writer.text('<>"\'&\u00e5\u00e4\u00f6'); writer.end('p'); equal(writer.getContent(), '

<>"\'&\u00e5\u00e4\u00f6

'); writer = new tinymce.html.Writer({entity_encoding: 'numeric'}); writer.start('p', [{name: "title", value: '<>"\'&\u00e5\u00e4\u00f6'}]); writer.text('<>"\'&\u00e5\u00e4\u00f6'); writer.end('p'); equal(writer.getContent(), '

<>"\'&åäö

'); writer = new tinymce.html.Writer({entity_encoding: 'named'}); writer.start('p', [{name: "title", value: '<>"\'&\u00e5\u00e4\u00f6'}]); writer.text('<>"\'&\u00e5\u00e4\u00f6'); writer.end('p'); equal(writer.getContent(), '

<>"\'&åäö

'); });