1- import { module , test , skip } from 'qunit' ;
1+ import { module , test } from 'qunit' ;
22import { setupRenderingTest } from 'ember-qunit' ;
3- import { render , findAll , click } from '@ember/test-helpers' ;
3+ import { render , findAll } from '@ember/test-helpers' ;
44import hbs from 'htmlbars-inline-precompile' ;
55
6- const TIMEOUT_FOR_ANIMATION = 600 ;
76const CLASSES = [ 'Descriptor' , 'Ember' ] ;
87const MODULES = [ '@ember/application' , '@ember/array' ] ;
98
109module ( 'Integration | Component | table of contents' , function ( hooks ) {
1110 setupRenderingTest ( hooks ) ;
1211
13- test ( 'it renders' , async function ( assert ) {
12+ test ( 'it renders classes ' , async function ( assert ) {
1413 // Set any properties with this.set('myProperty', 'value');
1514 this . set ( 'emberVersion' , '2.4.3' ) ;
1615 this . set ( 'classesIDs' , CLASSES ) ;
@@ -29,15 +28,15 @@ module('Integration | Component | table of contents', function (hooks) {
2928 ) ;
3029 const contentReference = '.sub-table-of-contents' ;
3130
32- assert . dom ( contentTitle ) . hasText ( 'Classes' ) ;
31+ assert . dom ( contentTitle ) . includesText ( 'Classes' ) ;
3332 assert
3433 . dom ( `${ contentReference } li` )
3534 . exists ( { count : 2 } , 'We have two items to display' ) ;
3635 assert . dom ( findAll ( `${ contentReference } li` ) [ 0 ] ) . hasText ( CLASSES [ 0 ] ) ;
3736 assert . dom ( findAll ( `${ contentReference } li` ) [ 1 ] ) . hasText ( CLASSES [ 1 ] ) ;
3837 } ) ;
3938
40- test ( 'Starts with underlying content visible ' , async function ( assert ) {
39+ test ( 'it renders packages ' , async function ( assert ) {
4140 // Set any properties with this.set('myProperty', 'value');
4241 this . set ( 'emberVersion' , '2.4.3' ) ;
4342 this . set ( 'moduleIDs' , MODULES ) ;
@@ -54,96 +53,15 @@ module('Integration | Component | table of contents', function (hooks) {
5453 const contentReference = '.sub-table-of-contents' ;
5554 const content = document . querySelector ( contentReference ) ;
5655 const contentTitle = document . querySelector (
57- '[data-test-toc-title="classes "]'
56+ '[data-test-toc-title="packages "]'
5857 ) ;
5958
60- assert . dom ( contentTitle ) . hasText ( 'Classes' ) ;
61- assert . dom ( content ) . hasClass ( 'selected' ) ;
59+ assert . dom ( contentTitle ) . includesText ( 'Packages' ) ;
6260 assert
6361 . dom ( `${ contentReference } li` )
6462 . exists ( { count : 2 } , 'We have two items to display' ) ;
6563 assert . dom ( content ) . isVisible ( ) ;
6664 assert . dom ( findAll ( `${ contentReference } li` ) [ 0 ] ) . hasText ( MODULES [ 0 ] ) ;
6765 assert . dom ( findAll ( `${ contentReference } li` ) [ 1 ] ) . hasText ( MODULES [ 1 ] ) ;
6866 } ) ;
69-
70- skip ( 'Underlying content hides once clicked' , async function ( assert ) {
71- // Set any properties with this.set('myProperty', 'value');
72- this . set ( 'emberVersion' , '2.4.3' ) ;
73- this . set ( 'moduleIDs' , MODULES ) ;
74-
75- await render ( hbs `
76- <TableOfContents
77- @showPrivateClasses={{true}}
78- @version={{this.emberVersion}}
79- @moduleIDs={{this.moduleIDs}}
80- @isShowingNamespaces={{true}}
81- />
82- ` ) ;
83-
84- const contentTitle = document . querySelector (
85- '[data-test-toc-title="packages"]'
86- ) ;
87- const contentReference = '.sub-table-of-content' ;
88- const content = document . querySelector ( contentReference ) ;
89-
90- assert . dom ( contentTitle ) . hasText ( 'Packages' ) ;
91- assert . dom ( content ) . hasClass ( 'selected' ) ;
92- assert . dom ( content ) . isVisible ( ) ;
93-
94- await click ( contentTitle ) ;
95-
96- const done = assert . async ( ) ;
97- setTimeout ( ( ) => {
98- assert . dom ( content ) . isNotVisible ( ) ;
99- assert . dom ( content ) . doesNotHaveClass ( 'selected' ) ;
100- done ( ) ;
101- } , TIMEOUT_FOR_ANIMATION ) ;
102- } ) ;
103-
104- skip ( 'Underlying content should be visible after 2 clicks' , async function ( assert ) {
105- // Set any properties with this.set('myProperty', 'value');
106- this . set ( 'emberVersion' , '2.4.3' ) ;
107- this . set ( 'moduleIDs' , MODULES ) ;
108-
109- await render ( hbs `
110- <TableOfContents
111- @showPrivateClasses={{true}}
112- @version={{this.emberVersion}}
113- @moduleIDs={{this.moduleIDs}}
114- @isShowingNamespaces={{true}}
115- />
116- ` ) ;
117-
118- const titleButton = document . querySelector (
119- '[data-test-toc-title="packages"]'
120- ) ;
121- const contentReference = '.sub-table-of-contents' ;
122- const content = document . querySelector ( contentReference ) ;
123-
124- assert . dom ( titleButton ) . hasText ( 'Packages' ) ;
125- assert . dom ( content ) . hasClass ( 'selected' ) ;
126- assert . dom ( content ) . isVisible ( ) ;
127-
128- await click ( titleButton ) ;
129-
130- const done1 = assert . async ( ) ;
131-
132- setTimeout ( async ( ) => {
133- assert . dom ( content ) . isNotVisible ( ) ;
134- assert . dom ( content ) . doesNotHaveClass ( 'selected' ) ;
135-
136- await click ( titleButton ) ;
137-
138- const done2 = assert . async ( ) ;
139-
140- setTimeout ( ( ) => {
141- assert . dom ( content ) . isVisible ( ) ;
142- assert . dom ( content ) . hasClass ( 'selected' ) ;
143- done2 ( ) ;
144- } , TIMEOUT_FOR_ANIMATION ) ;
145-
146- done1 ( ) ;
147- } , TIMEOUT_FOR_ANIMATION ) ;
148- } ) ;
14967} ) ;
0 commit comments