This commit is contained in:
Dmitry Vasilev
2022-12-28 00:36:00 +08:00
parent 04c47a44e8
commit cbda099c7f
2 changed files with 28 additions and 1 deletions

View File

@@ -1524,6 +1524,30 @@ const y = x()`
assert_equal(active.index, edited.indexOf('() =>'))
}),
test('edit function modules bug', () => {
const s1 = test_initial_state({
'' : `
import {x} from 'x.js'
const fn = () => {
}
`,
'x.js': `
export const x = 1
`
})
const edited = `
import {x} from 'x.js'
const fn = () => {
1
}
`
const {state: s2} = COMMANDS.input(s1, edited, edited.indexOf('1'))
const s3 = COMMANDS.move_cursor(s2, edited.indexOf('import'))
assert_equal(s3.effects.args[0].result.value.x, 1)
}),
test('edit toplevel', () => {
const code = `
const x = () => {