chore: Fixed plugin tests
This commit is contained in:
parent
aef907bea5
commit
8a5141584c
14 changed files with 122 additions and 114 deletions
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Design, Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from './dist/index.mjs'
|
import { plugin } from './dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
@ -9,6 +9,7 @@ const measurements = {
|
||||||
highBust: 90,
|
highBust: 90,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern({ measurements } ).use(plugin)
|
const pattern = new Pattern({ measurements } ).use(plugin)
|
||||||
pattern.apply({measurements}).draft().render()
|
pattern.apply({measurements}).draft().render()
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from './dist/index.mjs'
|
import { plugin } from './dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.draft().render()
|
pattern.draft().render()
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from '../dist/index.mjs'
|
import { plugin } from '../dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
@ -14,6 +14,7 @@ const content = {
|
||||||
|
|
||||||
describe('I18n Plugin Tests', () => {
|
describe('I18n Plugin Tests', () => {
|
||||||
it('Should translate text on insert', () => {
|
it('Should translate text on insert', () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin, content)
|
const pattern = new Pattern().use(plugin, content)
|
||||||
pattern.parts.test = new pattern.Part()
|
pattern.parts.test = new pattern.Part()
|
||||||
pattern.parts.test.points.anchor = new pattern.Point(-12, -34).attr(
|
pattern.parts.test.points.anchor = new pattern.Point(-12, -34).attr(
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from '../dist/index.mjs'
|
import { plugin } from '../dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
describe('Logo Plugin Tests', () => {
|
describe('Logo Plugin Tests', () => {
|
||||||
it('Should import style and defs', () => {
|
it('Should import style and defs', () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.draft().render()
|
pattern.draft().render()
|
||||||
expect(pattern.svg.defs).to.contain(
|
expect(pattern.svg.defs).to.contain(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Design, Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from './dist/index.mjs'
|
import { plugin } from './dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
@ -13,6 +13,7 @@ const measurements = {
|
||||||
crossSeamFront: 42
|
crossSeamFront: 42
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.apply({ measurements } ).draft()
|
pattern.apply({ measurements } ).draft()
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from '../dist/index.mjs'
|
import { plugin } from '../dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
describe('Mirror Plugin Tests', () => {
|
describe('Mirror Plugin Tests', () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.parts.test = new pattern.Part()
|
pattern.parts.test = new pattern.Part()
|
||||||
pattern.parts.test.points.mirrorA = new pattern.Point(-100, -100)
|
pattern.parts.test.points.mirrorA = new pattern.Point(-100, -100)
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from '../dist/index.mjs'
|
import { plugin } from '../dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.draft().render()
|
pattern.draft().render()
|
||||||
|
|
||||||
|
|
|
@ -154,10 +154,10 @@ export function scalebox(so) {
|
||||||
if (so.title) this.points.__scaleboxTitle.attributes.set('data-text', so.title)
|
if (so.title) this.points.__scaleboxTitle.attributes.set('data-text', so.title)
|
||||||
else {
|
else {
|
||||||
let name = this.context.config?.data?.name || 'No Name'
|
let name = this.context.config?.data?.name || 'No Name'
|
||||||
name = name.replace('@freesewing/', '')
|
if (name.indexOf('@freesewing/') !== -1) name = name.replace('@freesewing/', '')
|
||||||
this.points.__scaleboxTitle = this.points.__scaleboxTitle
|
this.points.__scaleboxTitle = this.points.__scaleboxTitle
|
||||||
.attr('data-text', name)
|
.attr('data-text', name)
|
||||||
.attr('data-text', 'v' +
|
.attr('data-text', 'v' +
|
||||||
this.context.config?.data?.version || 'No Version')
|
this.context.config?.data?.version || 'No Version')
|
||||||
}
|
}
|
||||||
this.points.__scaleboxTitle.attributes.add('data-text-class', 'text-lg')
|
this.points.__scaleboxTitle.attributes.add('data-text-class', 'text-lg')
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Pattern, round } from '@freesewing/core'
|
import { Design, round } from '@freesewing/core'
|
||||||
import { plugin } from '../dist/index.mjs'
|
import { plugin } from '../dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
describe('Scalebox Plugin Tests', () => {
|
describe('Scalebox Plugin Tests', () => {
|
||||||
it("Should run the default scalebox macro", () => {
|
it("Should run the default scalebox macro", () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.parts.test = new pattern.Part();
|
pattern.parts.test = new pattern.Part();
|
||||||
pattern.parts.test.points.anchor = new pattern.Point(100, 200);
|
pattern.parts.test.points.anchor = new pattern.Point(100, 200);
|
||||||
|
@ -73,6 +74,7 @@ describe('Scalebox Plugin Tests', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should run the scalebox macro with rotation", () => {
|
it("Should run the scalebox macro with rotation", () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.parts.test = new pattern.Part();
|
pattern.parts.test = new pattern.Part();
|
||||||
pattern.parts.test.points.anchor = new pattern.Point(100, 200);
|
pattern.parts.test.points.anchor = new pattern.Point(100, 200);
|
||||||
|
@ -113,6 +115,7 @@ describe('Scalebox Plugin Tests', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should run the scalebox macro with default text", () => {
|
it("Should run the scalebox macro with default text", () => {
|
||||||
|
const Pattern = new Design({ data: { version: '1.2.3', name: 'test' }})
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.parts.test = new pattern.Part();
|
pattern.parts.test = new pattern.Part();
|
||||||
pattern.parts.test.points.anchor = new pattern.Point(100, 200);
|
pattern.parts.test.points.anchor = new pattern.Point(100, 200);
|
||||||
|
@ -124,7 +127,7 @@ describe('Scalebox Plugin Tests', () => {
|
||||||
expect(p.get("data-text")).to.equal("FreeSewing");
|
expect(p.get("data-text")).to.equal("FreeSewing");
|
||||||
expect(p.get("data-text-class")).to.equal("text-sm");
|
expect(p.get("data-text-class")).to.equal("text-sm");
|
||||||
p = pattern.parts.test.points.__scaleboxTitle.attributes;
|
p = pattern.parts.test.points.__scaleboxTitle.attributes;
|
||||||
expect(p.get("data-text")).to.equal(" vundefined");
|
expect(p.get("data-text")).to.equal("test v1.2.3");
|
||||||
expect(p.get("data-text-class")).to.equal("text-lg");
|
expect(p.get("data-text-class")).to.equal("text-lg");
|
||||||
p = pattern.parts.test.points.__scaleboxText.attributes;
|
p = pattern.parts.test.points.__scaleboxText.attributes;
|
||||||
expect(p.get("data-text-class")).to.equal("text-xs");
|
expect(p.get("data-text-class")).to.equal("text-xs");
|
||||||
|
@ -133,6 +136,7 @@ describe('Scalebox Plugin Tests', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should run the scalebox macro with custom text", () => {
|
it("Should run the scalebox macro with custom text", () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.parts.test = new pattern.Part();
|
pattern.parts.test = new pattern.Part();
|
||||||
pattern.parts.test.points.anchor = new pattern.Point(100, 200);
|
pattern.parts.test.points.anchor = new pattern.Point(100, 200);
|
||||||
|
@ -156,6 +160,7 @@ describe('Scalebox Plugin Tests', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("Should apply scale to the scalebox macro", () => {
|
it("Should apply scale to the scalebox macro", () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.settings.scale = 0.5
|
pattern.settings.scale = 0.5
|
||||||
pattern.parts.test = new pattern.Part();
|
pattern.parts.test = new pattern.Part();
|
||||||
|
@ -188,6 +193,7 @@ describe('Scalebox Plugin Tests', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should apply scale to the miniscale macro", () => {
|
it("Should apply scale to the miniscale macro", () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.settings.scale = 0.5
|
pattern.settings.scale = 0.5
|
||||||
pattern.parts.test = new pattern.Part();
|
pattern.parts.test = new pattern.Part();
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from '../dist/index.mjs'
|
import { plugin } from '../dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
describe('Theme Plugin Tests', () => {
|
describe('Theme Plugin Tests', () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.apply({ paperless: true })
|
pattern.apply({ paperless: true })
|
||||||
pattern.draft().render()
|
pattern.draft().render()
|
||||||
|
|
|
@ -100,10 +100,15 @@ export const plugin = {
|
||||||
if (mins < 10) mins = `0${mins}`
|
if (mins < 10) mins = `0${mins}`
|
||||||
this.points[`_${prefix}_exportDate`] = so.at
|
this.points[`_${prefix}_exportDate`] = so.at
|
||||||
.shift(-90 - so.rotation, shift * so.scale)
|
.shift(-90 - so.rotation, shift * so.scale)
|
||||||
.attr('data-text', now.toLocaleDateString(
|
.attr(
|
||||||
this.context.settings.locale || 'en',
|
'data-text',
|
||||||
{ weekday: 'long', year: 'numeric', month: 'short', day: 'numeric'}
|
now.toLocaleDateString(this.context.settings.locale || 'en', {
|
||||||
))
|
weekday: 'long',
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
})
|
||||||
|
)
|
||||||
.attr('data-text', `@ ${hours}:${mins}`)
|
.attr('data-text', `@ ${hours}:${mins}`)
|
||||||
.attr('data-text-class', 'text-sm')
|
.attr('data-text-class', 'text-sm')
|
||||||
.attr('data-text-transform', transform(so.at.shift(-90 - so.rotation, shift * so.scale)))
|
.attr('data-text-transform', transform(so.at.shift(-90 - so.rotation, shift * so.scale)))
|
||||||
|
@ -114,4 +119,3 @@ export const plugin = {
|
||||||
// More specifically named exports
|
// More specifically named exports
|
||||||
export const titlePlugin = plugin
|
export const titlePlugin = plugin
|
||||||
export const pluginTitle = plugin
|
export const pluginTitle = plugin
|
||||||
|
|
||||||
|
|
|
@ -1,112 +1,102 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from './dist/index.mjs'
|
import { plugin } from './dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
describe('Title Plugin Tests', () => {
|
describe('Title Plugin Tests', () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.draft().render()
|
pattern.draft().render()
|
||||||
|
|
||||||
it("Should run the title macro", () => {
|
it('Should run the title macro', () => {
|
||||||
let pattern = new Pattern({ name: "testPattern", version: 99 });
|
const Pattern = new Design({ data: { name: 'testPattern', version: 99 } })
|
||||||
pattern.draft = function() {};
|
let pattern = new Pattern()
|
||||||
pattern.use(plugin);
|
pattern.draft = function () {}
|
||||||
pattern.parts.test = new pattern.Part();
|
pattern.use(plugin)
|
||||||
pattern.parts.test.points.anchor = new pattern.Point(-12, -34);
|
pattern.parts.test = new pattern.Part()
|
||||||
let { macro } = pattern.parts.test.shorthand();
|
pattern.parts.test.points.anchor = new pattern.Point(-12, -34)
|
||||||
macro("title", {
|
let { macro } = pattern.parts.test.shorthand()
|
||||||
|
macro('title', {
|
||||||
at: pattern.parts.test.points.anchor,
|
at: pattern.parts.test.points.anchor,
|
||||||
nr: 3,
|
nr: 3,
|
||||||
title: "unitTest"
|
title: 'unitTest',
|
||||||
});
|
})
|
||||||
pattern.render();
|
pattern.render()
|
||||||
let p = pattern.parts.test.points.__titleNr;
|
let p = pattern.parts.test.points.__titleNr
|
||||||
expect(p.x).to.equal(-12);
|
expect(p.x).to.equal(-12)
|
||||||
expect(p.y).to.equal(-34);
|
expect(p.y).to.equal(-34)
|
||||||
expect(p.attributes.get("data-text")).to.equal("3");
|
expect(p.attributes.get('data-text')).to.equal('3')
|
||||||
expect(p.attributes.get("data-text-class")).to.equal(
|
expect(p.attributes.get('data-text-class')).to.equal('text-4xl fill-note font-bold')
|
||||||
"text-4xl fill-note font-bold"
|
expect(p.attributes.get('data-text-x')).to.equal('-12')
|
||||||
);
|
expect(p.attributes.get('data-text-y')).to.equal('-34')
|
||||||
expect(p.attributes.get("data-text-x")).to.equal("-12");
|
p = pattern.parts.test.points.__titleName
|
||||||
expect(p.attributes.get("data-text-y")).to.equal("-34");
|
expect(p.attributes.get('data-text')).to.equal('unitTest')
|
||||||
p = pattern.parts.test.points.__titleName;
|
expect(p.attributes.get('data-text-class')).to.equal('text-lg fill-current font-bold')
|
||||||
expect(p.attributes.get("data-text")).to.equal("unitTest");
|
expect(p.attributes.get('data-text-x')).to.equal('-12')
|
||||||
expect(p.attributes.get("data-text-class")).to.equal("text-lg fill-current font-bold");
|
expect(p.attributes.get('data-text-y')).to.equal('-26')
|
||||||
expect(p.attributes.get("data-text-x")).to.equal("-12");
|
p = pattern.parts.test.points.__titlePattern
|
||||||
expect(p.attributes.get("data-text-y")).to.equal("-26");
|
expect(p.attributes.get('data-text')).to.equal('testPattern v99')
|
||||||
p = pattern.parts.test.points.__titlePattern;
|
expect(p.attributes.get('data-text-class')).to.equal('fill-note')
|
||||||
expect(p.attributes.get("data-text")).to.equal("testPattern v99");
|
expect(p.attributes.get('data-text-x')).to.equal('-12')
|
||||||
expect(p.attributes.get("data-text-class")).to.equal(
|
expect(p.attributes.get('data-text-y')).to.equal('-18')
|
||||||
"fill-note"
|
})
|
||||||
);
|
|
||||||
expect(p.attributes.get("data-text-x")).to.equal("-12");
|
|
||||||
expect(p.attributes.get("data-text-y")).to.equal("-18");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Should run the title macro with append flag", () => {
|
it('Should run the title macro with append flag', () => {
|
||||||
let pattern = new Pattern({ name: "testPattern", version: 99 });
|
const Pattern = new Design({ data: { name: 'testPattern', version: 99 } })
|
||||||
pattern.draft = function() {};
|
let pattern = new Pattern()
|
||||||
pattern.use(plugin);
|
pattern.draft = function () {}
|
||||||
pattern.parts.test = new pattern.Part();
|
pattern.use(plugin)
|
||||||
pattern.parts.test.points.anchor = new pattern.Point(-12, -34).attr(
|
pattern.parts.test = new pattern.Part()
|
||||||
"data-text",
|
pattern.parts.test.points.anchor = new pattern.Point(-12, -34).attr('data-text', '#')
|
||||||
"#"
|
let { macro } = pattern.parts.test.shorthand()
|
||||||
);
|
macro('title', {
|
||||||
let { macro } = pattern.parts.test.shorthand();
|
|
||||||
macro("title", {
|
|
||||||
at: pattern.parts.test.points.anchor,
|
at: pattern.parts.test.points.anchor,
|
||||||
nr: 3,
|
nr: 3,
|
||||||
title: "unitTest",
|
title: 'unitTest',
|
||||||
append: true
|
append: true,
|
||||||
});
|
})
|
||||||
pattern.render();
|
pattern.render()
|
||||||
let p = pattern.parts.test.points.__titleNr;
|
let p = pattern.parts.test.points.__titleNr
|
||||||
expect(p.x).to.equal(-12);
|
expect(p.x).to.equal(-12)
|
||||||
expect(p.y).to.equal(-34);
|
expect(p.y).to.equal(-34)
|
||||||
expect(p.attributes.get("data-text")).to.equal("# 3");
|
expect(p.attributes.get('data-text')).to.equal('# 3')
|
||||||
expect(p.attributes.get("data-text-class")).to.equal(
|
expect(p.attributes.get('data-text-class')).to.equal('text-4xl fill-note font-bold')
|
||||||
"text-4xl fill-note font-bold"
|
expect(p.attributes.get('data-text-x')).to.equal('-12')
|
||||||
);
|
expect(p.attributes.get('data-text-y')).to.equal('-34')
|
||||||
expect(p.attributes.get("data-text-x")).to.equal("-12");
|
})
|
||||||
expect(p.attributes.get("data-text-y")).to.equal("-34");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Should run the title macro with point prefix", () => {
|
it('Should run the title macro with point prefix', () => {
|
||||||
let pattern = new Pattern({ name: "testPattern", version: 99 });
|
const Pattern = new Design({ data: { name: 'testPattern', version: 99 } })
|
||||||
pattern.draft = function() {};
|
let pattern = new Pattern()
|
||||||
pattern.use(plugin);
|
pattern.draft = function () {}
|
||||||
pattern.parts.test = new pattern.Part();
|
pattern.use(plugin)
|
||||||
pattern.parts.test.points.anchor = new pattern.Point(-12, -34).attr(
|
pattern.parts.test = new pattern.Part()
|
||||||
"data-text",
|
pattern.parts.test.points.anchor = new pattern.Point(-12, -34).attr('data-text', '#')
|
||||||
"#"
|
let { macro } = pattern.parts.test.shorthand()
|
||||||
);
|
macro('title', {
|
||||||
let { macro } = pattern.parts.test.shorthand();
|
|
||||||
macro("title", {
|
|
||||||
at: pattern.parts.test.points.anchor,
|
at: pattern.parts.test.points.anchor,
|
||||||
nr: 3,
|
nr: 3,
|
||||||
title: "unitTest",
|
title: 'unitTest',
|
||||||
prefix: "foo"
|
prefix: 'foo',
|
||||||
});
|
})
|
||||||
pattern.render();
|
pattern.render()
|
||||||
let p = pattern.parts.test.points._foo_titleNr;
|
let p = pattern.parts.test.points._foo_titleNr
|
||||||
expect(p.x).to.equal(-12);
|
expect(p.x).to.equal(-12)
|
||||||
expect(p.y).to.equal(-34);
|
expect(p.y).to.equal(-34)
|
||||||
expect(p.attributes.get("data-text")).to.equal("3");
|
expect(p.attributes.get('data-text')).to.equal('3')
|
||||||
expect(p.attributes.get("data-text-class")).to.equal(
|
expect(p.attributes.get('data-text-class')).to.equal('text-4xl fill-note font-bold')
|
||||||
"text-4xl fill-note font-bold"
|
expect(p.attributes.get('data-text-x')).to.equal('-12')
|
||||||
);
|
expect(p.attributes.get('data-text-y')).to.equal('-34')
|
||||||
expect(p.attributes.get("data-text-x")).to.equal("-12");
|
p = pattern.parts.test.points._foo_titleName
|
||||||
expect(p.attributes.get("data-text-y")).to.equal("-34");
|
expect(p.attributes.get('data-text')).to.equal('unitTest')
|
||||||
p = pattern.parts.test.points._foo_titleName;
|
expect(p.attributes.get('data-text-class')).to.equal('text-lg fill-current font-bold')
|
||||||
expect(p.attributes.get("data-text")).to.equal("unitTest");
|
expect(p.attributes.get('data-text-x')).to.equal('-12')
|
||||||
expect(p.attributes.get("data-text-class")).to.equal("text-lg fill-current font-bold");
|
expect(p.attributes.get('data-text-y')).to.equal('-26')
|
||||||
expect(p.attributes.get("data-text-x")).to.equal("-12");
|
p = pattern.parts.test.points._foo_titlePattern
|
||||||
expect(p.attributes.get("data-text-y")).to.equal("-26");
|
expect(p.attributes.get('data-text')).to.equal('testPattern v99')
|
||||||
p = pattern.parts.test.points._foo_titlePattern;
|
expect(p.attributes.get('data-text-class')).to.equal('fill-note')
|
||||||
expect(p.attributes.get("data-text")).to.equal("testPattern v99");
|
expect(p.attributes.get('data-text-x')).to.equal('-12')
|
||||||
expect(p.attributes.get("data-text-class")).to.equal("fill-note");
|
expect(p.attributes.get('data-text-y')).to.equal('-18')
|
||||||
expect(p.attributes.get("data-text-x")).to.equal("-12");
|
})
|
||||||
expect(p.attributes.get("data-text-y")).to.equal("-18");
|
})
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
|
@ -4,4 +4,3 @@ import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
|
||||||
|
|
||||||
// Run shared tests
|
// Run shared tests
|
||||||
sharedPluginTests(plugin)
|
sharedPluginTests(plugin)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from '../dist/index.mjs'
|
import { plugin } from '../dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
describe('Versionfree Plugin Tests', () => {
|
describe('Versionfree Plugin Tests', () => {
|
||||||
|
const Pattern = new Design()
|
||||||
const pattern = new Pattern().use(plugin)
|
const pattern = new Pattern().use(plugin)
|
||||||
pattern.draft().render()
|
pattern.draft().render()
|
||||||
it('Should remove version numbers from SVG attributes', () => {
|
it('Should remove version numbers from SVG attributes', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue