1
- import { module , test , skip } from 'qunit' ;
1
+ import { module , test } from 'qunit' ;
2
2
import { setupRenderingTest } from 'ember-qunit' ;
3
- import { render , findAll , click } from '@ember/test-helpers' ;
3
+ import { render , findAll } from '@ember/test-helpers' ;
4
4
import hbs from 'htmlbars-inline-precompile' ;
5
5
6
- const TIMEOUT_FOR_ANIMATION = 600 ;
7
6
const CLASSES = [ 'Descriptor' , 'Ember' ] ;
8
7
const MODULES = [ '@ember/application' , '@ember/array' ] ;
9
8
10
9
module ( 'Integration | Component | table of contents' , function ( hooks ) {
11
10
setupRenderingTest ( hooks ) ;
12
11
13
- test ( 'it renders' , async function ( assert ) {
12
+ test ( 'it renders classes ' , async function ( assert ) {
14
13
// Set any properties with this.set('myProperty', 'value');
15
14
this . set ( 'emberVersion' , '2.4.3' ) ;
16
15
this . set ( 'classesIDs' , CLASSES ) ;
@@ -29,15 +28,15 @@ module('Integration | Component | table of contents', function (hooks) {
29
28
) ;
30
29
const contentReference = '.sub-table-of-contents' ;
31
30
32
- assert . dom ( contentTitle ) . hasText ( 'Classes' ) ;
31
+ assert . dom ( contentTitle ) . includesText ( 'Classes' ) ;
33
32
assert
34
33
. dom ( `${ contentReference } li` )
35
34
. exists ( { count : 2 } , 'We have two items to display' ) ;
36
35
assert . dom ( findAll ( `${ contentReference } li` ) [ 0 ] ) . hasText ( CLASSES [ 0 ] ) ;
37
36
assert . dom ( findAll ( `${ contentReference } li` ) [ 1 ] ) . hasText ( CLASSES [ 1 ] ) ;
38
37
} ) ;
39
38
40
- test ( 'Starts with underlying content visible ' , async function ( assert ) {
39
+ test ( 'it renders packages ' , async function ( assert ) {
41
40
// Set any properties with this.set('myProperty', 'value');
42
41
this . set ( 'emberVersion' , '2.4.3' ) ;
43
42
this . set ( 'moduleIDs' , MODULES ) ;
@@ -54,96 +53,15 @@ module('Integration | Component | table of contents', function (hooks) {
54
53
const contentReference = '.sub-table-of-contents' ;
55
54
const content = document . querySelector ( contentReference ) ;
56
55
const contentTitle = document . querySelector (
57
- '[data-test-toc-title="classes "]'
56
+ '[data-test-toc-title="packages "]'
58
57
) ;
59
58
60
- assert . dom ( contentTitle ) . hasText ( 'Classes' ) ;
61
- assert . dom ( content ) . hasClass ( 'selected' ) ;
59
+ assert . dom ( contentTitle ) . includesText ( 'Packages' ) ;
62
60
assert
63
61
. dom ( `${ contentReference } li` )
64
62
. exists ( { count : 2 } , 'We have two items to display' ) ;
65
63
assert . dom ( content ) . isVisible ( ) ;
66
64
assert . dom ( findAll ( `${ contentReference } li` ) [ 0 ] ) . hasText ( MODULES [ 0 ] ) ;
67
65
assert . dom ( findAll ( `${ contentReference } li` ) [ 1 ] ) . hasText ( MODULES [ 1 ] ) ;
68
66
} ) ;
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
- } ) ;
149
67
} ) ;
0 commit comments