|
|
@@ -251,30 +251,56 @@ test('INSTANCE_LISTENERS', () => {
|
|
|
).toHaveBeenWarned()
|
|
|
})
|
|
|
|
|
|
-test('INSTANCE_SCOPED_SLOTS', () => {
|
|
|
- let slots: Slots
|
|
|
- new Vue({
|
|
|
- template: `<child v-slot="{ msg }">{{ msg }}</child>`,
|
|
|
- components: {
|
|
|
- child: {
|
|
|
- compatConfig: { RENDER_FUNCTION: false },
|
|
|
- render() {
|
|
|
- slots = this.$scopedSlots
|
|
|
+describe('INSTANCE_SCOPED_SLOTS', () => {
|
|
|
+ test('explicit usage', () => {
|
|
|
+ let slots: Slots
|
|
|
+ new Vue({
|
|
|
+ template: `<child v-slot="{ msg }">{{ msg }}</child>`,
|
|
|
+ components: {
|
|
|
+ child: {
|
|
|
+ compatConfig: { RENDER_FUNCTION: false },
|
|
|
+ render() {
|
|
|
+ slots = this.$scopedSlots
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }).$mount()
|
|
|
+ }).$mount()
|
|
|
|
|
|
- expect(slots!.default!({ msg: 'hi' })).toMatchObject([
|
|
|
- {
|
|
|
- type: Text,
|
|
|
- children: 'hi'
|
|
|
- }
|
|
|
- ])
|
|
|
+ expect(slots!.default!({ msg: 'hi' })).toMatchObject([
|
|
|
+ {
|
|
|
+ type: Text,
|
|
|
+ children: 'hi'
|
|
|
+ }
|
|
|
+ ])
|
|
|
|
|
|
- expect(
|
|
|
- deprecationData[DeprecationTypes.INSTANCE_SCOPED_SLOTS].message
|
|
|
- ).toHaveBeenWarned()
|
|
|
+ expect(
|
|
|
+ deprecationData[DeprecationTypes.INSTANCE_SCOPED_SLOTS].message
|
|
|
+ ).toHaveBeenWarned()
|
|
|
+ })
|
|
|
+
|
|
|
+ test('should not include legacy slot usage in $scopedSlots', () => {
|
|
|
+ let normalSlots: Slots
|
|
|
+ let scopedSlots: Slots
|
|
|
+ new Vue({
|
|
|
+ template: `<child><div>default</div></child>`,
|
|
|
+ components: {
|
|
|
+ child: {
|
|
|
+ compatConfig: { RENDER_FUNCTION: false },
|
|
|
+ render() {
|
|
|
+ normalSlots = this.$slots
|
|
|
+ scopedSlots = this.$scopedSlots
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).$mount()
|
|
|
+
|
|
|
+ expect('default' in normalSlots!).toBe(true)
|
|
|
+ expect('default' in scopedSlots!).toBe(false)
|
|
|
+
|
|
|
+ expect(
|
|
|
+ deprecationData[DeprecationTypes.INSTANCE_SCOPED_SLOTS].message
|
|
|
+ ).toHaveBeenWarned()
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
test('INSTANCE_ATTR_CLASS_STYLE', () => {
|