File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1
1
// @flow
2
2
3
3
import Vue from 'vue'
4
- import pretty from 'pretty' ;
4
+ import pretty from 'pretty'
5
5
import getSelector from './get-selector'
6
6
import { REF_SELECTOR , FUNCTIONAL_OPTIONS , VUE_VERSION } from 'shared/consts'
7
7
import config from './config'
@@ -224,7 +224,7 @@ export default class Wrapper implements BaseWrapper {
224
224
*/
225
225
html ( options ? : HtmlOptions ) : string {
226
226
if ( options && options . prettyPrint ) {
227
- return pretty ( this . element . outerHTML ) ;
227
+ return pretty ( this . element . outerHTML )
228
228
}
229
229
return this . element . outerHTML
230
230
}
Original file line number Diff line number Diff line change @@ -39,4 +39,21 @@ describeWithShallowAndMount('html', mountingMethod => {
39
39
const wrapper = mountingMethod ( compiled )
40
40
expect ( wrapper . html ( ) ) . to . equal ( expectedHtml )
41
41
} )
42
+
43
+ it ( 'returns a Wrappers HTML as a pretty printed string' , ( ) => {
44
+ const expectedHtml =
45
+ '<body>\n' +
46
+ ' <div>\n' +
47
+ ' <ul>\n' +
48
+ ' <li></li>\n' +
49
+ ' <li></li>\n' +
50
+ ' </ul>\n' +
51
+ ' </div>\n' +
52
+ '</body>'
53
+
54
+ const compiled = compileToFunctions ( expectedHtml )
55
+ const wrapper = mountingMethod ( compiled )
56
+ const options = { prettyPrint : true }
57
+ expect ( wrapper . html ( options ) ) . to . equal ( expectedHtml )
58
+ } )
42
59
} )
You can’t perform that action at this time.
0 commit comments