Skip to content

Commit aaa0f53

Browse files
author
Jamie Stumme
committed
test(stubs): limit stub props to 2.2 and above
1 parent 34aadf2 commit aaa0f53

File tree

1 file changed

+39
-26
lines changed

1 file changed

+39
-26
lines changed

Diff for: test/specs/mounting-options/stubs.spec.js

+39-26
Original file line numberDiff line numberDiff line change
@@ -596,34 +596,38 @@ describeWithShallowAndMount('options.stub', mountingMethod => {
596596
delete Vue.options.components['child-component']
597597
})
598598

599-
it('renders props in the element as attributes', () => {
600-
const ComponentStub = { template: '<div id="component-stub" />' }
601-
const StringStub = '<div id="string-stub" />'
602-
const BooleanStub = true
599+
itRunIf(
600+
vueVersion < 2.2,
601+
'renders props in the element as attributes',
602+
() => {
603+
const ComponentStub = { template: '<div id="component-stub" />' }
604+
const StringStub = '<div id="string-stub" />'
605+
const BooleanStub = true
603606

604-
const wrapper = mountingMethod(ComponentWithNestedChildrenAndAttributes, {
605-
stubs: {
606-
SlotComponent: ComponentStub,
607-
ChildComponent: StringStub,
608-
OriginalComponent: BooleanStub
609-
}
610-
})
607+
const wrapper = mountingMethod(ComponentWithNestedChildrenAndAttributes, {
608+
stubs: {
609+
SlotComponent: ComponentStub,
610+
ChildComponent: StringStub,
611+
OriginalComponent: BooleanStub
612+
}
613+
})
611614

612-
expect(wrapper.find('#component-stub').attributes()).to.eql({
613-
id: 'component-stub',
614-
prop1: 'foobar',
615-
prop2: 'fizzbuzz'
616-
})
617-
expect(wrapper.find('#string-stub').attributes()).to.eql({
618-
id: 'string-stub',
619-
prop1: 'foobar',
620-
prop2: 'fizzbuzz'
621-
})
622-
expect(wrapper.find('originalcomponent-stub').attributes()).to.eql({
623-
prop1: 'foobar',
624-
prop2: 'fizzbuzz'
625-
})
626-
})
615+
expect(wrapper.find('#component-stub').attributes()).to.eql({
616+
id: 'component-stub',
617+
prop1: 'foobar',
618+
prop2: 'fizzbuzz'
619+
})
620+
expect(wrapper.find('#string-stub').attributes()).to.eql({
621+
id: 'string-stub',
622+
prop1: 'foobar',
623+
prop2: 'fizzbuzz'
624+
})
625+
expect(wrapper.find('originalcomponent-stub').attributes()).to.eql({
626+
prop1: 'foobar',
627+
prop2: 'fizzbuzz'
628+
})
629+
}
630+
)
627631

628632
it('warns when passing a string', () => {
629633
const StringComponent = '<div></div>'
@@ -639,4 +643,13 @@ describeWithShallowAndMount('options.stub', mountingMethod => {
639643
)
640644
)
641645
})
646+
647+
it('doesnt work', () => {
648+
const StringComponent = 'Hello'
649+
mountingMethod(ComponentWithChild, {
650+
stubs: {
651+
ChildComponent6: StringComponent
652+
}
653+
})
654+
})
642655
})

0 commit comments

Comments
 (0)