Skip to content

Commit

Permalink
fix(slot): rename ContentSlot to MDCSlot in render function
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Aug 9, 2023
1 parent e23027f commit efc6048
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/module.ts
Expand Up @@ -327,10 +327,11 @@ export default defineNuxtModule<ModuleOptions>({
name: 'content-slot',
enforce: 'pre',
transform (code) {
if (code.includes('<ContentSlot')) {
if (code.includes('ContentSlot')) {
code = code.replace(/<ContentSlot (.*)(:use=['"](\$slots.)?([a-z]*)['"]|use=['"]([a-z]*)['"])/g, '<MDCSlot $1 name="$4"')
code = code.replace(/<\/ContentSlot>/g, '</MDCSlot>')
code = code.replace(/<ContentSlot/g, '<MDCSlot')
code = code.replace(/(['"])ContentSlot['"]/g, '$1MDCSlot$1')
return code
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/features/highlighter.ts
Expand Up @@ -22,7 +22,7 @@ export const testHighlighter = () => {
const styleElement = parsed.body.children.pop()
expect(styleElement.tag).toBe('style')
const style = styleElement.children[0].value
const code = parsed.body.children[0].children[0].children
const code = parsed.body.children[0].children[0].children[0].children

for (const token of code) {
expect(style).toContain(`.${token.props.class}`)
Expand Down

0 comments on commit efc6048

Please sign in to comment.