Skip to content
This repository was archived by the owner on Jan 7, 2020. It is now read-only.

Commit 1b7617f

Browse files
creating tests
1 parent 010411c commit 1b7617f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

test/e2e/scenarios.coffee

+9
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,12 @@ describe 'module contenteditable', ->
2222
expect(element('#input').html()).toBe 'a <span style="color:red">red</span> b'
2323
expect(element('#input span').html()).toBe 'red'
2424
expect(element('#output').html()).toBe 'a &lt;span style="color:red"&gt;red&lt;/span&gt; b'
25+
26+
it 'setting the model with some pure text should dispaly <br> instead of newlines \\n', ->
27+
input('unformatted').enter('#h1\n\n##h2\n###h3');
28+
expect(element('#output-unformatted').html()).toBe '#h1<br><br>##h2<br>###h3'
29+
30+
it 'putting some unformatted text with <br>s in the html should replace them with newlines', ->
31+
32+
element('#output-unformatted').html('#h1<br><br>##h2<br>###h3');
33+
expect(input('unformatted').val()).toBe('#h1\n\n##h2\n###h3');

test/fixtures/simple.html

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
<hr>
3535
<label>Contenteditable without Model</label>
3636
<div contenteditable>Edit me - I don't affect anything</div>
37+
<hr>
38+
<label>Model has pure text</label>
39+
<br>
40+
<textarea id="inputUnformatted" ng-model="unformatted"></textarea>
41+
<div id="output-unformatted" contenteditable="true" ng-model="unformatted" unformatted-text="true"></div>
3742
</div>
3843
</body>
3944
</html>

0 commit comments

Comments
 (0)