2021-11-21 16:40:26 +01:00
|
|
|
import freesewing from '@freesewing/core'
|
|
|
|
import { version } from '../package.json'
|
2021-11-27 13:10:21 +01:00
|
|
|
import chai from 'chai'
|
|
|
|
import plugin from '../dist/index.js'
|
2021-11-21 16:40:19 +01:00
|
|
|
|
2021-11-21 16:40:26 +01:00
|
|
|
const expect = chai.expect
|
2018-12-22 14:45:07 +01:00
|
|
|
|
2021-11-21 16:59:48 +01:00
|
|
|
const pattern = new freesewing.Pattern().use(plugin)
|
|
|
|
pattern.draft().render()
|
|
|
|
|
2021-11-21 16:40:26 +01:00
|
|
|
it('Should set the plugin name:version attribute', () => {
|
|
|
|
expect(pattern.svg.attributes.get('freesewing:plugin-buttons')).to.equal(version)
|
|
|
|
})
|
2021-11-21 16:59:48 +01:00
|
|
|
|
|
|
|
for (const snippet of ['button', 'buttonhole', 'snap-stud', 'snap-socket']) {
|
|
|
|
it(`Should add the ${snippet} snippet to defs`, () => {
|
|
|
|
expect(pattern.svg.defs.indexOf(`<g id="${snippet}">`)).to.not.equal(-1)
|
|
|
|
})
|
|
|
|
}
|