/
githubmirror
/
taro
Обзор
Документация
Войти
/
githubmirror
/
taro
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/taro-runtime/tests/react.spec.ts
26 строк
651 B
Yiheng
test(taro-runtime): vitest (#18056)
11 ноя 2025, 04:22
Не верифицирован
11 ноя 2025, 04:22
2de8374
Код
Авторство
О чём код?
import { afterAll, describe, expect, test, vi } from 'vitest' import * as runtime from '../src/index' describe('react', () => { process.env.FRAMEWORK = 'react' const document = runtime.document afterAll(() => { process.env.FRAMEWORK = '' }) test('event should work', () => { const div = document.createElement('div') const spy = vi.fn() div.addEventListener('tap', spy, null) const event = runtime.createEvent({ type: 'tap', detail: {}, target: { dataset: {}, id: '' }, currentTarget: { dataset: {}, id: '' } }, div) div.dispatchEvent(event) expect(spy).toBeCalledTimes(1) }) })