Lib · init_for_tests: theme and key bindings without assets, so apps can render Ely components in tests

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 00:51:52 -04:00
1 parent bcf0378ea7
commit 71bfc93786
1 file changed
+11
+11
View File
@@ -59,6 +59,17 @@ pub fn init(cx: &mut App) {
Err(error) => panic!("ely: asset source failed: {error:#}"),
}
assets::load_fonts(cx).expect("ely: embedded fonts failed to register");
setup(cx);
}
/// `init` without assets or fonts, for app tests that render.
#[cfg(any(test, feature = "test-support"))]
pub fn init_for_tests(cx: &mut App) {
setup(cx);
}
/// The theme and key bindings.
fn setup(cx: &mut App) {
theme::Theme::init(cx);
cx.bind_keys([
KeyBinding::new("tab", FocusNext, None),