1
0
Fork 0

chore(plugin-theme): Ported to v3

This commit is contained in:
Joost De Cock 2022-09-12 15:38:05 +02:00
parent abab2a67e9
commit 2ead1c7aa0
4 changed files with 39 additions and 43 deletions

View file

@ -6,27 +6,26 @@ const expect = chai.expect
describe('Theme Plugin Tests', () => {
const Pattern = new Design()
const pattern = new Pattern().use(plugin)
pattern.apply({ paperless: true })
const pattern = new Pattern({ paperless: true }).use(plugin)
pattern.draft().render()
it("Should load base CSS", () => {
it('Should load base CSS', () => {
expect(pattern.svg.style).to.contain('svg.freesewing')
})
it("Should load the metric grid for paperless", () => {
it('Should load the metric grid for paperless', () => {
expect(pattern.svg.defs).to.contain('gridline-xs')
expect(pattern.svg.defs).to.contain('M 10 0 L 10 100 M 20 0 L 20')
});
})
it("Should load the imperial grid for paperless", () => {
pattern.apply({ units: 'imperial' })
it('Should load the imperial grid for paperless', () => {
const pattern = new Pattern({ paperless: true, units: 'imperial' }).use(plugin)
pattern.draft().render()
expect(pattern.svg.defs).to.contain('gridline-sm')
expect(pattern.svg.defs).to.contain('M 12.7 0 L 12.7')
});
})
it("Should apply scale.", () => {
it('Should apply scale.', () => {
expect(pattern.svg.style).to.contain('svg.freesewing .text-xxl {\n font-size: 12px')
pattern.settings.scale = 2
@ -35,8 +34,8 @@ describe('Theme Plugin Tests', () => {
expect(pattern.svg.style).to.contain('svg.freesewing .text-xxl {\n font-size: 24px;')
})
it("Should round after applying scale.", () => {
pattern.settings.scale = 1/3
it('Should round after applying scale.', () => {
pattern.settings.scale = 1 / 3
pattern.draft().render()
expect(pattern.svg.style).to.contain('svg.freesewing .text-xxl {\n font-size: 4px')