chore(plugin-grainline): Ported to v3
This commit is contained in:
parent
462a3307d2
commit
a4b11f3a5f
3 changed files with 14 additions and 13 deletions
|
@ -1,22 +1,25 @@
|
|||
import chai from 'chai'
|
||||
import { round, Design } from '@freesewing/core'
|
||||
import { plugin } from './dist/index.mjs'
|
||||
import { plugin } from '../src/index.mjs'
|
||||
|
||||
const expect = chai.expect
|
||||
|
||||
describe('Grainline Plugin Tests', () => {
|
||||
it('Should run the default grainline macro', () => {
|
||||
const Pattern = new Design({ plugins: [ plugin ]})
|
||||
const part = {
|
||||
name: 'test',
|
||||
draft: ({ points, Point, macro }) => {
|
||||
points.from = new Point(10, 20)
|
||||
points.to = new Point(10, 230)
|
||||
macro('grainline', {
|
||||
from: points.from,
|
||||
to: points.to,
|
||||
})
|
||||
},
|
||||
}
|
||||
const Pattern = new Design({ plugins: [plugin], parts: [part] })
|
||||
const pattern = new Pattern()
|
||||
pattern.parts.test = new pattern.Part()
|
||||
pattern.parts.test.points.from = new pattern.Point(10, 20)
|
||||
pattern.parts.test.points.to = new pattern.Point(10, 230)
|
||||
const { macro } = pattern.parts.test.shorthand()
|
||||
macro('grainline', {
|
||||
from: pattern.parts.test.points.from,
|
||||
to: pattern.parts.test.points.to,
|
||||
})
|
||||
|
||||
pattern.draft()
|
||||
const c = pattern.parts.test.paths.grainline
|
||||
expect(c.attributes.get('class')).to.equal('note')
|
||||
expect(c.attributes.get('marker-start')).to.equal('url(#grainlineFrom)')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue