Address review: prove the Riot notice is reachable, fix the top being cut off, move docs (#146)

The test now scrolls the settings down and checks the notice ends inside the
window and the title starts inside it. Doing so showed the my_auto centring
pushed the overflowing column's top out of the scroll range; a min-height
wrapper centres it instead. The notice sentence moves to its own doc section
and mentions the first-launch key screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nessarandClaude Opus 5.5 committed 2026-11-27 16:22:04 +01:00
1 parent dd8af3f9e7
commit bb6ab65559
4 files changed
+70 -43

No files matched your search

+42 -40
View File
@@ -414,46 +414,48 @@ impl Render for KeyForm {
.label("Retour")
.on_click(cx.listener(|_, _, _, cx| cx.emit(KeyEvent::Back)))
}));
// Scrolls at the window's minimum height; my_auto centres it while it fits.
div()
.id("settings")
.size_full()
.overflow_y_scroll()
.flex()
.justify_center()
.child(
div()
.v_flex()
.my_auto()
.w(px(520.))
.max_w_full()
.px_4()
.gap_3()
.child(
div()
.text_xl()
.font_weight(FontWeight::SEMIBOLD)
.child(title),
)
.children((!self.first_launch).then(|| self.preferences(cx)))
.children((!self.first_launch).then(|| self.accounts_section(cx)))
.child(div().text_color(muted).child(explanation))
.child(Input::new(&self.input).mask_toggle())
.children(
self.error
.clone()
.map(|error| div().text_color(danger).child(error)),
)
.child(buttons)
.child(
div()
.id("riot-notice")
.text_xs()
.text_color(muted)
.debug_selector(|| "riot-notice".into())
.child(crate::text::RIOT_NOTICE),
),
)
// Scrolls at the window's minimum height; the wrapper is at least as tall as the window and
// centres the column while it fits (an auto margin would also push the top out of reach).
div().id("settings").size_full().overflow_y_scroll().child(
div()
.min_h_full()
.flex()
.justify_center()
.items_center()
.child(
div()
.v_flex()
.w(px(520.))
.max_w_full()
.px_4()
.gap_3()
.child(
div()
.text_xl()
.font_weight(FontWeight::SEMIBOLD)
.debug_selector(|| "settings-title".into())
.child(title),
)
.children((!self.first_launch).then(|| self.preferences(cx)))
.children((!self.first_launch).then(|| self.accounts_section(cx)))
.child(div().text_color(muted).child(explanation))
.child(Input::new(&self.input).mask_toggle())
.children(
self.error
.clone()
.map(|error| div().text_color(danger).child(error)),
)
.child(buttons)
.child(
div()
.id("riot-notice")
.text_xs()
.text_color(muted)
.debug_selector(|| "riot-notice".into())
.child(crate::text::RIOT_NOTICE),
),
),
)
}
}
+18 -1
View File
@@ -2,7 +2,10 @@ use std::sync::Arc;
use arena_tracker_core::{Config, Preferences, RiotApi, ThemePreference, Tracker, UpdateChannel};
use gpui_kit::component::ThemeMode;
use gpui_kit::{AppContext as _, TestAppContext, VisualTestContext, WindowOptions};
use gpui_kit::{
AppContext as _, ScrollDelta, ScrollEvent, TestAppContext, VisualTestContext, WindowOptions,
point, px,
};
use super::{KeyForm, KeyStore, theme_mode};
use crate::logon::tests::Scratch;
@@ -218,8 +221,22 @@ fn the_riot_notice_is_drawn_inside_the_window_at_its_minimum_size(cx: &mut TestA
let cx = &mut VisualTestContext::from_window(window, cx);
cx.simulate_resize(MIN_WINDOW_SIZE);
cx.update(|window, cx| window.draw(cx).clear(cx));
// Debug bounds are recorded even for clipped elements: the title must start on screen, and
// after scrolling down the notice must end on screen.
let title = cx
.debug_bounds("settings-title")
.expect("the title is drawn");
assert!(title.top() >= px(0.), "{title:?}");
cx.simulate_event(ScrollEvent {
position: point(px(100.), px(100.)),
delta: ScrollDelta::Pixels(point(px(0.), px(-2000.))),
..Default::default()
});
cx.update(|window, cx| window.draw(cx).clear(cx));
let notice = cx.debug_bounds("riot-notice").expect("the notice is drawn");
assert!(notice.right() <= MIN_WINDOW_SIZE.width, "{notice:?}");
assert!(notice.top() >= px(0.), "{notice:?}");
assert!(notice.bottom() <= MIN_WINDOW_SIZE.height, "{notice:?}");
}
#[test]