File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 39
39
},
40
40
"dependencies" : {
41
41
"dom-event-types" : " ^1.0.0" ,
42
- "lodash" : " ^4.17.4"
42
+ "lodash" : " ^4.17.4" ,
43
+ "pretty" : " ^2.0.0"
43
44
}
44
45
}
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
5
import getSelector from './get-selector'
5
6
import { REF_SELECTOR , FUNCTIONAL_OPTIONS , VUE_VERSION } from 'shared/consts'
6
7
import config from './config'
@@ -221,7 +222,10 @@ export default class Wrapper implements BaseWrapper {
221
222
/**
222
223
* Returns HTML of element as a string
223
224
*/
224
- html ( ) : string {
225
+ html ( options ? : HtmlOptions ) : string {
226
+ if ( options && options . prettyPrint ) {
227
+ return pretty ( this . element . outerHTML ) ;
228
+ }
225
229
return this . element . outerHTML
226
230
}
227
231
Original file line number Diff line number Diff line change @@ -39,6 +39,13 @@ type NameSelector = {
39
39
name : string
40
40
}
41
41
42
+ /**
43
+ * Options when printing html components as strings
44
+ */
45
+ export class HtmlOptions {
46
+ prettyPrint : boolean
47
+ }
48
+
42
49
/**
43
50
* Base class of Wrapper and WrapperArray
44
51
* It has common methods on both Wrapper and WrapperArray
You can’t perform that action at this time.
0 commit comments