Output formatting wip: keeping excessive white space at the end of text intact
[fnpeditor.git] / modules / documentCanvas / tests / utils.test.js
1 define(['libs/chai', './utils.js'], function(chai, utils) {
2
3 'use strict';
4 var assert = chai.assert;
5
6 test('open+open', function() {
7     assert.equal(utils.cleanUp('<div class="class"> \n <div class="class"></div></div>'), '<div class="class"><div class="class"></div></div>');
8 });
9
10 test('close+close', function() {
11     assert.equal(utils.cleanUp('<div><div></div>\n </div>'), '<div><div></div></div>');
12 });
13
14 test('close+open', function() {
15     assert.equal(utils.cleanUp('<div></div>\n <div class="class"></div>'), '<div></div><div class="class"></div>');
16 });
17
18 test('bug', function() {
19     var txt = '\
20                 <section> \
21                     <header class="some.class">Head</header>\
22                     <header class="some.class">er 1</header>\
23                 </section>';
24     var txt2 = '<section><header class="some.class">Head</header><header class="some.class">er 1</header></section>';
25     assert.equal(utils.cleanUp(txt), txt2); 
26 });
27
28
29 });