Skip to content

Commit

Permalink
fix: arrow functions should be ignored (#79)
Browse files Browse the repository at this point in the history
Fix #78
  • Loading branch information
Kocal committed Jun 28, 2018
1 parent 8eaa38f commit b7875c2
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 35 deletions.
26 changes: 18 additions & 8 deletions cypress/integration/renderers/default.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,23 @@ describe('Renderers: default', () => {
.get('@table-data')
.find('> tbody > tr')
.then(($rows) => {
const $rowChildren = $rows.eq(0).children();
const $firstRowChildren = $rows.eq(0).children();
const $secondRowChildren = $rows.eq(1).children();
const $thirdRowChildren = $rows.eq(2).children();

expect($rows).to.have.length(1);
expect($rows).to.have.length(3);

expect($rowChildren.eq(0).html()).to.eq('<b>message</b>');
expect($rowChildren.eq(1).html()).to.eq('String');
expect($rowChildren.eq(2).html()).to.eq('A message');
expect($firstRowChildren.eq(0).html()).to.eq('<b>fooList</b>');
expect($firstRowChildren.eq(1).html()).to.eq('Array');
expect($firstRowChildren.eq(2).html()).to.eq('A list of foo');

expect($secondRowChildren.eq(0).html()).to.eq('<b>barList</b>');
expect($secondRowChildren.eq(1).html()).to.eq('Array');
expect($secondRowChildren.eq(2).html()).to.eq('A list of bar');

expect($thirdRowChildren.eq(0).html()).to.eq('<b>message</b>');
expect($thirdRowChildren.eq(1).html()).to.eq('String');
expect($thirdRowChildren.eq(2).html()).to.eq('A message');
});
});

Expand All @@ -107,21 +117,21 @@ describe('Renderers: default', () => {
.contains('decrement()')
.next('.description')
.next('.details')
.find('a[href="BetterCounter.vue.html#line43"]', 'line 43');
.find('a[href="BetterCounter.vue.html#line51"]', 'line 51');

cy.get('#increment')
.contains('increment()')
.next('.description')
.next('.details')
.find('a[href="BetterCounter.vue.html#line36"]', 'line 36');
.find('a[href="BetterCounter.vue.html#line44"]', 'line 44');

cy.get('#showDialog')
.contains('showDialog(counter)')
.next('.description')
.next('h5')
.next('.params')
.next('.details')
.find('a[href="BetterCounter.vue.html#line51"]', 'line 51');
.find('a[href="BetterCounter.vue.html#line59"]', 'line 59');

cy.contains('created()').should('not.exist');
});
Expand Down
26 changes: 18 additions & 8 deletions cypress/integration/renderers/docstrap.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,23 @@ describe('Renderers: docstrap', () => {
.get('@table-data')
.find('> tbody > tr')
.then(($rows) => {
const $rowChildren = $rows.eq(0).children();
const $firstRowChildren = $rows.eq(0).children();
const $secondRowChildren = $rows.eq(1).children();
const $thirdRowChildren = $rows.eq(2).children();

expect($rows).to.have.length(1);
expect($rows).to.have.length(3);

expect($rowChildren.eq(0).html()).to.eq('<b>message</b>');
expect($rowChildren.eq(1).html()).to.eq('String');
expect($rowChildren.eq(2).html()).to.eq('A message');
expect($firstRowChildren.eq(0).html()).to.eq('<b>fooList</b>');
expect($firstRowChildren.eq(1).html()).to.eq('Array');
expect($firstRowChildren.eq(2).html()).to.eq('A list of foo');

expect($secondRowChildren.eq(0).html()).to.eq('<b>barList</b>');
expect($secondRowChildren.eq(1).html()).to.eq('Array');
expect($secondRowChildren.eq(2).html()).to.eq('A list of bar');

expect($thirdRowChildren.eq(0).html()).to.eq('<b>message</b>');
expect($thirdRowChildren.eq(1).html()).to.eq('String');
expect($thirdRowChildren.eq(2).html()).to.eq('A message');
});
});

Expand All @@ -107,21 +117,21 @@ describe('Renderers: docstrap', () => {
.parent()
.next('dd')
.find('.details')
.find('a[href="BetterCounter.vue.html#sunlight-1-line-43"]', 'line 43');
.find('a[href="BetterCounter.vue.html#sunlight-1-line-51"]', 'line 51');

cy.get('#increment')
.contains('increment()')
.parent()
.next('dd')
.find('.details')
.find('a[href="BetterCounter.vue.html#sunlight-1-line-36"]', 'line 36');
.find('a[href="BetterCounter.vue.html#sunlight-1-line-44"]', 'line 44');

cy.get('#showDialog')
.contains('showDialog(counter)')
.parent()
.next('dd')
.find('.details')
.find('a[href="BetterCounter.vue.html#sunlight-1-line-51"]', 'line 51');
.find('a[href="BetterCounter.vue.html#sunlight-1-line-59"]', 'line 59');

cy.contains('created()').should('not.exist');
});
Expand Down
30 changes: 21 additions & 9 deletions cypress/integration/renderers/minami.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,26 @@ describe('Renderers: minami', () => {
.get('@table-data')
.find('> tbody > tr')
.then(($rows) => {
const $rowChildren = $rows.eq(0).children();
const $firstRowChildren = $rows.eq(0).children();
const $secondRowChildren = $rows.eq(1).children();
const $thirdRowChildren = $rows.eq(2).children();

expect($rows).to.have.length(1);
expect($rows).to.have.length(3);

expect($firstRowChildren.eq(0).html()).to.eq('fooList');
expect($firstRowChildren.eq(0).attr('class')).to.eq('name');
expect($firstRowChildren.eq(1).html()).to.eq('Array');
expect($firstRowChildren.eq(2).html()).to.eq('A list of foo');

expect($secondRowChildren.eq(0).html()).to.eq('barList');
expect($secondRowChildren.eq(0).attr('class')).to.eq('name');
expect($secondRowChildren.eq(1).html()).to.eq('Array');
expect($secondRowChildren.eq(2).html()).to.eq('A list of bar');

expect($rowChildren.eq(0).html()).to.eq('message');
expect($rowChildren.eq(0).attr('class')).to.eq('name');
expect($rowChildren.eq(1).html()).to.eq('String');
expect($rowChildren.eq(2).html()).to.eq('A message');
expect($thirdRowChildren.eq(0).html()).to.eq('message');
expect($thirdRowChildren.eq(0).attr('class')).to.eq('name');
expect($thirdRowChildren.eq(1).html()).to.eq('String');
expect($thirdRowChildren.eq(2).html()).to.eq('A message');
});
});

Expand All @@ -110,19 +122,19 @@ describe('Renderers: minami', () => {
.contains('decrement()')
.next('.description')
.next('.details')
.find('a[href="BetterCounter.vue.html#line43"]', 'line 43');
.contains('a[href="BetterCounter.vue.html#line51"]', 'line 51');

cy.get('#increment')
.contains('increment()')
.next('.description')
.next('.details')
.find('a[href="BetterCounter.vue.html#line36"]', 'line 36');
.contains('a[href="BetterCounter.vue.html#line44"]', 'line 44');

cy.get('#showDialog')
.contains('showDialog(counter)')
.next('.description')
.next('.details')
.find('a[href="BetterCounter.vue.html#line51"]', 'line 51');
.contains('a[href="BetterCounter.vue.html#line59"]', 'line 59');

cy.contains('created()').should('not.exist');
});
Expand Down
26 changes: 18 additions & 8 deletions cypress/integration/renderers/tui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,29 +90,39 @@ describe('Renderers: tui', () => {
.get('@table-data')
.find('> tbody > tr')
.then(($rows) => {
const $rowChildren = $rows.eq(0).children();
const $firstRowChildren = $rows.eq(0).children();
const $secondRowChildren = $rows.eq(1).children();
const $thirdRowChildren = $rows.eq(2).children();

expect($rows).to.have.length(1);
expect($rows).to.have.length(3);

expect($rowChildren.eq(0).html()).to.eq('<b>message</b>');
expect($rowChildren.eq(1).html()).to.eq('String');
expect($rowChildren.eq(2).html()).to.eq('A message');
expect($firstRowChildren.eq(0).html()).to.eq('<b>fooList</b>');
expect($firstRowChildren.eq(1).html()).to.eq('Array');
expect($firstRowChildren.eq(2).html()).to.eq('A list of foo');

expect($secondRowChildren.eq(0).html()).to.eq('<b>barList</b>');
expect($secondRowChildren.eq(1).html()).to.eq('Array');
expect($secondRowChildren.eq(2).html()).to.eq('A list of bar');

expect($thirdRowChildren.eq(0).html()).to.eq('<b>message</b>');
expect($thirdRowChildren.eq(1).html()).to.eq('String');
expect($thirdRowChildren.eq(2).html()).to.eq('A message');
});
});

it('should render methods properly', () => {
cy.contains('h3', 'Methods').should('have.attr', 'class', 'subsection-title');
cy.get('#decrement')
.contains('decrement()')
.contains('a[href="BetterCounter.vue.html#line43"]', 'line 43');
.contains('a[href="BetterCounter.vue.html#line51"]', 'line 51');

cy.get('#increment')
.contains('increment()')
.contains('a[href="BetterCounter.vue.html#line36"]', 'line 36');
.contains('a[href="BetterCounter.vue.html#line44"]', 'line 44');

cy.get('#showDialog')
.contains('showDialog(counter)')
.contains('a[href="BetterCounter.vue.html#line51"]', 'line 51');
.contains('a[href="BetterCounter.vue.html#line59"]', 'line 59');

cy.contains('created()').should('not.exist');
});
Expand Down
3 changes: 2 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ink-docstrap": "^1.3.2",
"jsdoc": "^3.5.5",
"minami": "^1.2.3",
"tui-jsdoc-template": "^1.2.2"
"tui-jsdoc-template": "^1.2.2",
"vuex": "^3.0.1"
}
}
8 changes: 8 additions & 0 deletions example/src/BetterCounter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
</template>

<script>
import { mapState } from 'vuex';
/**
* @vue-prop {Number} initialCounter
* @vue-prop {Number} [step=1] Step
* @vue-data {Number} counter - Current counter's value
* @vue-computed {Array} fooList - A list of foo
* @vue-computed {Array} barList - A list of bar
* @vue-computed {String} message A message
*/
export default {
Expand All @@ -25,6 +29,10 @@
}
},
computed: {
...mapState({
fooList: state => state.$_foo.fooList,
barList: state => state.$_foo.barList
}),
message() {
return `Counter: ${this.counter}`
}
Expand Down
4 changes: 4 additions & 0 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"

vuex@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.0.1.tgz#e761352ebe0af537d4bb755a9b9dc4be3df7efd2"

xmlcreate@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/xmlcreate/-/xmlcreate-1.0.2.tgz#fa6bf762a60a413fb3dd8f4b03c5b269238d308f"
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ exports.handlers = {
}

// Methods and hooks
if (e.doclet.kind === 'function') {
if (e.doclet.kind === 'function' && 'memberof' in e.doclet) {
if (e.doclet.memberof.endsWith('.methods')) {
e.doclet.scope = 'instance';
e.doclet.memberof = e.doclet.memberof.replace(/\.methods$/, ''); // force method to be displayed
Expand Down

0 comments on commit b7875c2

Please sign in to comment.