Skip to content

Commit ff66d74

Browse files
fixed: slot expressions
1 parent 8fe9be7 commit ff66d74

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export function generateSlotsFromString(source, parserOptions) {
117117
generateJavascript,
118118
createTemplateDependenciesInjectionWrapper,
119119
createSlotsArray
120-
)(parseSimpleString(source, parserOptions))
120+
)(parseSimpleString(source, parserOptions), DEFAULT_OPTIONS.file, source)
121121
}
122122

123123
/**

test/browser.runtime.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ describe('Browser runtime compilation', () => {
1515
const { code } = compiler.compile('<native>{new Date()}</native>')
1616
expect(code).to.match(/new Date\(\)/)
1717
})
18+
19+
it('native apis are not scoped', () => {
20+
const { code } = compiler.compile('<native>{new Date()}</native>')
21+
expect(code).to.match(/new Date\(\)/)
22+
})
1823
})

test/core.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,5 +271,12 @@ describe('Core specs', () => {
271271
expect(code).to.be.match(/id: 'title'/)
272272
expect(code).to.be.match(/id: 'default'/)
273273
})
274+
275+
it('Slot with expressions', () => {
276+
const code = generateSlotsFromString('<my-component><h1 slot="title">title</h1><p>hello {user}!</p></my-component>')
277+
278+
expect(code).to.be.match(/id: 'title'/)
279+
expect(code).to.be.match(/id: 'default'/)
280+
})
274281
})
275282
})

0 commit comments

Comments
 (0)