@@ -21,6 +21,7 @@ describe('HTML', function() {
21
21
22
22
var handler , start , text , comment ;
23
23
beforeEach ( function ( ) {
24
+ text = "" ;
24
25
handler = {
25
26
start : function ( tag , attrs , unary ) {
26
27
start = {
@@ -35,7 +36,7 @@ describe('HTML', function() {
35
36
} ) ;
36
37
} ,
37
38
chars : function ( text_ ) {
38
- text = text_ ;
39
+ text + = text_ ;
39
40
} ,
40
41
end :function ( tag ) {
41
42
expect ( tag ) . toEqual ( start . tag ) ;
@@ -81,6 +82,16 @@ describe('HTML', function() {
81
82
expect ( text ) . toEqual ( 'text' ) ;
82
83
} ) ;
83
84
85
+ it ( 'should parse unterminated tags as regular content' , function ( ) {
86
+ htmlParser ( '<a text1 text2 <a text1 text2' , handler ) ;
87
+ expect ( text ) . toEqual ( '<a text1 text2 <a text1 text2' ) ;
88
+ } ) ;
89
+
90
+ it ( 'should accept tag delimiters such as "<" inside real tags' , function ( ) {
91
+ htmlParser ( '<p> 10 < 100 </p>' , handler ) ;
92
+ expect ( text ) . toEqual ( ' 10 < 100 ' ) ;
93
+ } ) ;
94
+
84
95
it ( 'should parse newlines in tags' , function ( ) {
85
96
htmlParser ( '<\ntag\n attr="value"\n>text<\n/\ntag\n>' , handler ) ;
86
97
expect ( start ) . toEqual ( { tag :'tag' , attrs :{ attr :'value' } , unary :false } ) ;
@@ -195,6 +206,12 @@ describe('HTML', function() {
195
206
expectHTML ( '\na\n' ) . toEqual ( ' a ' ) ;
196
207
} ) ;
197
208
209
+ it ( 'should accept tag delimiters such as "<" inside real tags (with nesting)' , function ( ) {
210
+ //this is an integrated version of the 'should accept tag delimiters such as "<" inside real tags' test
211
+ expectHTML ( '<p> 10 < <span>100</span> </p>' )
212
+ . toEqual ( '<p> 10 < <span>100</span> </p>' ) ;
213
+ } ) ;
214
+
198
215
describe ( 'htmlSanitizerWriter' , function ( ) {
199
216
/* global htmlSanitizeWriter: false */
200
217
if ( angular . isUndefined ( window . htmlSanitizeWriter ) ) return ;
0 commit comments