Skip to content

Commit

Permalink
test(roundtrip): verify local namespace declaration export
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Apr 14, 2020
1 parent 090b84b commit 2d983c8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/fixtures/bpmn/redundant-ns-declaration.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<definitions id="Definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" targetNamespace="http://bpmn.io">
<BPMNDiagram id="BPMNDiagram_1" xmlns="http://www.omg.org/spec/BPMN/20100524/DI">
<BPMNPlane bpmnElement="Definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/DI" />
</BPMNDiagram>
</definitions>
34 changes: 34 additions & 0 deletions test/spec/xml/roundtrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,40 @@ describe('bpmn-moddle - roundtrip', function() {
});
});


it('local namespace declaration / re-definition', function(done) {

// given
fromFile('test/fixtures/bpmn/redundant-ns-declaration.bpmn', function(err, result) {

if (err) {
return done(err);
}

// when
toXML(result, { format: true }, function(err, xml) {

if (err) {
return done(err);
}

// then
// unused namespace declaration is cleaned up
expect(xml).not.to.contain(
'xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"'
);

// local namespace declaration is exported
expect(xml).to.contain(
'<BPMNDiagram xmlns="http://www.omg.org/spec/BPMN/20100524/DI" id="BPMNDiagram_1">'
);

validate(err, xml, done);
});
});

});

});


Expand Down

0 comments on commit 2d983c8

Please sign in to comment.