diff --git a/test/spec/reader.js b/test/spec/reader.js
index 5e41a73..3d89418 100644
--- a/test/spec/reader.js
+++ b/test/spec/reader.js
@@ -556,6 +556,70 @@ describe('Reader', function() {
});
});
+
+ it.only('duplicate custom ns declaration', async function() {
+
+ var extensionModel = createModel([ 'extension/base' ]);
+
+ // given
+ var reader = new Reader(extensionModel);
+ var rootHandler = reader.handler('b:Root');
+
+ var xml =
+ '';
+
+ // when
+ var {
+ rootElement
+ } = await reader.fromXML(xml, rootHandler);
+
+ expect(rootElement).to.jsonEqual({
+ $type: 'b:Root'
+ });
+
+ expect(rootElement.$attrs).to.jsonEqual({
+ 'xmlns:b': 'http://base',
+ 'xmlns:foo': 'http://foo',
+ 'xmlns': 'http://foo',
+ 'foo:bar': '1'
+ });
+ });
+
+
+ it.only('duplicate custom ns declaration, generic element attribute', async function() {
+
+ var extensionModel = createModel([ 'extension/base' ]);
+
+ // given
+ var reader = new Reader(extensionModel);
+ var rootHandler = reader.handler('b:Root');
+
+ var xml =
+ '' +
+ '' +
+ '';
+
+ // when
+ var {
+ rootElement
+ } = await reader.fromXML(xml, rootHandler);
+
+ expect(rootElement).to.jsonEqual({
+ $type: 'b:Root',
+ generic: {
+ $type: 'ns0:generic',
+ bar: '1'
+ }
+ });
+
+ expect(rootElement.$attrs).to.jsonEqual({
+ 'xmlns:b': 'http://base',
+ 'xmlns:foo': 'http://foo',
+ 'xmlns': 'http://foo',
+ 'foo:bar': '1'
+ });
+ });
+
});
@@ -1767,6 +1831,7 @@ describe('Reader', function() {
'xmlns': 'http://extensions'
});
});
+
});
diff --git a/test/spec/rountrip.js b/test/spec/rountrip.js
index 7f09fbd..e764934 100644
--- a/test/spec/rountrip.js
+++ b/test/spec/rountrip.js
@@ -373,6 +373,35 @@ describe('Roundtrip', function() {
expect(output).to.eql(input);
});
+
+ it.only('should keep custom namespace', async function() {
+
+ // given
+ var extendedModel = createModel([ 'extension/base' ]);
+
+ var reader = new Reader(extendedModel);
+ var writer = createWriter(extendedModel);
+
+ var rootHandler = reader.handler('b:Root');
+
+ var input =
+ '' +
+ '' +
+ '' +
+ '';
+
+ // when
+ var {
+ rootElement
+ } = await reader.fromXML(input, rootHandler);
+
+ var output = writer.toXML(rootElement);
+
+ // then
+ expect(output).to.eql(input);
+ });
+
+
});