Skip to content

Commit 22f02d6

Browse files
committed
add 'accessors' option
1 parent 5336903 commit 22f02d6

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/__tests__/render.test.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import CompDefault from './fixtures/Comp.html'
88
describe('render', () => {
99
let props
1010

11-
const render = () => {
11+
const render = (additional={}) => {
1212
return stlRender(Comp, {
1313
target: document.body,
14-
props
14+
props,
15+
...additional
1516
})
1617
}
1718

@@ -40,6 +41,21 @@ describe('render', () => {
4041
expect(getByText('Hello Worlds!')).toBeInTheDocument()
4142
})
4243

44+
test('change props with accessors', async () => {
45+
const { component, getByText } = render({ accessors: true });
46+
47+
expect(getByText('Hello World!')).toBeInTheDocument()
48+
49+
expect( component.name ).toBe('World');
50+
51+
52+
await act(() => {
53+
component.value = 'Planet'
54+
})
55+
56+
expect(getByText('Hello World!')).toBeInTheDocument()
57+
})
58+
4359
test('should accept props directly', () => {
4460
const { getByText } = stlRender(Comp, { name: 'World' })
4561
expect(getByText('Hello World!')).toBeInTheDocument()

src/pure.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const containerCache = new Map()
55
const componentCache = new Set()
66

77
const svelteComponentOptions = [
8+
'accessors',
89
'anchor',
910
'props',
1011
'hydrate',

0 commit comments

Comments
 (0)