|
1 | 1 | describe('Renderers: minami', () => { |
2 | | - beforeEach(() => { |
| 2 | + before(() => { |
3 | 3 | cy.visit('/../../../example/docs-minami/BetterCounter.html'); |
4 | 4 | }); |
5 | 5 |
|
| 6 | + |
6 | 7 | it('should renders props correctly', () => { |
7 | | - cy.get('[data-vue="section-props"]').contains('Props'); |
| 8 | + cy.get('[data-jsdoc-vuejs="section-props"]').contains('Props').should('have.class', 'subsection-title'); |
| 9 | + cy.get('[data-jsdoc-vuejs="table-props"]').as('table-props').should('have.class', 'params'); |
| 10 | + |
| 11 | + cy |
| 12 | + .get('@table-props') |
| 13 | + .find('> thead > tr > th') |
| 14 | + .should(($headers) => { |
| 15 | + expect($headers).to.have.length(5); |
| 16 | + expect($headers.eq(0).text()).to.contains('Name'); |
| 17 | + expect($headers.eq(1).text()).to.contains('Type'); |
| 18 | + expect($headers.eq(2).text()).to.contains('Default value'); |
| 19 | + expect($headers.eq(3).text()).to.contains('Required ?'); |
| 20 | + expect($headers.eq(4).text()).to.contains('Description'); |
| 21 | + }); |
| 22 | + |
| 23 | + cy |
| 24 | + .get('@table-props') |
| 25 | + .find('> tbody > tr') |
| 26 | + .then(($rows) => { |
| 27 | + const $firstRowChildren = $rows.eq(0).children(); |
| 28 | + const $secondRowChildren = $rows.eq(1).children(); |
| 29 | + |
| 30 | + expect($rows).to.have.length(2); |
| 31 | + |
| 32 | + expect($firstRowChildren.eq(0).html()).to.eq('initialCounter'); |
| 33 | + expect($firstRowChildren.eq(0).attr('class')).to.eq('name'); |
| 34 | + expect($firstRowChildren.eq(1).html()).to.eq('Number'); |
| 35 | + expect($firstRowChildren.eq(2).html()).to.eq('-'); |
| 36 | + expect($firstRowChildren.eq(3).html()).to.eq('<b>Yes</b>'); |
| 37 | + expect($firstRowChildren.eq(4).html()).to.eq('-'); |
| 38 | + |
| 39 | + expect($secondRowChildren.eq(0).html()).to.eq('step'); |
| 40 | + expect($secondRowChildren.eq(0).attr('class')).to.eq('name'); |
| 41 | + expect($secondRowChildren.eq(1).html()).to.eq('Number'); |
| 42 | + expect($secondRowChildren.eq(2).html()).to.eq('<code>1</code>'); |
| 43 | + expect($secondRowChildren.eq(3).html()).to.eq('No'); |
| 44 | + expect($secondRowChildren.eq(4).html()).to.eq('Step'); |
| 45 | + }); |
8 | 46 | }); |
9 | 47 |
|
10 | 48 | it('should renders data correctly', () => { |
11 | | - cy.get('[data-vue="section-data"]').contains('Data'); |
| 49 | + cy.get('[data-jsdoc-vuejs="section-data"]').contains('Data').should('have.class', 'subsection-title'); |
| 50 | + cy.get('[data-jsdoc-vuejs="table-data"]').as('table-data').should('have.class', 'params'); |
| 51 | + |
| 52 | + cy |
| 53 | + .get('@table-data') |
| 54 | + .find('> thead > tr > th') |
| 55 | + .should(($headers) => { |
| 56 | + expect($headers).to.have.length(4); |
| 57 | + expect($headers.eq(0).text()).to.contains('Name'); |
| 58 | + expect($headers.eq(1).text()).to.contains('Type'); |
| 59 | + expect($headers.eq(2).text()).to.contains('Default value'); |
| 60 | + expect($headers.eq(3).text()).to.contains('Description'); |
| 61 | + }); |
| 62 | + |
| 63 | + cy |
| 64 | + .get('@table-data') |
| 65 | + .find('> tbody > tr') |
| 66 | + .then(($rows) => { |
| 67 | + const $rowChildren = $rows.eq(0).children(); |
| 68 | + |
| 69 | + expect($rows).to.have.length(1); |
| 70 | + |
| 71 | + expect($rowChildren.eq(0).html()).to.eq('counter'); |
| 72 | + expect($rowChildren.eq(1).html()).to.eq('Number'); |
| 73 | + expect($rowChildren.eq(2).html()).to.eq('-'); |
| 74 | + expect($rowChildren.eq(3).html()).to.eq('Current counter\'s value'); |
| 75 | + }); |
12 | 76 | }); |
13 | 77 |
|
14 | 78 | it('should renders computed correctly', () => { |
15 | | - cy.get('[data-vue="section-computed"]').contains('Computed'); |
| 79 | + cy.get('[data-jsdoc-vuejs="section-computed"]').contains('Computed').should('have.class', 'subsection-title'); |
| 80 | + cy.get('[data-jsdoc-vuejs="table-computed"]').as('table-data').should('have.class', 'params'); |
| 81 | + |
| 82 | + cy |
| 83 | + .get('@table-data') |
| 84 | + .find('> thead > tr > th') |
| 85 | + .should(($headers) => { |
| 86 | + expect($headers).to.have.length(3); |
| 87 | + expect($headers.eq(0).text()).to.contains('Name'); |
| 88 | + expect($headers.eq(1).text()).to.contains('Type'); |
| 89 | + expect($headers.eq(2).text()).to.contains('Description'); |
| 90 | + }); |
| 91 | + |
| 92 | + cy |
| 93 | + .get('@table-data') |
| 94 | + .find('> tbody > tr') |
| 95 | + .then(($rows) => { |
| 96 | + const $rowChildren = $rows.eq(0).children(); |
| 97 | + |
| 98 | + expect($rows).to.have.length(1); |
| 99 | + |
| 100 | + expect($rowChildren.eq(0).html()).to.eq('message'); |
| 101 | + expect($rowChildren.eq(0).attr('class')).to.eq('name'); |
| 102 | + expect($rowChildren.eq(1).html()).to.eq('String'); |
| 103 | + expect($rowChildren.eq(2).html()).to.eq('A message'); |
| 104 | + }); |
16 | 105 | }); |
17 | 106 | }); |
0 commit comments