diff --git a/packages/core/__tests__/serialization/serialization.xml.test.ts b/packages/core/__tests__/serialization/serialization.xml.test.ts index c7fa2c64a..1667dfe8b 100644 --- a/packages/core/__tests__/serialization/serialization.xml.test.ts +++ b/packages/core/__tests__/serialization/serialization.xml.test.ts @@ -184,7 +184,12 @@ describe('export', () => { v1.setStyle({ fillColor: 'green', strokeWidth: 4 }); v1.geometry = new Geometry(100, 100, 100, 80); const v2 = newVertex('v2', 'vertex 2'); - v2.style = { bendable: false, rounded: true, fontColor: 'yellow' }; + v2.style = { + bendable: false, + rounded: true, + fontColor: 'yellow', + baseStyleNames: ['style1', 'style2'], + }; model.add(parent, v2); const edge = newEdge('e1', 'edge'); @@ -212,7 +217,12 @@ describe('export', () => { - + + + + + + @@ -245,4 +255,41 @@ describe('import after export', () => { style: { fillColor: 'green', shape: 'triangle', strokeWidth: 4 }, }); }); + + test('Cell with baseStyleNames style attribute', () => { + const model = new GraphDataModel(); + new ModelXmlSerializer(model).import( + ` + + + + + + + + + + + + + + + + ` + ); + + const modelChecker = new ModelChecker(model); + modelChecker.checkRootCells(); + modelChecker.checkCellsCount(3); + + modelChecker.expectIsVertex(model.getCell('cell-1'), null, { + style: { + baseStyleNames: ['style1'], + // @ts-ignore FIX should be true + entryPerimeter: 1, + // @ts-ignore FIX should be true + shadow: 1, + }, + }); + }); }); diff --git a/packages/core/__tests__/serialization/utils.ts b/packages/core/__tests__/serialization/utils.ts index c45694fb0..85fbd7d49 100644 --- a/packages/core/__tests__/serialization/utils.ts +++ b/packages/core/__tests__/serialization/utils.ts @@ -45,7 +45,11 @@ export class ModelChecker { expect(cellIds).toHaveLength(count); } - expectIsVertex(cell: Cell | null, value: string, properties?: ExpectCellProperties) { + expectIsVertex( + cell: Cell | null, + value: string | null, + properties?: ExpectCellProperties + ) { this.checkCellBaseProperties(cell, value, properties); if (!cell) return; // cannot occur, this is enforced by checkCellBaseProperties expect(cell.edge).toEqual(false);