@@ -222,6 +222,29 @@ QUnit.test('A newline immediately following a <textarea> tag is stripped', funct
222222 assert . deepEqual ( tokens , [ startTag ( 'textarea' ) , chars ( 'hello' ) , endTag ( 'textarea' ) ] ) ;
223223} ) ;
224224
225+ // https://html.spec.whatwg.org/multipage/syntax.html#element-restrictions
226+ QUnit . test ( 'codemod: A newline immediately following a <pre> tag is stripped' , function ( assert ) {
227+ let tokens = tokenize ( "<pre>\nhello</pre>" , { mode : 'codemod' } ) ;
228+ assert . deepEqual ( tokens , [ startTag ( 'pre' ) , chars ( '\nhello' ) , endTag ( 'pre' ) ] ) ;
229+ } ) ;
230+
231+ QUnit . test ( 'codemod: A newline immediately following a closing </pre> tag is not stripped' , function ( assert ) {
232+ let tokens = tokenize ( "\n<pre>\nhello</pre>\n" , { mode : 'codemod' } ) ;
233+ assert . deepEqual ( tokens , [ chars ( '\n' ) , startTag ( 'pre' ) , chars ( '\nhello' ) , endTag ( 'pre' ) , chars ( '\n' ) ] ) ;
234+ } ) ;
235+
236+ // https://html.spec.whatwg.org/multipage/syntax.html#element-restrictions
237+ QUnit . test ( 'codemod: A newline immediately following a <PRE> tag is stripped' , function ( assert ) {
238+ let tokens = tokenize ( "<PRE>\nhello</PRE>" , { mode : 'codemod' } ) ;
239+ assert . deepEqual ( tokens , [ startTag ( 'PRE' ) , chars ( '\nhello' ) , endTag ( 'PRE' ) ] ) ;
240+ } ) ;
241+
242+ // https://html.spec.whatwg.org/multipage/syntax.html#element-restrictions
243+ QUnit . test ( 'codemod: A newline immediately following a <textarea> tag is stripped' , function ( assert ) {
244+ let tokens = tokenize ( "<textarea>\nhello</textarea>" , { mode : 'codemod' } ) ;
245+ assert . deepEqual ( tokens , [ startTag ( 'textarea' ) , chars ( '\nhello' ) , endTag ( 'textarea' ) ] ) ;
246+ } ) ;
247+
225248// https://html.spec.whatwg.org/multipage/semantics.html#the-title-element
226249QUnit . test ( 'The title element content is always text' , function ( assert ) {
227250 let tokens = tokenize ( "<title>"hey <b>there</b><!-- comment --></title>" ) ;
0 commit comments