(function() { describe('Simditor Formatter Module', function() { var editor; editor = null; beforeEach(function() { return editor = spec.generateSimditor(); }); afterEach(function() { spec.destroySimditor(); return editor = null; }); it('can convert url string to anchor element', function() { var $p1, $p2, $p3; $p1 = editor.formatter.autolink($('
http://test.com?x=1
')); $p2 = editor.formatter.autolink($('http://www.test.net?x=1&y=2
')); $p3 = editor.formatter.autolink($('http://127.0.0.1:3000/test
')); expect($p1.html()).toBe('http://test.com?x=1'); expect($p2.html()).toBe('http://www.test.net?x=1&y=2'); return expect($p3.html()).toBe('http://127.0.0.1:3000/test'); }); it('can clean forbidden tags and attributes and modify redundancy tags', function() { var $p1, $p2, $p3, $p4, $p5, $p6; $p1 = $('\r\nthis is a test
this is a test
this is a test
'); expect($p2.html()).toBe('this is a test
'); expect($p3.html()).toBe('var x = 1;'); expect($p4.html()).toBe(''); expect($p5.html()).toBe(''); return expect($p6.html()).toBe(''); }); it('can format all direct children to block node', function() { var $p1, $p2, $p3, $p4; $p1 = editor.formatter.format($('test
'); expect($p3.html()).toBe('this is
test
'); $p2 = editor.formatter.clearHtml('this is
test
', false); expect($p1).toBe('this is\ntest'); return expect($p2).toBe('this is test'); }); return it('can remove empty nodes and useless paragraph', function() { var $p1, $p2; $p1 = $('this is test
this is test