@@ -70,6 +70,9 @@ export enum TheiaPreferenceScope {
7070export class TheiaPreferenceView extends TheiaView {
7171 public customTimeout ?: number ;
7272 protected modificationIndicator = '.theia-mod-item-modified' ;
73+ protected optionSelectLabel = '.theia-select-component-label' ;
74+ protected optionSelectDropdown = '.theia-select-component-dropdown' ;
75+ protected optionSelectDropdownValue = '.theia-select-component-option-value' ;
7376
7477 constructor ( app : TheiaApp ) {
7578 super ( TheiaSettingsViewData , app ) ;
@@ -138,12 +141,8 @@ export class TheiaPreferenceView extends TheiaView {
138141 }
139142
140143 async getOptionsPreferenceById ( preferenceId : string ) : Promise < string > {
141- const element = await this . findPreferenceEditorById ( preferenceId , 'select' ) ;
142- return element . evaluate ( e => {
143- const selectElement = ( e as HTMLSelectElement ) ;
144- const option = selectElement . options [ selectElement . selectedIndex ] ;
145- return option . text ;
146- } ) ;
144+ const element = await this . findPreferenceEditorById ( preferenceId , this . optionSelectLabel ) ;
145+ return element . evaluate ( e => e . textContent ?? '' ) ;
147146 }
148147
149148 async setOptionsPreferenceByPath ( sectionTitle : string , name : string , value : string ) : Promise < void > {
@@ -152,8 +151,10 @@ export class TheiaPreferenceView extends TheiaView {
152151 }
153152
154153 async setOptionsPreferenceById ( preferenceId : string , value : string ) : Promise < void > {
155- const element = await this . findPreferenceEditorById ( preferenceId , 'select' ) ;
156- await element . selectOption ( { label : value } ) ;
154+ const element = await this . findPreferenceEditorById ( preferenceId , this . optionSelectLabel ) ;
155+ await element . click ( ) ;
156+ const option = await this . page . waitForSelector ( `${ this . optionSelectDropdown } ${ this . optionSelectDropdownValue } :has-text("${ value } ")` ) ;
157+ await option . click ( ) ;
157158 }
158159
159160 async resetPreferenceByPath ( sectionTitle : string , name : string ) : Promise < void > {
0 commit comments