use super::*;
#[test]
fn test_new() {
let state = DropdownState::new(vec!["A", "B", "C"]);
assert_eq!(state.options().len(), 3);
assert_eq!(state.selected_index(), None);
assert!(!state.is_open());
assert_eq!(state.filtered_indices.len(), 3);
}
#[test]
fn test_with_selection() {
let state = DropdownState::with_selection(vec!["A", "B", "C"], 1);
assert_eq!(state.selected_index(), Some(1));
assert_eq!(state.selected_value(), Some("B"));
}
#[test]
fn test_with_selection_out_of_bounds() {
let state = DropdownState::with_selection(vec!["A", "B"], 5);
assert_eq!(state.selected_index(), None);
}
#[test]
fn test_default() {
let state = DropdownState::default();
assert_eq!(state.options().len(), 0);
assert_eq!(state.selected_index(), None);
assert_eq!(state.placeholder(), "Search...");
}
#[test]
fn test_filter_text() {
let mut state = DropdownState::new(vec!["A", "B"]);
assert_eq!(state.filter_text(), "");
Dropdown::update(&mut state, DropdownMessage::Insert('x'));
assert_eq!(state.filter_text(), "x");
}
#[test]
fn test_filtered_options() {
let mut state = DropdownState::new(vec!["Apple", "Banana", "Apricot"]);
assert_eq!(state.filtered_options(), vec!["Apple", "Banana", "Apricot"]);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
Dropdown::update(&mut state, DropdownMessage::Insert('p'));
assert_eq!(state.filtered_options(), vec!["Apple", "Apricot"]);
}
#[test]
fn test_is_open() {
let mut state = DropdownState::new(vec!["A", "B"]);
assert!(!state.is_open());
Dropdown::update(&mut state, DropdownMessage::Open);
assert!(state.is_open());
}
#[test]
fn test_set_options_resets_invalid_selection() {
let mut state = DropdownState::with_selection(vec!["A", "B", "C"], 2);
state.set_options(vec!["X", "Y"]);
assert_eq!(state.selected_index(), None);
}
#[test]
fn test_set_selected() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
state.set_selected(Some(1));
assert_eq!(state.selected_index(), Some(1));
assert_eq!(state.selected_value(), Some("B"));
}
#[test]
fn test_set_selected_out_of_bounds() {
let mut state = DropdownState::new(vec!["A", "B"]);
state.set_selected(Some(5));
assert_eq!(state.selected_index(), None);
}
#[test]
fn test_open() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
assert!(state.is_open());
}
#[test]
fn test_close() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Close);
assert!(!state.is_open());
}
#[test]
fn test_toggle() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Toggle);
assert!(state.is_open());
Dropdown::update(&mut state, DropdownMessage::Toggle);
assert!(!state.is_open());
}
#[test]
fn test_open_empty_options() {
let mut state = DropdownState::new(Vec::<String>::new());
Dropdown::update(&mut state, DropdownMessage::Open);
assert!(!state.is_open());
}
#[test]
fn test_close_clears_filter() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
assert_eq!(state.filter_text(), "a");
Dropdown::update(&mut state, DropdownMessage::Close);
assert_eq!(state.filter_text(), "");
}
#[test]
fn test_insert_char() {
let mut state = DropdownState::new(vec!["A", "B"]);
let output = Dropdown::update(&mut state, DropdownMessage::Insert('x'));
assert_eq!(state.filter_text(), "x");
assert_eq!(output, Some(DropdownOutput::FilterChanged("x".to_string())));
}
#[test]
fn test_insert_filters() {
let mut state = DropdownState::new(vec!["Apple", "Banana", "Cherry"]);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
assert_eq!(state.filtered_count(), 2);
assert!(state.filtered_options().contains(&"Apple"));
assert!(state.filtered_options().contains(&"Banana"));
}
#[test]
fn test_backspace() {
let mut state = DropdownState::new(vec!["A", "B"]);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
Dropdown::update(&mut state, DropdownMessage::Insert('b'));
assert_eq!(state.filter_text(), "ab");
let output = Dropdown::update(&mut state, DropdownMessage::Backspace);
assert_eq!(state.filter_text(), "a");
assert_eq!(output, Some(DropdownOutput::FilterChanged("a".to_string())));
}
#[test]
fn test_backspace_empty() {
let mut state = DropdownState::new(vec!["A", "B"]);
let output = Dropdown::update(&mut state, DropdownMessage::Backspace);
assert_eq!(output, None);
}
#[test]
fn test_backspace_refilters() {
let mut state = DropdownState::new(vec!["Apple", "Banana", "Apricot"]);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
Dropdown::update(&mut state, DropdownMessage::Insert('p'));
assert_eq!(state.filtered_count(), 2);
Dropdown::update(&mut state, DropdownMessage::Backspace);
assert_eq!(state.filtered_count(), 3); }
#[test]
fn test_clear_filter() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Insert('x'));
Dropdown::update(&mut state, DropdownMessage::Insert('y'));
let output = Dropdown::update(&mut state, DropdownMessage::ClearFilter);
assert_eq!(state.filter_text(), "");
assert_eq!(output, Some(DropdownOutput::FilterChanged("".to_string())));
}
#[test]
fn test_clear_filter_empty() {
let mut state = DropdownState::new(vec!["A", "B"]);
let output = Dropdown::update(&mut state, DropdownMessage::ClearFilter);
assert_eq!(output, None);
}
#[test]
fn test_set_filter() {
let mut state = DropdownState::new(vec!["Apple", "Banana"]);
let output = Dropdown::update(&mut state, DropdownMessage::SetFilter("app".to_string()));
assert_eq!(state.filter_text(), "app");
assert_eq!(
output,
Some(DropdownOutput::FilterChanged("app".to_string()))
);
assert_eq!(state.filtered_count(), 1);
}
#[test]
fn test_set_filter_same() {
let mut state = DropdownState::new(vec!["A", "B"]);
Dropdown::update(&mut state, DropdownMessage::SetFilter("x".to_string()));
let output = Dropdown::update(&mut state, DropdownMessage::SetFilter("x".to_string()));
assert_eq!(output, None);
}
#[test]
fn test_filter_case_insensitive() {
let mut state = DropdownState::new(vec!["Apple", "BANANA", "cherry"]);
Dropdown::update(&mut state, DropdownMessage::Insert('A'));
assert_eq!(state.filtered_count(), 2);
assert!(state.filtered_options().contains(&"Apple"));
assert!(state.filtered_options().contains(&"BANANA"));
}
#[test]
fn test_filter_contains() {
let mut state = DropdownState::new(vec!["Apple", "Pineapple", "Grape"]);
Dropdown::update(&mut state, DropdownMessage::Insert('p'));
Dropdown::update(&mut state, DropdownMessage::Insert('l'));
Dropdown::update(&mut state, DropdownMessage::Insert('e'));
assert_eq!(state.filtered_count(), 2);
}
#[test]
fn test_filter_no_matches() {
let mut state = DropdownState::new(vec!["Apple", "Banana", "Cherry"]);
Dropdown::update(&mut state, DropdownMessage::Insert('x'));
Dropdown::update(&mut state, DropdownMessage::Insert('y'));
Dropdown::update(&mut state, DropdownMessage::Insert('z'));
assert_eq!(state.filtered_count(), 0);
assert!(state.filtered_options().is_empty());
}
#[test]
fn test_filter_resets_highlight() {
let mut state = DropdownState::new(vec!["Apple", "Banana", "Cherry"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Down);
assert_eq!(state.highlighted_index, 1);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
assert_eq!(state.highlighted_index, 0);
}
#[test]
fn test_select_next() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
let output = Dropdown::update(&mut state, DropdownMessage::Down);
assert_eq!(output, Some(DropdownOutput::SelectionChanged(1)));
assert_eq!(state.highlighted_index, 1);
let output = Dropdown::update(&mut state, DropdownMessage::Down);
assert_eq!(output, Some(DropdownOutput::SelectionChanged(2)));
assert_eq!(state.highlighted_index, 2);
}
#[test]
fn test_select_previous() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Down);
Dropdown::update(&mut state, DropdownMessage::Down);
assert_eq!(state.highlighted_index, 2);
let output = Dropdown::update(&mut state, DropdownMessage::Up);
assert_eq!(output, Some(DropdownOutput::SelectionChanged(1)));
assert_eq!(state.highlighted_index, 1);
let output = Dropdown::update(&mut state, DropdownMessage::Up);
assert_eq!(output, Some(DropdownOutput::SelectionChanged(0)));
assert_eq!(state.highlighted_index, 0);
}
#[test]
fn test_select_next_wraps() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Down);
Dropdown::update(&mut state, DropdownMessage::Down);
let output = Dropdown::update(&mut state, DropdownMessage::Down);
assert_eq!(output, Some(DropdownOutput::SelectionChanged(0)));
assert_eq!(state.highlighted_index, 0); }
#[test]
fn test_select_previous_wraps() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
let output = Dropdown::update(&mut state, DropdownMessage::Up);
assert_eq!(output, Some(DropdownOutput::SelectionChanged(2)));
assert_eq!(state.highlighted_index, 2); }
#[test]
fn test_navigation_empty_filter() {
let mut state = DropdownState::new(vec!["Apple", "Banana"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::SetFilter("xyz".to_string()));
Dropdown::update(&mut state, DropdownMessage::Down);
assert_eq!(state.highlighted_index, 0);
}
#[test]
fn test_navigation_when_closed() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Down);
assert_eq!(state.highlighted_index, 0);
}
#[test]
fn test_confirm() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Down);
Dropdown::update(&mut state, DropdownMessage::Confirm);
assert_eq!(state.selected_index(), Some(1));
assert!(!state.is_open());
}
#[test]
fn test_confirm_returns_selected() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Down);
let output = Dropdown::update(&mut state, DropdownMessage::Confirm);
assert_eq!(output, Some(DropdownOutput::Selected("B".to_string())));
}
#[test]
fn test_confirm_returns_submitted() {
let mut state = DropdownState::with_selection(vec!["A", "B", "C"], 1);
Dropdown::update(&mut state, DropdownMessage::Open);
let output = Dropdown::update(&mut state, DropdownMessage::Confirm);
assert_eq!(output, Some(DropdownOutput::Submitted(1)));
}
#[test]
fn test_confirm_when_closed() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
let output = Dropdown::update(&mut state, DropdownMessage::Confirm);
assert_eq!(output, None);
}
#[test]
fn test_confirm_no_matches() {
let mut state = DropdownState::new(vec!["Apple", "Banana"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::SetFilter("xyz".to_string()));
let output = Dropdown::update(&mut state, DropdownMessage::Confirm);
assert_eq!(output, None);
}
#[test]
fn test_confirm_clears_filter() {
let mut state = DropdownState::new(vec!["Apple", "Banana"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
assert_eq!(state.filter_text(), "a");
Dropdown::update(&mut state, DropdownMessage::Confirm);
assert_eq!(state.filter_text(), "");
}
#[test]
fn test_confirm_with_filter() {
let mut state = DropdownState::new(vec!["Apple", "Banana", "Cherry"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
Dropdown::update(&mut state, DropdownMessage::Down);
let output = Dropdown::update(&mut state, DropdownMessage::Confirm);
assert_eq!(output, Some(DropdownOutput::Selected("Banana".to_string())));
assert_eq!(state.selected_value(), Some("Banana"));
}
#[test]
fn test_view_closed_empty() {
let state = DropdownState::new(vec!["Apple", "Banana"]);
let (mut terminal, theme) = crate::component::test_utils::setup_render(30, 10);
terminal
.draw(|frame| {
Dropdown::view(&state, &mut RenderContext::new(frame, frame.area(), &theme));
})
.unwrap();
insta::assert_snapshot!(terminal.backend().to_string());
}
#[test]
fn test_view_closed_with_selection() {
let state = DropdownState::with_selection(vec!["Apple", "Banana"], 0);
let (mut terminal, theme) = crate::component::test_utils::setup_render(30, 10);
terminal
.draw(|frame| {
Dropdown::view(&state, &mut RenderContext::new(frame, frame.area(), &theme));
})
.unwrap();
insta::assert_snapshot!(terminal.backend().to_string());
}
#[test]
fn test_view_open_no_filter() {
let mut state = DropdownState::new(vec!["Apple", "Banana", "Cherry"]);
Dropdown::update(&mut state, DropdownMessage::Open);
let (mut terminal, theme) = crate::component::test_utils::setup_render(30, 15);
terminal
.draw(|frame| {
Dropdown::view(&state, &mut RenderContext::new(frame, frame.area(), &theme));
})
.unwrap();
insta::assert_snapshot!(terminal.backend().to_string());
}
#[test]
fn test_view_open_with_filter() {
let mut state = DropdownState::new(vec!["Apple", "Banana", "Cherry"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
let (mut terminal, theme) = crate::component::test_utils::setup_render(30, 15);
terminal
.draw(|frame| {
Dropdown::view(&state, &mut RenderContext::new(frame, frame.area(), &theme));
})
.unwrap();
insta::assert_snapshot!(terminal.backend().to_string());
}
#[test]
fn test_view_highlight() {
let mut state = DropdownState::new(vec!["Apple", "Banana", "Cherry"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Down);
let (mut terminal, theme) = crate::component::test_utils::setup_render(30, 15);
terminal
.draw(|frame| {
Dropdown::view(&state, &mut RenderContext::new(frame, frame.area(), &theme));
})
.unwrap();
insta::assert_snapshot!(terminal.backend().to_string());
}
#[test]
fn test_view_no_matches() {
let mut state = DropdownState::new(vec!["Apple", "Banana"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::SetFilter("xyz".to_string()));
let (mut terminal, theme) = crate::component::test_utils::setup_render(30, 15);
terminal
.draw(|frame| {
Dropdown::view(&state, &mut RenderContext::new(frame, frame.area(), &theme));
})
.unwrap();
insta::assert_snapshot!(terminal.backend().to_string());
}
#[test]
fn test_view_focused() {
let state = DropdownState::new(vec!["A", "B"]);
let (mut terminal, theme) = crate::component::test_utils::setup_render(30, 10);
terminal
.draw(|frame| {
Dropdown::view(&state, &mut RenderContext::new(frame, frame.area(), &theme));
})
.unwrap();
insta::assert_snapshot!(terminal.backend().to_string());
}
#[test]
fn test_init() {
let state = Dropdown::init();
assert_eq!(state.options().len(), 0);
}
#[test]
fn test_full_workflow() {
let mut state = DropdownState::new(vec!["Apple", "Apricot", "Banana", "Cherry"]);
Dropdown::update(&mut state, DropdownMessage::Open);
assert!(state.is_open());
assert_eq!(state.filtered_count(), 4);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
assert_eq!(state.filtered_count(), 3);
Dropdown::update(&mut state, DropdownMessage::Insert('p'));
assert_eq!(state.filtered_count(), 2);
Dropdown::update(&mut state, DropdownMessage::Down);
assert_eq!(state.highlighted_index, 1);
let output = Dropdown::update(&mut state, DropdownMessage::Confirm);
assert_eq!(
output,
Some(DropdownOutput::Selected("Apricot".to_string()))
);
assert_eq!(state.selected_value(), Some("Apricot"));
assert!(!state.is_open());
assert_eq!(state.filter_text(), ""); }
#[test]
fn test_auto_open_on_type() {
let mut state = DropdownState::new(vec!["Apple", "Banana"]);
assert!(!state.is_open());
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
assert!(state.is_open());
}
#[test]
fn test_filtered_count() {
let mut state = DropdownState::new(vec!["Apple", "Apricot", "Banana"]);
assert_eq!(state.filtered_count(), 3);
Dropdown::update(&mut state, DropdownMessage::Insert('a'));
Dropdown::update(&mut state, DropdownMessage::Insert('p'));
assert_eq!(state.filtered_count(), 2);
}
#[test]
fn test_large_dropdown_navigation() {
let options: Vec<String> = (0..100).map(|i| format!("Option {}", i)).collect();
let mut state = DropdownState::new(options);
Dropdown::update(&mut state, DropdownMessage::Open);
for _ in 0..50 {
Dropdown::update(&mut state, DropdownMessage::Down);
}
assert_eq!(state.highlighted_index, 50);
for _ in 0..50 {
Dropdown::update(&mut state, DropdownMessage::Down);
}
assert_eq!(state.highlighted_index, 0);
Dropdown::update(&mut state, DropdownMessage::Up);
assert_eq!(state.highlighted_index, 99);
}
use crate::input::{Event, Key};
#[test]
fn test_handle_event_toggle_when_closed() {
let state = DropdownState::new(vec!["A", "B", "C"]);
let msg = Dropdown::handle_event(
&state,
&Event::key(Key::Enter),
&EventContext::new().focused(true),
);
assert_eq!(msg, Some(DropdownMessage::Toggle));
}
#[test]
fn test_handle_event_confirm_when_open() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
let msg = Dropdown::handle_event(
&state,
&Event::key(Key::Enter),
&EventContext::new().focused(true),
);
assert_eq!(msg, Some(DropdownMessage::Confirm));
}
#[test]
fn test_handle_event_close_when_open() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
let msg = Dropdown::handle_event(
&state,
&Event::key(Key::Esc),
&EventContext::new().focused(true),
);
assert_eq!(msg, Some(DropdownMessage::Close));
}
#[test]
fn test_handle_event_up_when_open() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
let msg = Dropdown::handle_event(
&state,
&Event::key(Key::Up),
&EventContext::new().focused(true),
);
assert_eq!(msg, Some(DropdownMessage::Up));
}
#[test]
fn test_handle_event_down_when_open() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
let msg = Dropdown::handle_event(
&state,
&Event::key(Key::Down),
&EventContext::new().focused(true),
);
assert_eq!(msg, Some(DropdownMessage::Down));
}
#[test]
fn test_handle_event_char_when_open() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
let msg = Dropdown::handle_event(
&state,
&Event::char('a'),
&EventContext::new().focused(true),
);
assert_eq!(msg, Some(DropdownMessage::Insert('a')));
}
#[test]
fn test_handle_event_backspace_when_open() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
let msg = Dropdown::handle_event(
&state,
&Event::key(Key::Backspace),
&EventContext::new().focused(true),
);
assert_eq!(msg, Some(DropdownMessage::Backspace));
}
#[test]
fn test_handle_event_ignored_when_unfocused() {
let state = DropdownState::new(vec!["A", "B", "C"]);
let msg = Dropdown::handle_event(&state, &Event::key(Key::Enter), &EventContext::default());
assert_eq!(msg, None);
}
#[test]
fn test_handle_event_ignored_when_disabled() {
let state = DropdownState::new(vec!["A", "B", "C"]);
let msg = Dropdown::handle_event(
&state,
&Event::key(Key::Enter),
&EventContext::new().focused(true).disabled(true),
);
assert_eq!(msg, None);
}
#[test]
fn test_dispatch_event() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
Dropdown::update(&mut state, DropdownMessage::Open);
Dropdown::update(&mut state, DropdownMessage::Down);
let output = Dropdown::dispatch_event(
&mut state,
&Event::key(Key::Enter),
&EventContext::new().focused(true),
);
assert_eq!(output, Some(DropdownOutput::Selected("B".to_string())));
assert!(!state.is_open());
}
#[test]
fn test_instance_update() {
let mut state = DropdownState::new(vec!["A", "B", "C"]);
let output = state.update(DropdownMessage::Toggle);
assert!(output.is_none()); assert!(state.is_open());
}
#[test]
fn test_selected_item() {
let state = DropdownState::with_selection(vec!["A", "B", "C"], 1);
assert_eq!(state.selected_item(), Some("B"));
assert_eq!(state.selected_item(), state.selected_value());
}
#[test]
fn test_selected_item_none() {
let state = DropdownState::new(vec!["A", "B"]);
assert_eq!(state.selected_item(), None);
}
#[test]
fn test_with_placeholder() {
let state = DropdownState::new(vec!["A", "B", "C"]).with_placeholder("Pick one...");
assert_eq!(state.placeholder(), "Pick one...");
}
#[test]
fn test_with_placeholder_chained() {
let state = DropdownState::new(vec!["A", "B", "C"]).with_placeholder("Pick one...");
assert_eq!(state.placeholder(), "Pick one...");
}
#[test]
fn test_annotation_emitted() {
use crate::annotation::{WidgetType, with_annotations};
let state = DropdownState::new(vec!["A".to_string(), "B".to_string()]);
let (mut terminal, theme) = crate::component::test_utils::setup_render(30, 10);
let registry = with_annotations(|| {
terminal
.draw(|frame| {
Dropdown::view(&state, &mut RenderContext::new(frame, frame.area(), &theme));
})
.unwrap();
});
assert_eq!(registry.len(), 1);
let regions = registry.find_by_type(&WidgetType::Dropdown);
assert_eq!(regions.len(), 1);
assert_eq!(regions[0].annotation.expanded, Some(false));
}