11import { Suites , Tags } from "./tests.mjs" ;
2- import { params } from "./shared/params.mjs" ;
2+ import { params , LAYOUT_MODES } from "./shared/params.mjs" ;
33
44export function createDeveloperModeContainer ( ) {
55 const container = document . createElement ( "div" ) ;
@@ -18,10 +18,12 @@ export function createDeveloperModeContainer() {
1818 const settings = document . createElement ( "div" ) ;
1919 settings . className = "settings" ;
2020 settings . append ( createUIForIterationCount ( ) ) ;
21+ settings . append ( createUIForMeasurePrepare ( ) ) ;
2122 settings . append ( createUIForWarmupSuite ( ) ) ;
2223 settings . append ( createUIForWarmupBeforeSync ( ) ) ;
2324 settings . append ( createUIForSyncStepDelay ( ) ) ;
2425 settings . append ( createUIForAsyncSteps ( ) ) ;
26+ settings . append ( createUIForLayoutMode ( ) ) ;
2527
2628 content . append ( document . createElement ( "hr" ) ) ;
2729 content . append ( settings ) ;
@@ -46,6 +48,12 @@ function createUIForWarmupSuite() {
4648 } ) ;
4749}
4850
51+ function createUIForMeasurePrepare ( ) {
52+ return createCheckboxUI ( "Measure Prepare" , params . measurePrepare , ( isChecked ) => {
53+ params . measurePrepare = isChecked ;
54+ } ) ;
55+ }
56+
4957function createUIForAsyncSteps ( ) {
5058 return createCheckboxUI ( "Use Async Steps" , params . useAsyncSteps , ( isChecked ) => {
5159 params . useAsyncSteps = isChecked ;
@@ -107,12 +115,37 @@ function createTimeRangeUI(labelText, paramKey, unit = "ms", min = 0, max = 1000
107115 return label ;
108116}
109117
118+ function createUIForLayoutMode ( ) {
119+ return createSelectUI ( "Force layout mode" , params . layoutMode , LAYOUT_MODES , ( value ) => {
120+ params . layoutMode = value ;
121+ } ) ;
122+ }
123+
124+ function createSelectUI ( labelValue , initialValue , choices , paramsUpdateCallback ) {
125+ const select = document . createElement ( "select" ) ;
126+ select . onchange = ( ) => {
127+ paramsUpdateCallback ( select . value ) ;
128+ updateURL ( ) ;
129+ } ;
130+
131+ choices . forEach ( ( choice ) => {
132+ const option = new Option ( choice , choice ) ;
133+ select . add ( option ) ;
134+ } ) ;
135+ select . value = initialValue ;
136+
137+ const label = document . createElement ( "label" ) ;
138+ label . append ( span ( labelValue ) , select ) ;
139+
140+ return label ;
141+ }
142+
110143function createUIForSuites ( ) {
111144 const control = document . createElement ( "nav" ) ;
112145 control . className = "suites" ;
113146 const checkboxes = [ ] ;
114147 const setSuiteEnabled = ( suiteIndex , enabled ) => {
115- Suites [ suiteIndex ] . disabled = ! enabled ;
148+ Suites [ suiteIndex ] . enabled = enabled ;
116149 checkboxes [ suiteIndex ] . checked = enabled ;
117150 } ;
118151
@@ -124,9 +157,9 @@ function createUIForSuites() {
124157 const checkbox = document . createElement ( "input" ) ;
125158 checkbox . id = suite . name ;
126159 checkbox . type = "checkbox" ;
127- checkbox . checked = ! suite . disabled ;
160+ checkbox . checked = suite . enabled ;
128161 checkbox . onchange = ( ) => {
129- suite . disabled = ! checkbox . checked ;
162+ suite . enabled = checkbox . checked ;
130163 updateURL ( ) ;
131164 } ;
132165 checkboxes . push ( checkbox ) ;
@@ -219,12 +252,13 @@ function createSuitesTagsButton(setSuiteEnabled) {
219252
220253function createUIForRun ( ) {
221254 const stepTestButton = document . createElement ( "button" ) ;
222- stepTestButton . textContent = "Step Test \u23EF" ;
255+ stepTestButton . className = "step-button" ;
256+ stepTestButton . innerHTML = "Step Test<span>\u23EF</span>" ;
223257 stepTestButton . onclick = ( event ) => {
224258 globalThis . benchmarkClient . step ( ) ;
225259 } ;
226260 const startTestButton = document . createElement ( "button" ) ;
227- startTestButton . textContent = "Start Test \u23F5" ;
261+ startTestButton . innerHTML = "Start Test<span> \u23F5</span> " ;
228262 startTestButton . onclick = ( event ) => {
229263 globalThis . benchmarkClient . start ( ) ;
230264 } ;
@@ -241,17 +275,17 @@ function updateParamsSuitesAndTags() {
241275
242276 // If less than all suites are selected then change the URL "Suites" GET parameter
243277 // to comma separate only the selected
244- const selectedSuites = Suites . filter ( ( suite ) => ! suite . disabled ) ;
278+ const selectedSuites = Suites . filter ( ( suite ) => suite . enabled ) ;
245279 if ( ! selectedSuites . length )
246280 return ;
247281
248282 // Try finding common tags that would result in the current suite selection.
249283 let commonTags = new Set ( selectedSuites [ 0 ] . tags ) ;
250284 for ( const suite of Suites ) {
251- if ( suite . disabled )
252- suite . tags . forEach ( ( tag ) => commonTags . delete ( tag ) ) ;
253- else
285+ if ( suite . enabled )
254286 commonTags = new Set ( suite . tags . filter ( ( tag ) => commonTags . has ( tag ) ) ) ;
287+ else
288+ suite . tags . forEach ( ( tag ) => commonTags . delete ( tag ) ) ;
255289 }
256290 if ( selectedSuites . length > 1 && commonTags . size )
257291 params . tags = [ ...commonTags ] ;
0 commit comments