diff --git a/index.js b/index.js
index 7b8d287..4adffa3 100644
--- a/index.js
+++ b/index.js
@@ -77,13 +77,17 @@ function mergeItems(itemType, currentItem, newItem, ignoreLocations) {
currentItem.description = newItem.description;
}
+ if (!currentItem.defaultValue && typeof newItem.defaultValue != 'undefined') {
+ currentItem.defaultValue = newItem.defaultValue;
+ }
+
if (!currentItem.type || currentItem.type.type === 'any') {
if (newItem.type && newItem.type.type !== 'any') {
currentItem.type = newItem.type;
}
}
- if (!currentItem.keywords && newItem.keywords) {
+ if ((!currentItem.keywords || currentItem.keywords.length == 0) && newItem.keywords) {
currentItem.keywords = newItem.keywords;
}
diff --git a/test/svelte3/integration/data/data.export.aliace.svelte b/test/svelte3/integration/data/data.export.aliace.svelte
index 0e3fc1f..61b0078 100644
--- a/test/svelte3/integration/data/data.export.aliace.svelte
+++ b/test/svelte3/integration/data/data.export.aliace.svelte
@@ -1,11 +1,20 @@
\ No newline at end of file
diff --git a/test/svelte3/integration/data/data.spec.js b/test/svelte3/integration/data/data.spec.js
index 674be7c..3bac4ec 100644
--- a/test/svelte3/integration/data/data.spec.js
+++ b/test/svelte3/integration/data/data.spec.js
@@ -416,7 +416,7 @@ describe('SvelteDoc v3 - Props', () => {
expect(doc, 'Document should be provided').to.exist;
expect(doc.data, 'Document data should be parsed').to.exist;
- expect(doc.data.length).to.equal(2);
+ expect(doc.data.length).to.equal(4);
const prop = doc.data.find(d => d.name === 'class');
@@ -429,12 +429,25 @@ describe('SvelteDoc v3 - Props', () => {
expect(prop.type).to.eql({ kind: 'type', type: 'Array', text: 'Array' });
expect(prop.locations, 'Code location should be parsed').to.be.exist;
- expect(prop.locations[0]).is.deep.equals({ start: 181, end: 186 });
+ expect(prop.locations[0]).is.deep.equals({ start: 178, end: 183 });
const localProp = doc.data.find(d => d.name === 'classes');
expect(localProp, 'Local prop definition also must be provided').to.exist;
+ const prop2 = doc.data.find(d => d.name === 'switch');
+ expect(prop2).to.exist;
+ expect(prop2.name, 'Aliace name must be exposed instead of original name').to.equal('switch');
+ expect(prop2.localName, 'Local name must be stored').to.equal('switchValue');
+ expect(prop2.defaultValue).to.equal("main");
+ expect(prop2.keywords).to.exist;
+ expect(prop2.keywords.length).to.equal(1);
+
+ const keyword = prop2.keywords[0];
+
+ expect(keyword.name).to.equal('type');
+ expect(keyword.description).to.equal("{'main' | 'sidebar'}");
+
done();
}).catch(e => {
done(e);