2021-11-27 16:44:13 +01:00
|
|
|
import chai from 'chai'
|
|
|
|
import freesewing from '@freesewing/core'
|
|
|
|
import plugin from '../dist/index.mjs'
|
2022-08-25 11:31:17 +02:00
|
|
|
import i18n from '../../../packages/i18n/dist/en/index.mjs'
|
2021-11-27 16:44:13 +01:00
|
|
|
|
|
|
|
const expect = chai.expect
|
|
|
|
|
|
|
|
describe('I18n Plugin Tests', () => {
|
|
|
|
it('Should translate text on insert', () => {
|
2022-08-25 11:31:17 +02:00
|
|
|
const pattern = new freesewing.Pattern().use(plugin, { strings: { en: i18n.plugin } })
|
2021-11-27 16:44:13 +01:00
|
|
|
pattern.parts.test = new pattern.Part()
|
|
|
|
pattern.parts.test.points.anchor = new pattern.Point(-12, -34).attr(
|
|
|
|
'data-text',
|
2022-08-25 11:31:17 +02:00
|
|
|
'cutTwoStripsToFinishTheArmholes'
|
2021-11-27 16:44:13 +01:00
|
|
|
)
|
|
|
|
const svg = pattern.draft().render()
|
|
|
|
expect(svg).to.contain('Cut two strips to finish the armholes')
|
|
|
|
})
|
|
|
|
})
|