increment
', type: 'Number', description: "Emit counter's value after increment" },
+ { name: 'decrement
', type: 'Number', description: "Emit counter's value after decrement" },
+ ];
+
+ cy.get('[data-jsdoc-vuejs="section-event"]').contains('Events');
+ cy.get('[data-jsdoc-vuejs="table-event"]').as('table-event');
+
+ cy
+ .get('@table-event')
+ .find('> thead > tr > th')
+ .contains('Name')
+ .next().contains('Payload Type')
+ .next().contains('Description');
+
+ cy
+ .get('@table-event')
+ .find('> tbody > tr')
+ .then(($rows) => {
+ expect($rows).to.have.length(2);
+
+ events.forEach((event, i) => {
+ const $row = $rows.eq(i);
+ const $children = $row.children();
+
+ expect($children.eq(0).html()).to.eq(event.name);
+ expect($children.eq(1).html()).to.eq(event.type);
+ expect($children.eq(2).html()).to.eq(event.description);
+ });
+ });
+ });
+
it('should render methods properly', () => {
cy.contains('h3', 'Methods').should('have.attr', 'class', 'subsection-title');
@@ -151,13 +184,13 @@ describe('Template: default', () => {
.contains('decrement()')
.next('.description')
.next('.details')
- .contains('a[href="better-components_BetterCounter.vue.html#line53"]', 'line 53');
+ .contains('a[href="better-components_BetterCounter.vue.html#line56"]', 'line 56');
cy.get('#increment')
.contains('increment()')
.next('.description')
.next('.details')
- .contains('a[href="better-components_BetterCounter.vue.html#line46"]', 'line 46');
+ .contains('a[href="better-components_BetterCounter.vue.html#line48"]', 'line 48');
cy.get('#showDialog')
.contains('showDialog(counter)')
@@ -165,7 +198,7 @@ describe('Template: default', () => {
.next('h5')
.next('.params')
.next('.details')
- .contains('a[href="better-components_BetterCounter.vue.html#line61"]', 'line 61');
+ .contains('a[href="better-components_BetterCounter.vue.html#line65"]', 'line 65');
cy.contains('created()').should('not.exist');
});
diff --git a/cypress/integration/templates/docstrap.spec.js b/cypress/integration/templates/docstrap.spec.js
index b547a22..5cd64ce 100644
--- a/cypress/integration/templates/docstrap.spec.js
+++ b/cypress/integration/templates/docstrap.spec.js
@@ -144,6 +144,39 @@ describe('Template: docstrap', () => {
});
});
+ it('should renders event correctly', () => {
+ const events = [
+ { name: 'increment
', type: 'Number', description: "Emit counter's value after increment" },
+ { name: 'decrement
', type: 'Number', description: "Emit counter's value after decrement" },
+ ];
+
+ cy.get('[data-jsdoc-vuejs="section-event"]').contains('Events');
+ cy.get('[data-jsdoc-vuejs="table-event"]').as('table-event');
+
+ cy
+ .get('@table-event')
+ .find('> thead > tr > th')
+ .contains('Name')
+ .next().contains('Payload Type')
+ .next().contains('Description');
+
+ cy
+ .get('@table-event')
+ .find('> tbody > tr')
+ .then(($rows) => {
+ expect($rows).to.have.length(2);
+
+ events.forEach((event, i) => {
+ const $row = $rows.eq(i);
+ const $children = $row.children();
+
+ expect($children.eq(0).html()).to.eq(event.name);
+ expect($children.eq(1).html()).to.eq(event.type);
+ expect($children.eq(2).html()).to.eq(event.description);
+ });
+ });
+ });
+
it('should render methods properly', () => {
cy.contains('h3', 'Methods').should('have.attr', 'class', 'subsection-title');
cy.get('#decrement')
@@ -151,21 +184,21 @@ describe('Template: docstrap', () => {
.parent()
.next('dd')
.find('.details')
- .contains('a[href="better-components_BetterCounter.vue.html#sunlight-1-line-53"]', 'line 53');
+ .contains('a[href="better-components_BetterCounter.vue.html#sunlight-1-line-56"]', 'line 56');
cy.get('#increment')
.contains('increment()')
.parent()
.next('dd')
.find('.details')
- .contains('a[href="better-components_BetterCounter.vue.html#sunlight-1-line-46"]', 'line 46');
+ .contains('a[href="better-components_BetterCounter.vue.html#sunlight-1-line-48"]', 'line 48');
cy.get('#showDialog')
.contains('showDialog(counter)')
.parent()
.next('dd')
.find('.details')
- .contains('a[href="better-components_BetterCounter.vue.html#sunlight-1-line-61"]', 'line 61');
+ .contains('a[href="better-components_BetterCounter.vue.html#sunlight-1-line-65"]', 'line 65');
cy.contains('created()').should('not.exist');
});
diff --git a/cypress/integration/templates/minami.spec.js b/cypress/integration/templates/minami.spec.js
index d86fcdc..9900cf7 100644
--- a/cypress/integration/templates/minami.spec.js
+++ b/cypress/integration/templates/minami.spec.js
@@ -146,25 +146,58 @@ describe('Template: minami', () => {
});
});
+ it('should renders event correctly', () => {
+ const events = [
+ { name: 'increment
', type: 'Number', description: "Emit counter's value after increment" },
+ { name: 'decrement
', type: 'Number', description: "Emit counter's value after decrement" },
+ ];
+
+ cy.get('[data-jsdoc-vuejs="section-event"]').contains('Events');
+ cy.get('[data-jsdoc-vuejs="table-event"]').as('table-event');
+
+ cy
+ .get('@table-event')
+ .find('> thead > tr > th')
+ .contains('Name')
+ .next().contains('Payload Type')
+ .next().contains('Description');
+
+ cy
+ .get('@table-event')
+ .find('> tbody > tr')
+ .then(($rows) => {
+ expect($rows).to.have.length(2);
+
+ events.forEach((event, i) => {
+ const $row = $rows.eq(i);
+ const $children = $row.children();
+
+ expect($children.eq(0).html()).to.eq(event.name);
+ expect($children.eq(1).html()).to.eq(event.type);
+ expect($children.eq(2).html()).to.eq(event.description);
+ });
+ });
+ });
+
it('should render methods properly', () => {
cy.contains('h3', 'Methods').should('have.attr', 'class', 'subsection-title');
cy.get('#decrement')
.contains('decrement()')
.next('.description')
.next('.details')
- .contains('a[href="better-components_BetterCounter.vue.html#line53"]', 'line 53');
+ .contains('a[href="better-components_BetterCounter.vue.html#line56"]', 'line 56');
cy.get('#increment')
.contains('increment()')
.next('.description')
.next('.details')
- .contains('a[href="better-components_BetterCounter.vue.html#line46"]', 'line 46');
+ .contains('a[href="better-components_BetterCounter.vue.html#line48"]', 'line 48');
cy.get('#showDialog')
.contains('showDialog(counter)')
.next('.description')
.next('.details')
- .contains('a[href="better-components_BetterCounter.vue.html#line61"]', 'line 61');
+ .contains('a[href="better-components_BetterCounter.vue.html#line65"]', 'line 65');
cy.contains('created()').should('not.exist');
});
diff --git a/cypress/integration/templates/tui.spec.js b/cypress/integration/templates/tui.spec.js
index 7ab1509..8008b27 100644
--- a/cypress/integration/templates/tui.spec.js
+++ b/cypress/integration/templates/tui.spec.js
@@ -148,19 +148,52 @@ describe('Template: tui', () => {
});
});
+ it('should renders event correctly', () => {
+ const events = [
+ { name: 'increment
', type: 'Number', description: "Emit counter's value after increment" },
+ { name: 'decrement
', type: 'Number', description: "Emit counter's value after decrement" },
+ ];
+
+ cy.get('[data-jsdoc-vuejs="section-event"]').contains('Events');
+ cy.get('[data-jsdoc-vuejs="table-event"]').as('table-event');
+
+ cy
+ .get('@table-event')
+ .find('> thead > tr > th')
+ .contains('Name')
+ .next().contains('Payload Type')
+ .next().contains('Description');
+
+ cy
+ .get('@table-event')
+ .find('> tbody > tr')
+ .then(($rows) => {
+ expect($rows).to.have.length(2);
+
+ events.forEach((event, i) => {
+ const $row = $rows.eq(i);
+ const $children = $row.children();
+
+ expect($children.eq(0).html()).to.eq(event.name);
+ expect($children.eq(1).html()).to.eq(event.type);
+ expect($children.eq(2).html()).to.eq(event.description);
+ });
+ });
+ });
+
it('should render methods properly', () => {
cy.contains('h3', 'Methods').should('have.attr', 'class', 'subsection-title');
cy.get('#decrement')
.contains('decrement()')
- .contains('a[href="better-components_BetterCounter.vue.html#line53"]', 'line 53');
+ .contains('a[href="better-components_BetterCounter.vue.html#line56"]', 'line 56');
cy.get('#increment')
.contains('increment()')
- .contains('a[href="better-components_BetterCounter.vue.html#line46"]', 'line 46');
+ .contains('a[href="better-components_BetterCounter.vue.html#line48"]', 'line 48');
cy.get('#showDialog')
.contains('showDialog(counter)')
- .contains('a[href="better-components_BetterCounter.vue.html#line61"]', 'line 61');
+ .contains('a[href="better-components_BetterCounter.vue.html#line65"]', 'line 65');
cy.contains('created()').should('not.exist');
});
diff --git a/example/src/better-components/BetterCounter.vue b/example/src/better-components/BetterCounter.vue
index 0c756d4..b8763f8 100644
--- a/example/src/better-components/BetterCounter.vue
+++ b/example/src/better-components/BetterCounter.vue
@@ -19,6 +19,8 @@
* @vue-computed {Array.Name | +Payload Type | +Description | +
---|---|---|
<%- c.name %> |
+ <%- renderType(c.type) %> | +<%- typeof c.description === 'undefined' ? '-' : c.description %> | +
<%# Re-open JSDoc template tags %> diff --git a/lib/templates/docstrap.ejs b/lib/templates/docstrap.ejs index ea57206..3a9afba 100644 --- a/lib/templates/docstrap.ejs +++ b/lib/templates/docstrap.ejs @@ -72,4 +72,26 @@ <% } %> +<% if(event.length > 0) { %> +
Name | +Payload Type | +Description | +
---|---|---|
<%- c.name %> |
+ <%- renderType(c.type) %> | +<%- typeof c.description === 'undefined' ? '-' : c.description %> | +
<%# Re-open JSDoc template tags %> diff --git a/lib/templates/minami.ejs b/lib/templates/minami.ejs index 529806b..4a18758 100644 --- a/lib/templates/minami.ejs +++ b/lib/templates/minami.ejs @@ -72,4 +72,26 @@ <% } %> +<% if(event.length > 0) { %> +
Name | +Payload Type | +Description | +
---|---|---|
<%- c.name %> |
+ <%- renderType(c.type) %> | +<%- typeof c.description === 'undefined' ? '-' : c.description %> | +
<%# Re-open JSDoc template tags %> diff --git a/lib/templates/tui.ejs b/lib/templates/tui.ejs index 9499013..1aab4ad 100644 --- a/lib/templates/tui.ejs +++ b/lib/templates/tui.ejs @@ -91,4 +91,28 @@
Name | +Payload Type | +Description | +
---|---|---|
<%- c.name %> |
+ <%- renderType(c.type) %> | +<%- typeof c.description === 'undefined' ? '-' : c.description %> | +
<%# Re-open JSDoc template tags %>