@@ -121,63 +121,53 @@ export function normalize_new_line(html) {
121121 return html . replace ( / \r \n / g, '\n' ) ;
122122}
123123
124- export function setup_html_equal ( ) {
125- /**
126- * @param {string } actual
127- * @param {string } expected
128- * @param {string } [message]
129- */
130- const assert_html_equal = ( actual , expected , message ) => {
131- try {
132- assert . deepEqual ( normalize_html ( window , actual ) , normalize_html ( window , expected ) , message ) ;
133- } catch ( e ) {
134- if ( Error . captureStackTrace )
135- Error . captureStackTrace ( /** @type {Error } */ ( e ) , assert_html_equal ) ;
136- throw e ;
137- }
138- } ;
139-
140- /**
141- *
142- * @param {string } actual
143- * @param {string } expected
144- * @param {{ preserveComments?: boolean, withoutNormalizeHtml?: boolean } } param2
145- * @param {string } [message]
146- */
147- const assert_html_equal_with_options = (
148- actual ,
149- expected ,
150- { preserveComments, withoutNormalizeHtml } ,
151- message
152- ) => {
153- try {
154- assert . deepEqual (
155- withoutNormalizeHtml
156- ? normalize_new_line ( actual . trim ( ) ) . replace (
157- / ( < ! ( - - ) ? .* ?\2> ) / g,
158- preserveComments !== false ? '$1' : ''
159- )
160- : normalize_html ( window , actual . trim ( ) , { preserveComments } ) ,
161- withoutNormalizeHtml
162- ? normalize_new_line ( expected . trim ( ) ) . replace (
163- / ( < ! ( - - ) ? .* ?\2> ) / g,
164- preserveComments !== false ? '$1' : ''
165- )
166- : normalize_html ( window , expected . trim ( ) , { preserveComments } ) ,
167- message
168- ) ;
169- } catch ( e ) {
170- if ( Error . captureStackTrace )
171- Error . captureStackTrace ( /** @type {Error } */ ( e ) , assert_html_equal_with_options ) ;
172- throw e ;
173- }
174- } ;
175-
176- return {
177- assert_html_equal,
178- assert_html_equal_with_options
179- } ;
180- }
124+ /**
125+ * @param {string } actual
126+ * @param {string } expected
127+ * @param {string } [message]
128+ */
129+ export const assert_html_equal = ( actual , expected , message ) => {
130+ try {
131+ assert . deepEqual ( normalize_html ( window , actual ) , normalize_html ( window , expected ) , message ) ;
132+ } catch ( e ) {
133+ if ( Error . captureStackTrace )
134+ Error . captureStackTrace ( /** @type {Error } */ ( e ) , assert_html_equal ) ;
135+ throw e ;
136+ }
137+ } ;
181138
182- // Common case without options
183- export const { assert_html_equal, assert_html_equal_with_options } = setup_html_equal ( ) ;
139+ /**
140+ *
141+ * @param {string } actual
142+ * @param {string } expected
143+ * @param {{ preserveComments?: boolean, withoutNormalizeHtml?: boolean } } param2
144+ * @param {string } [message]
145+ */
146+ export const assert_html_equal_with_options = (
147+ actual ,
148+ expected ,
149+ { preserveComments, withoutNormalizeHtml } ,
150+ message
151+ ) => {
152+ try {
153+ assert . deepEqual (
154+ withoutNormalizeHtml
155+ ? normalize_new_line ( actual . trim ( ) ) . replace (
156+ / ( < ! ( - - ) ? .* ?\2> ) / g,
157+ preserveComments !== false ? '$1' : ''
158+ )
159+ : normalize_html ( window , actual . trim ( ) , { preserveComments } ) ,
160+ withoutNormalizeHtml
161+ ? normalize_new_line ( expected . trim ( ) ) . replace (
162+ / ( < ! ( - - ) ? .* ?\2> ) / g,
163+ preserveComments !== false ? '$1' : ''
164+ )
165+ : normalize_html ( window , expected . trim ( ) , { preserveComments } ) ,
166+ message
167+ ) ;
168+ } catch ( e ) {
169+ if ( Error . captureStackTrace )
170+ Error . captureStackTrace ( /** @type {Error } */ ( e ) , assert_html_equal_with_options ) ;
171+ throw e ;
172+ }
173+ } ;
0 commit comments