1
0
Fork 0
freesewing/plugins/plugin-i18n/tests/plugin.test.mjs

28 lines
696 B
JavaScript
Raw Normal View History

import chai from 'chai'
2022-09-07 10:57:47 +02:00
import { Design } from '@freesewing/core'
2022-08-28 12:44:22 +02:00
import { plugin } from '../dist/index.mjs'
const expect = chai.expect
2022-08-28 12:44:22 +02:00
const content = {
strings: {
en: {
testString: 'This is a test string for the i18n plugin'
}
}
}
describe('I18n Plugin Tests', () => {
it('Should translate text on insert', () => {
2022-09-07 10:57:47 +02:00
const Pattern = new Design()
2022-08-28 12:44:22 +02:00
const pattern = new Pattern().use(plugin, content)
pattern.parts.test = new pattern.Part()
pattern.parts.test.points.anchor = new pattern.Point(-12, -34).attr(
'data-text',
2022-08-28 12:44:22 +02:00
'testString'
)
const svg = pattern.draft().render()
2022-08-28 12:44:22 +02:00
expect(svg).to.contain(content.strings.en.testString)
})
})