@@ -99,6 +99,12 @@ export class TestsPalette {
99
99
}
100
100
}
101
101
102
+ public async runAllTestSuites ( ) {
103
+ for ( const testSuiteUI of this . testSuites . values ( ) ) {
104
+ await testSuiteUI . runTestCases ( )
105
+ }
106
+ }
107
+
102
108
}
103
109
104
110
@@ -108,6 +114,7 @@ export class TestSuiteUI {
108
114
109
115
public readonly rootElem : HTMLDivElement
110
116
private readonly header : HTMLDivElement
117
+ private readonly runTestCasesButton : HTMLSpanElement
111
118
private readonly content : HTMLDivElement
112
119
private _expanded = false
113
120
@@ -124,27 +131,16 @@ export class TestSuiteUI {
124
131
125
132
const runAllIcon = makeIcon ( "play" )
126
133
style ( "position: relative; top: -2px;" ) . applyTo ( runAllIcon )
127
- const runAllButton = span ( cls ( "sim-mode-link" ) , style ( "flex: none; font-size: 85%; opacity: 0.9; margin: -2px 0 -2px 4px; padding: 2px 4px 0 0;" ) ,
134
+ this . runTestCasesButton = span ( cls ( "sim-mode-link" ) , style ( "flex: none; font-size: 85%; opacity: 0.9; margin: -2px 0 -2px 4px; padding: 2px 4px 0 0;" ) ,
128
135
title ( s . RunTestSuite ) , runAllIcon , s . Run
129
136
) . render ( )
130
137
131
- runAllButton . addEventListener ( "click" , async ( ) => {
132
- const oldExpanded = this . expanded
133
- setHidden ( runAllButton , true )
134
- try {
135
- const testResult = await this . editor . runTestSuite ( this . testSuite , { fast : true } )
136
- if ( testResult !== undefined && testResult . isAllPass ( ) ) {
137
- this . expanded = oldExpanded
138
- }
139
- } finally {
140
- setHidden ( runAllButton , false )
141
- }
142
- } )
138
+ this . runTestCasesButton . addEventListener ( "click" , ( ) => this . runTestCases ( ) )
143
139
144
140
this . header =
145
141
div ( cls ( "test-suite test-disclosable expanded" ) , style ( "display: flex" ) ,
146
142
span ( style ( "flex: auto" ) , testSuite . name ?? s . DefaultTestSuiteName ) ,
147
- runAllButton
143
+ this . runTestCasesButton
148
144
) . render ( )
149
145
this . content =
150
146
div ( cls ( "test-cases" ) , style ( "display: block" ) , ...this . htmlResults . map ( p => p . container ) ) . render ( )
@@ -223,6 +219,19 @@ export class TestSuiteUI {
223
219
this . palette . updateMaxHeight ( )
224
220
}
225
221
222
+ public async runTestCases ( ) {
223
+ const oldExpanded = this . expanded
224
+ setHidden ( this . runTestCasesButton , true )
225
+ try {
226
+ const testResult = await this . editor . runTestSuite ( this . testSuite , { fast : true } )
227
+ if ( testResult !== undefined && testResult . isAllPass ( ) ) {
228
+ this . expanded = oldExpanded
229
+ }
230
+ } finally {
231
+ setHidden ( this . runTestCasesButton , false )
232
+ }
233
+ }
234
+
226
235
public setRunning ( i : number ) {
227
236
if ( ! this . _expanded ) {
228
237
this . expanded = true
0 commit comments