Format: the update dialog, toast and feedback tests pass cargo fmt
CI / platforms (windows-latest) (push) Successful in 6m28s
CI / platforms (ubuntu-24.04) (push) Successful in 4m4s
CI / site (push) Successful in 46s
CI / crate (push) Successful in 26m45s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-10 02:30:48 -04:00
1 parent 44a7debfb6
commit 81d0f5f5dd
3 files changed
+24 -5

No files matched your search

+12 -2
View File
@@ -149,9 +149,19 @@ fn the_owner_reads_what_is_shown(cx: &mut TestAppContext) {
push(&view, Toast::new("Denied").severity(Severity::Danger), cx);
let toaster = view.read_with(cx, |desk, _| desk.toaster.clone());
let shown = |cx: &mut VisualTestContext| toaster.read_with(cx, |toaster, _| toaster.shown());
assert_eq!(shown(cx), [("Saved".into(), None), ("Denied".into(), Some(Severity::Danger))]);
assert_eq!(
shown(cx),
[
("Saved".into(), None),
("Denied".into(), Some(Severity::Danger))
]
);
toaster.update(cx, |toaster, cx| toaster.dismiss(first, cx));
assert_eq!(shown(cx), [("Denied".into(), Some(Severity::Danger))], "a leaving toast is not shown");
assert_eq!(
shown(cx),
[("Denied".into(), Some(Severity::Danger))],
"a leaving toast is not shown"
);
}
#[gpui::test]
+3 -1
View File
@@ -128,7 +128,9 @@ impl Toaster {
/// The titles and severities on show, oldest first.
pub fn shown(&self) -> Vec<(SharedString, Option<Severity>)> {
let staying = self.live.iter().filter(|live| !live.leaving);
staying.map(|live| (live.toast.title.clone(), live.toast.severity)).collect()
staying
.map(|live| (live.toast.title.clone(), live.toast.severity))
.collect()
}
/// Sends a toast away: it fades and folds, then leaves the stack.
+9 -2
View File
@@ -124,7 +124,11 @@ impl RenderOnce for UpdateBanner {
UpdateState::Available => text(cx, "update.available", &[("version", version)]),
UpdateState::Downloading(value) => {
let percent = (value * 100.0).round().to_string();
text(cx, "update.downloading", &[("version", version), ("percent", &percent)])
text(
cx,
"update.downloading",
&[("version", version), ("percent", &percent)],
)
}
UpdateState::Ready => text(cx, "update.ready", &[("version", version)]),
};
@@ -220,7 +224,10 @@ impl UpdateDialog {
impl RenderOnce for UpdateDialog {
fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement {
let args = [("name", self.name.as_ref()), ("version", self.version.as_ref())];
let args = [
("name", self.name.as_ref()),
("version", self.version.as_ref()),
];
let headline = match self.state {
UpdateState::Ready => text(cx, "update.headline.ready", &args),
_ => text(cx, "update.headline.available", &args),