mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-11 09:53:24 +01:00
24 lines
848 B
TypeScript
24 lines
848 B
TypeScript
import PlainTextExporter from '../../../src/components/export/PlainTextExporter';
|
|
import Mindmap from '../../../src/components/model/Mindmap';
|
|
import XMLSerializerTango from '../../../src/components/persistence/XMLSerializerTango';
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
|
|
test('mindplot generation of simple maps', () => {
|
|
|
|
// Load DOM ...
|
|
const mapStream =fs.readFileSync(path.resolve(__dirname, '../samples/welcome.xml'),{encoding: 'utf-8'});
|
|
const parser = new DOMParser();
|
|
const document = parser.parseFromString(mapStream.toString(), 'text/xml')
|
|
|
|
// Convert to mindmap ...
|
|
const serializer = new XMLSerializerTango();
|
|
const mindmap:Mindmap = serializer.loadFromDom(document,'welcome');
|
|
|
|
// Inspect ...
|
|
console.log(mindmap);
|
|
|
|
const exporter = new PlainTextExporter(mindmap);
|
|
console.log(exporter.export());
|
|
});
|