diff --git a/test/fixtures/model/multiple-inheritance/base.json b/test/fixtures/model/multiple-inheritance/base.json new file mode 100644 index 0000000..aee872b --- /dev/null +++ b/test/fixtures/model/multiple-inheritance/base.json @@ -0,0 +1,17 @@ +{ + "name": "Multiple Inheritance Base", + "uri": "http://multiple-inheritance-base", + "prefix": "b", + "types": [ + { + "name": "Element", + "properties": [ + { "name": "ownedElement", "type": "b:Element", "isMany": true } + ] + }, + { + "name": "PackageableElement", + "superClass": [ "b:Element" ] + } + ] +} \ No newline at end of file diff --git a/test/fixtures/model/multiple-inheritance/glue.json b/test/fixtures/model/multiple-inheritance/glue.json new file mode 100644 index 0000000..0d45559 --- /dev/null +++ b/test/fixtures/model/multiple-inheritance/glue.json @@ -0,0 +1,16 @@ +{ + "name": "Multiple Inheritance Glue", + "uri": "http://multiple-inheritance-glue", + "prefix": "g", + "types": [ + { + "name": "Diagram", + "superClass": [ + "b:PackageableElement" + ], + "extends": [ + "o:Diagram" + ] + } + ] +} \ No newline at end of file diff --git a/test/fixtures/model/multiple-inheritance/other.json b/test/fixtures/model/multiple-inheritance/other.json new file mode 100644 index 0000000..e495581 --- /dev/null +++ b/test/fixtures/model/multiple-inheritance/other.json @@ -0,0 +1,19 @@ +{ + "name": "Multiple Inheritance Other", + "uri": "http://multiple-inheritance-other", + "prefix": "o", + "types": [ + { + "name": "DiagramElement", + "properties": [ + { "name": "ownedElement", "type": "DiagramElement", "isMany": true } + ] + }, + { + "name": "Diagram", + "superClass": [ + "DiagramElement" + ] + } + ] +} \ No newline at end of file diff --git a/test/spec/extension.js b/test/spec/extension.js index 2aae280..b882760 100644 --- a/test/spec/extension.js +++ b/test/spec/extension.js @@ -212,6 +212,34 @@ describe('extension', function() { }); + + describe('name clashes', function() { + + var model = createModel([ + 'multiple-inheritance/base', + 'multiple-inheritance/other', + 'multiple-inheritance/glue' + ]); + + + it('should handle multiple inheritance through virtual package', function() { + + var baseElement = model.create('b:Element'); + + var otherElement = model.create('o:DiagramElement'); + + var diagram = model.create('o:Diagram', { + 'b:ownedElement': [ baseElement ], + ownedElement: [ otherElement ] + }); + + // then + expect(diagram.$instanceOf('b:Element')).to.be.true; + expect(diagram.$instanceOf('o:DiagramElement')).to.be.true; + }); + + }); + });