You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: test/taBind/taBind.$formatters.spec.js
+17-2
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ describe('taBind.$formatters', function () {
10
10
afterEach(inject(function($document){
11
11
$document.find('body').html('');
12
12
}));
13
-
13
+
14
14
describe('should format textarea html for readability',function(){
15
15
it('adding newlines after immediate child tags',function(){
16
16
$rootScope.html='<p>Test Line 1</p><div>Test Line 2</div><span>Test Line 3</span>';
@@ -32,10 +32,25 @@ describe('taBind.$formatters', function () {
32
32
$rootScope.$digest();
33
33
expect(element.val()).toBe('<ol>\n\t<li>Test Line 1</li>\n\t<ul>\n\t\t<li>Nested Line 1</li>\n\t\t<li>Nested Line 2</li>\n\t</ul>\n\t<li>Test Line 3</li>\n</ol>');
34
34
});
35
+
it('handle nested lists with comments',function(){
36
+
$rootScope.html='<ol><!--This is line 1--><li>Test Line 1</li><ul><!--Nested line 1--> <li>Nested Line 1</li><li>Nested Line 2</li></ul><li>Test Line 3</li></ol>';
37
+
$rootScope.$digest();
38
+
expect(element.val()).toBe('<ol><!--This is line 1-->\n\t<li>Test Line 1</li>\n\t<ul><!--Nested line 1--> \n\t\t<li>Nested Line 1</li>\n\t\t<li>Nested Line 2</li>\n\t</ul>\n\t<li>Test Line 3</li>\n</ol>');
39
+
});
35
40
it('handles no tags (should wrap)',function(){
36
41
$rootScope.html='Test Line 1';
37
42
$rootScope.$digest();
38
43
expect(element.val()).toBe('<p>Test Line 1</p>');
39
44
});
45
+
it('handles html comments',function(){
46
+
$rootScope.html='<!--This is a comment--><p>Test Line 1</p>';
47
+
$rootScope.$digest();
48
+
expect(element.val()).toBe('<!--This is a comment-->\n<p>Test Line 1</p>');
49
+
});
50
+
it('handles html comments with whitespace',function(){
51
+
$rootScope.html='<!--This is a comment--> <p>Test Line 1</p>';
52
+
$rootScope.$digest();
53
+
expect(element.val()).toBe('<!--This is a comment--> \n<p>Test Line 1</p>');
0 commit comments