1
0
Fork 0

chore(plugin-notched): Ported to v3

This commit is contained in:
Joost De Cock 2022-09-12 15:22:54 +02:00
parent 39eddb23de
commit 78cf1b94ff
3 changed files with 17 additions and 11 deletions

View file

@ -4,8 +4,14 @@ import { plugin } from '../dist/index.mjs'
const expect = chai.expect
const Pattern = new Design()
const pattern = new Pattern().use(plugin)
const part = {
name: 'test',
draft: ({ Point, snippets, Snippet }) => {
snippets.button = new Snippet('notch', new Point(10, 20))
},
}
const Pattern = new Design({ plugins: [plugin], parts: [part] })
const pattern = new Pattern()
pattern.draft().render()
describe('Notches Plugin Test', () => {
@ -17,15 +23,17 @@ describe('Notches Plugin Test', () => {
expect(pattern.svg.defs.indexOf(`<g id="notch">`)).to.not.equal(-1)
})
it("Draws a notch on an anchor point", () => {
it('Draws a notch on an anchor point', () => {
const part = {
name: 'test',
draft: ({ Point, snippets, Snippet }) => {
snippets.button = new Snippet('notch', new Point(10, 20))
},
}
const Pattern = new Design({ plugins: [plugin], parts: [part] })
const pattern = new Pattern()
pattern.use(plugin)
pattern.parts.test = new pattern.Part()
const { Point, snippets, Snippet } = pattern.parts.test.shorthand()
snippets.button = new Snippet('notch', new Point(10,20))
pattern.render()
pattern.draft().render()
const c = pattern.svg
expect(c.layout.test.svg).to.contain('<use x="10" y="20" xlink:href="#notch"')
})
})