From 70b04cc98f305c9ce20243caec5af83cd359d0d4 Mon Sep 17 00:00:00 2001 From: joostdecock Date: Sun, 25 Sep 2022 15:22:27 +0200 Subject: [PATCH] chore(plugin-buttons): Changes for v3. See #2856 --- plugins/plugin-buttons/tests/plugin.test.mjs | 42 ++++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/plugins/plugin-buttons/tests/plugin.test.mjs b/plugins/plugin-buttons/tests/plugin.test.mjs index 84a0306d0dd..c24f22571b0 100644 --- a/plugins/plugin-buttons/tests/plugin.test.mjs +++ b/plugins/plugin-buttons/tests/plugin.test.mjs @@ -18,12 +18,15 @@ describe('Buttons Plugin Test', () => { it('Draws a button on an anchor point', () => { const part = { name: 'test', - draft: ({ points, Point, snippets, Snippet }) => { + draft: ({ points, Point, snippets, Snippet, part }) => { points.anchor = new Point(10, 20) snippets.button = new Snippet('button', points.anchor) + + return part }, + plugins: [plugin], } - const Pattern = new Design({ parts: [part], plugins: [plugin] }) + const Pattern = new Design({ parts: [part] }) const svg = new Pattern().draft().render() expect(svg).to.contain(' { it('Draws a buttonhole centred on an anchor point', () => { const part = { name: 'test', - draft: ({ points, Point, snippets, Snippet }) => { + draft: ({ points, Point, snippets, Snippet, part }) => { points.anchor = new Point(10, 20) snippets.button = new Snippet('buttonhole', points.anchor) + + return part }, + plugins: [plugin], } - const Pattern = new Design({ parts: [part], plugins: [plugin] }) + const Pattern = new Design({ parts: [part] }) const svg = new Pattern().draft().render() expect(svg).to.contain(' { it('Draws a buttonhole starting on an anchor point', () => { const part = { name: 'test', - draft: ({ points, Point, snippets, Snippet }) => { + draft: ({ points, Point, snippets, Snippet, part }) => { points.anchor = new Point(10, 20) snippets.button = new Snippet('buttonhole-start', points.anchor) + + return part }, + plugins: [plugin], } - const Pattern = new Design({ parts: [part], plugins: [plugin] }) + const Pattern = new Design({ parts: [part] }) const svg = new Pattern().draft().render() expect(svg).to.contain(' { it('Draws a buttonhole ending on an anchor point', () => { const part = { name: 'test', - draft: ({ points, Point, snippets, Snippet }) => { + draft: ({ points, Point, snippets, Snippet, part }) => { points.anchor = new Point(10, 20) snippets.button = new Snippet('buttonhole-end', points.anchor) + + return part }, + plugins: [plugin], } - const Pattern = new Design({ parts: [part], plugins: [plugin] }) + const Pattern = new Design({ parts: [part] }) const svg = new Pattern().draft().render() expect(svg).to.contain(' { it('Draws a snap-stud on an anchor point', () => { const part = { name: 'test', - draft: ({ points, Point, snippets, Snippet }) => { + draft: ({ points, Point, snippets, Snippet, part }) => { points.anchor = new Point(10, 20) snippets.button = new Snippet('snap-stud', points.anchor) + + return part }, + plugins: [plugin], } - const Pattern = new Design({ parts: [part], plugins: [plugin] }) + const Pattern = new Design({ parts: [part] }) const svg = new Pattern().draft().render() expect(svg).to.contain(' { it('Draws a snap-socket on an anchor point', () => { const part = { name: 'test', - draft: ({ points, Point, snippets, Snippet }) => { + draft: ({ points, Point, snippets, Snippet, part }) => { points.anchor = new Point(10, 20) snippets.button = new Snippet('snap-socket', points.anchor) + + return part }, + plugins: [plugin], } - const Pattern = new Design({ parts: [part], plugins: [plugin] }) + const Pattern = new Design({ parts: [part] }) const svg = new Pattern().draft().render() expect(svg).to.contain('