Skip to content

Passing raw HTML to a slot mounting option breaks when starting with a carriage return #202

@lmiller1990

Description

@lmiller1990

Odd error with this:

const ComponentWithSlots = {
  template: `
    <div class="scoped">
      <slot name="scoped" v-bind="{ msg }" />
    </div>
  `,
  data() {
    return {
      msg: 'world'
    }
  }
}

test('scoped slots', () => {
  const wrapper = mount(ComponentWithSlots, {
    slots: {
      scoped: `
        <template #scoped="params">
        Hello {{ params.msg }}
        </template>
      `
    }
  })

  expect(wrapper.html()).toContain('Hello world')
})

Specifically:

BAD:

 scoped: `
        <template #scoped="params">
        Hello {{ params.msg }}
        </template>
      `

GOOD:

 scoped: `<template #scoped="params">
        Hello {{ params.msg }}
        </template>
      `

Probably just need to do trim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions