1
0
Fork 0

fix (banner) add text separately from spacers to allow for i18n during rendering

This commit is contained in:
Enoch Riese 2023-04-18 16:40:30 -04:00
parent ccf2ff3931
commit c147c6b652
2 changed files with 12 additions and 6 deletions

View file

@ -12,8 +12,12 @@ export const bannerMacros = {
}
so.path.attr('data-text-dy', so.dy).attr('data-text-class', `${so.className} center`)
const spacer = ' '.repeat(so.spaces)
let banner = spacer
for (let i = 0; i < so.repeat; i++) banner += so.text + '&#160;'.repeat(so.spaces)
so.path.attr('data-text', banner)
for (let i = 0; i < so.repeat; i++) {
so.path.attr('data-text', spacer)
so.path.attr('data-text', so.text)
}
so.path.attr('data-text', spacer)
},
}

View file

@ -82,6 +82,8 @@ describe('Banner Plugin Tests', () => {
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.example3
expect(c.attributes.get('data-text')).to.equal('&#160;foo&#160;foo&#160;foo&#160;foo&#160;')
expect(c.attributes.get('data-text')).to.equal(
'&#160; foo &#160; foo &#160; foo &#160; foo &#160;'
)
})
})