chore: audit all components (#2)
Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
@@ -54,32 +54,6 @@ fn alert_window(
|
||||
)
|
||||
}
|
||||
|
||||
/// A banner with only a message paints, so the title stays optional.
|
||||
#[test]
|
||||
fn a_message_only_alert_renders() {
|
||||
let mut cx = TestAppContext::single();
|
||||
cx.update(Theme::init);
|
||||
let window = cx.add_window(|_, _| MessageOnlyHarness);
|
||||
let window = window.into();
|
||||
let mut cx = VisualTestContext::from_window(window, &cx);
|
||||
cx.update(|window, cx| {
|
||||
window.draw(cx).clear(cx);
|
||||
});
|
||||
assert!(cx.debug_bounds("message-only-alert").is_some());
|
||||
}
|
||||
|
||||
struct MessageOnlyHarness;
|
||||
|
||||
impl Render for MessageOnlyHarness {
|
||||
fn render(&mut self, _window: &mut Window, _cx: &mut gpui::Context<Self>) -> impl IntoElement {
|
||||
div().size_full().p_4().child(
|
||||
div()
|
||||
.debug_selector(|| "message-only-alert".to_string())
|
||||
.child(Alert::new("message-only").message("Only line.")),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Clicking the close button is how the user acts on the alert; the banner
|
||||
/// reports the intent instead of hiding itself.
|
||||
#[test]
|
||||
@@ -94,20 +68,3 @@ fn closing_the_alert_reports_dismissal() {
|
||||
|
||||
assert!(*dismissed.borrow(), "the close button reported dismissal");
|
||||
}
|
||||
|
||||
/// Every severity paints a banner.
|
||||
#[test]
|
||||
fn every_severity_renders_a_banner() {
|
||||
for severity in [
|
||||
AlertSeverity::Info,
|
||||
AlertSeverity::Success,
|
||||
AlertSeverity::Warning,
|
||||
AlertSeverity::Danger,
|
||||
] {
|
||||
let (mut cx, _window, _dismissed) = alert_window(severity);
|
||||
assert!(
|
||||
cx.debug_bounds("test-alert").is_some(),
|
||||
"{severity:?} alert rendered"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user