test(browser): clean up unused code + keep rendered resources

This commit is contained in:
Nico Rehwaldt 2014-04-25 13:30:10 +02:00
parent 0878841b0f
commit 7d0e8dabe0
3 changed files with 10 additions and 38 deletions

View File

@ -1,33 +1,21 @@
var fs = require('fs'); var fs = require('fs');
var BpmnModel = require('bpmn-moddle'), var Modeler = require('../../../lib/Modeler');
Modeler = require('../../../lib/Modeler');
var Matchers = require('../Matchers'); var Matchers = require('../Matchers');
describe('Modeler', function() { describe('Modeler', function() {
var bpmnModel = BpmnModel.instance(); beforeEach(Matchers.add);
function read(xml, opts, callback) {
return BpmnModel.fromXML(xml, 'bpmn:Definitions', opts, callback);
}
var container; var container;
beforeEach(Matchers.add);
beforeEach(function() { beforeEach(function() {
container = document.createElement('div'); container = document.createElement('div');
document.getElementsByTagName('body')[0].appendChild(container); document.getElementsByTagName('body')[0].appendChild(container);
}); });
afterEach(function() {
container.parentNode.removeChild(container);
});
it('should import simple process', function(done) { it('should import simple process', function(done) {

View File

@ -1,33 +1,21 @@
var fs = require('fs'); var fs = require('fs');
var BpmnModel = require('bpmn-moddle'), var Viewer = require('../../../lib/Viewer');
Viewer = require('../../../lib/Viewer');
var Matchers = require('../Matchers'); var Matchers = require('../Matchers');
describe('Viewer', function() { describe('Viewer', function() {
var bpmnModel = BpmnModel.instance(); beforeEach(Matchers.add);
function read(xml, opts, callback) {
return BpmnModel.fromXML(xml, 'bpmn:Definitions', opts, callback);
}
var container; var container;
beforeEach(Matchers.add);
beforeEach(function() { beforeEach(function() {
container = document.createElement('div'); container = document.createElement('div');
document.getElementsByTagName('body')[0].appendChild(container); document.getElementsByTagName('body')[0].appendChild(container);
}); });
afterEach(function() {
container.parentNode.removeChild(container);
});
it('should import simple process', function(done) { it('should import simple process', function(done) {

View File

@ -29,20 +29,16 @@ describe('import/Importer', function() {
document.getElementsByTagName('body')[0].appendChild(container); document.getElementsByTagName('body')[0].appendChild(container);
}); });
afterEach(function() {
container.parentNode.removeChild(container);
});
function createDiagram() { function createDiagram() {
return new Diagram({ return new Diagram({
canvas: { container: container }, canvas: { container: container },
modules: [ bpmnModule ], modules: [ bpmnModule ],
components: [ 'bpmnRegistry'] components: [ 'bpmnRegistry' ]
}); });
} }
it('should fire bpmn.element.add during import', function(done) { it('should fire <bpmn.element.add> during import', function(done) {
// given // given
var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8');