diff --git a/flow/wrapper.flow.js b/flow/wrapper.flow.js index 47f2b5de9..176a9c05c 100644 --- a/flow/wrapper.flow.js +++ b/flow/wrapper.flow.js @@ -5,7 +5,6 @@ import type WrapperArray from '~src/WrapperArray' declare type Selector = any declare type Components = { [name: string]: Component } -declare type HtmlOptions = { prettyPrint: boolean } declare interface BaseWrapper { // eslint-disable-line no-undef diff --git a/packages/test-utils/src/wrapper.js b/packages/test-utils/src/wrapper.js index 5b8ba5b63..60346ce9a 100644 --- a/packages/test-utils/src/wrapper.js +++ b/packages/test-utils/src/wrapper.js @@ -222,10 +222,7 @@ export default class Wrapper implements BaseWrapper { /** * Returns HTML of element as a string */ - html(options?: HtmlOptions): string { - if (options && !options.prettyPrint) { - return this.element.outerHTML - } + html(): string { return pretty(this.element.outerHTML) } diff --git a/test/specs/mount.spec.js b/test/specs/mount.spec.js index f59176c0e..9bf2493d7 100644 --- a/test/specs/mount.spec.js +++ b/test/specs/mount.spec.js @@ -340,9 +340,12 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => { if (vueVersion > 2.3) { expect(wrapper.vm.$attrs).to.eql({ height: '50px', extra: 'attr' }) } - const htmlOptions = { prettyPrint: false } - expect(wrapper.html(htmlOptions)).to.equal( - `
prop1
prop1
\n' + + ' \n' + + 'bar,123
bar,123
\n' + 'bar
bar
\n' + '1,foo
') + expect(notDestructuringWrapper.html()).to.equal('1,foo
') } ) @@ -113,7 +112,7 @@ describeWithShallowAndMount('scopedSlots', mountingMethod => { } } ) - expect(destructuringWrapper.html(htmlOptions)).to.equal('1,foo
') + expect(destructuringWrapper.html()).to.equal('1,foo
') const notDestructuringWrapper = mountingMethod( { @@ -131,7 +130,7 @@ describeWithShallowAndMount('scopedSlots', mountingMethod => { } } ) - expect(notDestructuringWrapper.html(htmlOptions)).to.equal('1,foo
') + expect(notDestructuringWrapper.html()).to.equal('1,foo
') } ) @@ -146,39 +145,55 @@ describeWithShallowAndMount('scopedSlots', mountingMethod => { noProps: 'baz
' } }) - expect(wrapper.find('#destructuring').html(htmlOptions)).to.equal( - '0,1
1,2
2,3
0,1
\n' + + '1,2
\n' + + '2,3
\n' + + '0,a1
1,a2
2,a3
0,a1
\n' + + '1,a2
\n' + + '2,a3
\n' + + 'abc
abc
\n' + 'baz
baz
\n' + '0,4
1,5
2,6
0,4
\n' + + '1,5
\n' + + '2,6
\n' + + '0,b1
1,b2
2,b3
0,b1
\n' + + '1,b2
\n' + + '2,b3
\n' + + 'ABC
ABC
\n' + 'baz
baz
\n' + 'bar
bar
\n' + 'bar,123
bar,123
\n' + 'world
' } }) - expect(wrapper.html(htmlOptions)).to.contain('hello') - expect(wrapper.html(htmlOptions)).to.contain('world
') + expect(wrapper.html()).to.contain('hello') + expect(wrapper.html()).to.contain('world
') }) it('mounts component with default and named text slot', () => { @@ -498,8 +496,11 @@ describeWithShallowAndMount('options.slots', mountingMethod => { c => c.$options.name === childComponentName ) ).to.equal(true) - expect(ParentComponent.html(htmlOptions)).to.equal( - '1234
1234
\n' + 'Hello
World
Hello
\n' + + 'World
\n' + + '