Skip to content

Commit

Permalink
detect a g layer with the className "Layer" instead of a non empty ti…
Browse files Browse the repository at this point in the history
…tle (#955)

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

* fix TU
  • Loading branch information
cg-scorpio authored Mar 12, 2024
1 parent 77b7bd9 commit b166aa0
Show file tree
Hide file tree
Showing 2 changed files with 167 additions and 153 deletions.
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

0 comments on commit b166aa0

Please sign in to comment.