mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 14:49:06 -04:00
Improve accessibility and testability of ComboBox (#7658)
Changed it to use labeled_by to avoid kittest finding the label when searching for the ComboBox and also set the value so a screen reader will know what's selected.
This commit is contained in:
@@ -61,3 +61,17 @@ fn text_edit_rtl() {
|
||||
harness.snapshot(format!("text_edit_rtl_{i}"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn combobox_should_have_value() {
|
||||
let harness = Harness::new_ui(|ui| {
|
||||
egui::ComboBox::from_label("Select an option")
|
||||
.selected_text("Option 1")
|
||||
.show_ui(ui, |_ui| {});
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
harness.get_by_label("Select an option").value().as_deref(),
|
||||
Some("Option 1")
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user