separate svgcanvas from svgedit

now you can use directlt svgcanvas. see readme.md

* configure workspaces
* move svgcanvas to packages folder
* move utils to common and paint to svgcanvas
* make svgcanvas a dependency of svgedit
* update deps
* workspaces requires npm 7 at least so the ci needs a new node version
* update github actions to V3
* update snapshots using custom svg exports
* remove unmaintained cypress snapshot plugin
* new github action to add coverage in PR
* Update onpushandpullrequest.yml
* svgcanvas v7.1.6
This commit is contained in:
JFH
2022-08-14 15:01:51 +02:00
committed by GitHub
parent 614a361558
commit 43bf93968a
204 changed files with 5206 additions and 20903 deletions

View File

@@ -1,8 +1,8 @@
import {
visitAndApproveStorage, testSnapshot
visitAndApproveStorage
} from '../../support/ui-test-helper.js'
describe('use various parts of svg-edit', function () {
describe('use text tools of svg-edit', function () {
before(() => {
visitAndApproveStorage()
})
@@ -11,57 +11,45 @@ describe('use various parts of svg-edit', function () {
cy.get('#tool_source').click({ force: true })
cy.get('#svg_source_textarea')
.type('{selectall}', { force: true })
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
.type(`<svg width="640" height="480" viewBox="0 0 640 480" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<g class="layer">
<title>Layer 1</title>
</g>
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text', function () {
cy.get('#tool_text')
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 100, 100, { force: true })
cy.get('#svgroot')
.trigger('mousedown', { clientX: 400, clientY: 400, force: true })
.trigger('mouseup', { force: true })
// svgedit use the #text text field to capture the text
cy.get('#text').type('AB', { force: true })
cy.get('#svg_1').should('exist')
// force text position for snapshot tests being consistent on CI/Interactive
cy.get('#selected_x').shadow().find('elix-number-spin-box').eq(0).shadow().find('#inner').eq(0).type('{selectall}200', { force: true })
cy.get('#selected_y').shadow().find('elix-number-spin-box').eq(0).shadow().find('#inner').eq(0).type('{selectall}200', { force: true })
cy.svgSnapshot()
// cy.get('#svg_1').should('exist')
})
// For an unknown reason, the position of the text is different on local test vs CI test
// As a workaround, weforce SVG source
it('force svg', function () {
cy.get('#tool_source').click({ force: true })
cy.get('#svg_source_textarea')
.type('{selectall}', { force: true })
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<g class="layer">
<title>Layer 1</title>
<text fill="#000000" font-family="Serif" font-size="24" id="svg_1" stroke="#000000" stroke-width="0" text-anchor="middle" x="100" xml:space="preserve" y="100">AB</text>
</g>
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click({ force: true })
testSnapshot()
})
it('check tool_clone', function () {
cy.get('#svg_1').click({ force: true })
cy.get('#tool_clone')
.click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_italic', function () {
cy.get('#svg_1').click({ force: true })
cy.get('#tool_italic')
.click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_bold', function () {
cy.get('#svg_1').click({ force: true })
cy.get('#tool_bold')
.click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_change_x_y_coordinate', function () {
cy.get('#svg_2').click({ force: true })
@@ -73,7 +61,7 @@ describe('use various parts of svg-edit', function () {
cy.get('#selected_y').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true })
}
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_change_font_size', function () {
cy.get('#svg_1').click({ force: true })
@@ -81,13 +69,13 @@ describe('use various parts of svg-edit', function () {
cy.get('#font_size').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true })
}
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_change_stroke_width', function () {
cy.get('#svg_1').click({ force: true })
cy.get('#stroke_width').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_change_stoke_fill_color', function () {
cy.get('#svg_1').click({ force: true })
@@ -105,7 +93,7 @@ describe('use various parts of svg-edit', function () {
cy.get('#fill_color').shadow().find('#color_picker').eq(0)
.find('#jGraduate_colPick').eq(0).find('#jPicker-table').eq(0)
.find('#Ok').eq(0).click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_change_blur', function () {
cy.get('#svg_2').click({ force: true })
@@ -113,7 +101,7 @@ describe('use various parts of svg-edit', function () {
cy.get('#blur').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true })
}
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_change_opacity', function () {
cy.get('#svg_2').click({ force: true })
@@ -121,14 +109,14 @@ describe('use various parts of svg-edit', function () {
cy.get('#opacity').shadow().find('elix-number-spin-box').eq(0).shadow().find('#downButton').eq(0)
.click({ force: true })
}
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_align_to_page', function () {
cy.get('#svg_2').click({ force: true })
cy.get('#tool_position').shadow().find('#select-container').eq(0).click({ force: true })
cy.get('#tool_position').find('se-list-item').eq(2).shadow().find('[aria-label="option"]').eq(0)
.click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_change_class', function () {
cy.get('#svg_2').click({ force: true })
@@ -153,30 +141,30 @@ describe('use various parts of svg-edit', function () {
it('check tool_text_delete', function () {
cy.get('#svg_2_id').click({ force: true })
cy.get('#tool_delete').click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_change_font_family', function () {
cy.get('#svg_1').click({ force: true })
cy.get('#tool_font_family').shadow().find('select').select('Serif')
testSnapshot()
cy.get('#tool_font_family').shadow().find('select').select('Serif', { force: true })
cy.svgSnapshot()
})
it('check tool_text_decoration_underline', function () {
cy.get('#svg_1').click({ force: true })
cy.get('#tool_text_decoration_underline')
.click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_decoration_linethrough', function () {
cy.get('#svg_1').click({ force: true })
cy.get('#tool_text_decoration_linethrough')
.click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_decoration_overline', function () {
cy.get('#svg_1').click({ force: true })
cy.get('#tool_text_decoration_overline')
.click({ force: true })
testSnapshot()
cy.svgSnapshot()
})
it('check tool_letter_spacing', function () {
cy.get('#svg_1').click({ force: true })
@@ -184,7 +172,7 @@ describe('use various parts of svg-edit', function () {
cy.get('#tool_letter_spacing').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true })
}
testSnapshot()
cy.svgSnapshot()
})
it('check tool_word_spacing', function () {
cy.get('#svg_1').click({ force: true })
@@ -192,7 +180,7 @@ describe('use various parts of svg-edit', function () {
cy.get('#tool_word_spacing').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true })
}
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_length', function () {
cy.get('#svg_1').click({ force: true })
@@ -200,21 +188,22 @@ describe('use various parts of svg-edit', function () {
cy.get('#tool_text_length').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true })
}
testSnapshot()
cy.svgSnapshot()
})
it('check tool_length_adjust', function () {
cy.get('#svg_1').click({ force: true })
cy.get('#tool_length_adjust').shadow().find('select').select(1)
testSnapshot()
cy.svgSnapshot()
})
it('check tool_text_change_rotation', function () {
cy.get('#svg_1').click({ force: true })
for (let n = 0; n < 5; n++) {
for (let n = 0; n < 6; n++) {
cy.get('#angle').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true })
}
cy.get('#svg_1').should('have.attr', 'transform')
.and('match', /rotate\(25/)
// issue with testSnapshot()
.and('match', /rotate\(30/)
// snapshot removed below for inconsistency between local and CI tests.
// cy.svgSnapshot()
})
})