Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect a g layer with the className "Layer" instead of a non empty title #955

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cypress/e2e/unit/draw.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'pathseg'
import { NS } from '../../../packages/svgcanvas/core/namespaces.js'
import * as draw from '../../../packages/svgcanvas/core/draw.js'
import * as units from '../../../packages/svgcanvas/core/units.js'
import { Layer } from '../../../packages/svgcanvas/core/draw'

describe('draw.Drawing', function () {
const addOwnSpies = (obj) => {
Expand All @@ -28,8 +29,8 @@ describe('draw.Drawing', function () {

units.init(
/**
* @implements {module:units.ElementContainer}
*/
* @implements {module:units.ElementContainer}
*/
{
// used by units.shortFloat - call path: cloneLayer -> copyElem -> convertPath -> pathDSegment -> shortFloat
getRoundDigits () { return 3 }
Expand All @@ -45,8 +46,8 @@ describe('draw.Drawing', function () {
const setCurrentGroup = () => { /* empty fn */ }
draw.init(
/**
* @implements {module:draw.DrawCanvasInit}
*/
* @implements {module:draw.DrawCanvasInit}
*/
{
getCurrentDrawing,
setCurrentGroup
Expand All @@ -67,18 +68,21 @@ describe('draw.Drawing', function () {

const setupSVGWith3Layers = function (svgElem) {
const layer1 = document.createElementNS(NS.SVG, 'g')
layer1.setAttribute('class', Layer.CLASS_NAME)
const layer1Title = document.createElementNS(NS.SVG, 'title')
layer1Title.append(LAYER1)
layer1.append(layer1Title)
svgElem.append(layer1)

const layer2 = document.createElementNS(NS.SVG, 'g')
layer2.setAttribute('class', Layer.CLASS_NAME)
const layer2Title = document.createElementNS(NS.SVG, 'title')
layer2Title.append(LAYER2)
layer2.append(layer2Title)
svgElem.append(layer2)

const layer3 = document.createElementNS(NS.SVG, 'g')
layer3.setAttribute('class', Layer.CLASS_NAME)
const layer3Title = document.createElementNS(NS.SVG, 'title')
layer3Title.append(LAYER3)
layer3.append(layer3Title)
Expand Down
Loading
Loading