@@ -260,6 +260,62 @@ const testBehavior = (suggest: boolean, strict?: boolean) => {
260260 ) ;
261261 } ) ;
262262
263+ // TODO: This test should also be executed with keyboard interactions to
264+ // change the active descendant and verify that the input's value is not
265+ // updated
266+ it ( "should not update combo-box value with the active descendant when closing with click outside" , async ( ) => {
267+ // Set value 3
268+ await comboBoxRef . setProperty ( "model" , simpleModelComboBox1 ) ;
269+ await page . waitForChanges ( ) ;
270+ await comboBoxRef . setProperty ( "value" , "Value 3" ) ;
271+ await page . waitForChanges ( ) ;
272+
273+ // Open the combo-box
274+ await page . click ( "ch-combo-box-render" ) ;
275+ await page . waitForChanges ( ) ;
276+
277+ const inputRef = await page . find ( "ch-combo-box-render >>> input" ) ;
278+ expect ( await inputRef . getProperty ( "value" ) ) . toBe (
279+ suggest ? "Value 3" : "Label for the value 3"
280+ ) ;
281+
282+ // Hover the first value
283+ await page . hover ( "ch-combo-box-render >>> ch-popover button" ) ;
284+ await page . waitForChanges ( ) ;
285+
286+ await page . click ( "form" ) ;
287+ await page . waitForChanges ( ) ;
288+ expect ( await comboBoxRef . getProperty ( "value" ) ) . toBe ( "Value 3" ) ;
289+ } ) ;
290+
291+ // TODO: This test should also be executed with keyboard interactions to
292+ // change the active descendant and verify that the input's value is not
293+ // updated
294+ it ( "should not update combo-box value with the active descendant when closing with the Escape key" , async ( ) => {
295+ // Set value 3
296+ await comboBoxRef . setProperty ( "model" , simpleModelComboBox1 ) ;
297+ await page . waitForChanges ( ) ;
298+ await comboBoxRef . setProperty ( "value" , "Value 3" ) ;
299+ await page . waitForChanges ( ) ;
300+
301+ // Open the combo-box
302+ await page . click ( "ch-combo-box-render" ) ;
303+ await page . waitForChanges ( ) ;
304+
305+ const inputRef = await page . find ( "ch-combo-box-render >>> input" ) ;
306+ expect ( await inputRef . getProperty ( "value" ) ) . toBe (
307+ suggest ? "Value 3" : "Label for the value 3"
308+ ) ;
309+
310+ // Hover the first value
311+ await page . hover ( "ch-combo-box-render >>> ch-popover button" ) ;
312+ await page . waitForChanges ( ) ;
313+
314+ await comboBoxRef . press ( "Escape" ) ;
315+ await page . waitForChanges ( ) ;
316+ expect ( await comboBoxRef . getProperty ( "value" ) ) . toBe ( "Value 3" ) ;
317+ } ) ;
318+
263319 it . skip ( "should destroy the items after the popover is closed (by clicking outside of the combo-box)" , async ( ) => {
264320 await comboBoxRef . setProperty ( "model" , simpleModelComboBox1 ) ;
265321 await page . waitForChanges ( ) ;
0 commit comments