File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 11// @flow
22
33import Vue from 'vue'
4- import pretty from 'pretty' ;
4+ import pretty from 'pretty'
55import getSelector from './get-selector'
66import { REF_SELECTOR , FUNCTIONAL_OPTIONS , VUE_VERSION } from 'shared/consts'
77import config from './config'
@@ -224,7 +224,7 @@ export default class Wrapper implements BaseWrapper {
224224 */
225225 html ( options ? : HtmlOptions ) : string {
226226 if ( options && options . prettyPrint ) {
227- return pretty ( this . element . outerHTML ) ;
227+ return pretty ( this . element . outerHTML )
228228 }
229229 return this . element . outerHTML
230230 }
Original file line number Diff line number Diff line change @@ -39,4 +39,21 @@ describeWithShallowAndMount('html', mountingMethod => {
3939 const wrapper = mountingMethod ( compiled )
4040 expect ( wrapper . html ( ) ) . to . equal ( expectedHtml )
4141 } )
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+ } )
4259} )
You can’t perform that action at this time.
0 commit comments