element-plus/packages/locale/__test__/locale.spec.ts
jeremywu 2bba6d570f
fix(locale): Fix locale translation method (#2645)
- Fix defaultTranslation method that causes error
2021-07-23 23:02:16 +08:00

21 lines
503 B
TypeScript

import { t, use } from '../index'
import zhCn from '../lang/zh-cn'
import en from '../lang/en'
describe('Locale', () => {
test('t', () => {
expect(t('el.popconfirm.confirmButtonText')).toBe('Yes')
})
test('return key name if not defined', () => {
expect(t('el.popconfirm.someThing')).toBeUndefined()
})
test('use', () => {
use(zhCn)
expect(t('el.popconfirm.confirmButtonText')).toBe('确定')
use(en)
expect(t('el.popconfirm.confirmButtonText')).toBe('Yes')
})
})