diff --git a/packages/test-utils/src/wrapper.js b/packages/test-utils/src/wrapper.js index 90e106cb7..237abce2c 100644 --- a/packages/test-utils/src/wrapper.js +++ b/packages/test-utils/src/wrapper.js @@ -1,7 +1,7 @@ // @flow import Vue from 'vue' -import pretty from 'pretty'; +import pretty from 'pretty' import getSelector from './get-selector' import { REF_SELECTOR, FUNCTIONAL_OPTIONS, VUE_VERSION } from 'shared/consts' import config from './config' @@ -224,7 +224,7 @@ export default class Wrapper implements BaseWrapper { */ html(options?: HtmlOptions): string { if (options && options.prettyPrint) { - return pretty(this.element.outerHTML); + return pretty(this.element.outerHTML) } return this.element.outerHTML } diff --git a/test/specs/wrapper/html.spec.js b/test/specs/wrapper/html.spec.js index 538891032..ab3c4a005 100644 --- a/test/specs/wrapper/html.spec.js +++ b/test/specs/wrapper/html.spec.js @@ -39,4 +39,21 @@ describeWithShallowAndMount('html', mountingMethod => { const wrapper = mountingMethod(compiled) expect(wrapper.html()).to.equal(expectedHtml) }) + + it('returns a Wrappers HTML as a pretty printed string', () => { + const expectedHtml = + '\n' + + '
\n' + + ' \n' + + '
\n' + + '' + + const compiled = compileToFunctions(expectedHtml) + const wrapper = mountingMethod(compiled) + const options = { prettyPrint: true } + expect(wrapper.html(options)).to.equal(expectedHtml) + }) })