audit popover and dialog
This commit is contained in:
@@ -45,6 +45,7 @@ impl Render for Harness {
|
||||
})
|
||||
.trigger(|_, _| {
|
||||
div()
|
||||
.debug_selector(|| "popover-trigger".to_string())
|
||||
.w(px(100.))
|
||||
.h(px(32.))
|
||||
.bg(rgba(0x000000ff))
|
||||
@@ -188,3 +189,26 @@ fn clicking_another_control_dismisses_and_reaches_it() {
|
||||
assert_eq!(*changes.borrow(), vec![false]);
|
||||
assert_eq!(*clicks.borrow(), 1);
|
||||
}
|
||||
|
||||
/// The panel hangs one spacing unit below the trigger: the anchor gap is
|
||||
/// theme-owned, and rides the anchored element so the window-edge clamp
|
||||
/// stays intact.
|
||||
#[test]
|
||||
fn the_panel_hangs_one_spacing_unit_below_the_trigger() {
|
||||
let (cx, mut visual, _window, _changes, _clicks) = popover_window(true);
|
||||
|
||||
let trigger = visual
|
||||
.debug_bounds("popover-trigger")
|
||||
.expect("trigger rendered");
|
||||
let panel = visual
|
||||
.debug_bounds("popover-panel")
|
||||
.expect("panel rendered");
|
||||
|
||||
let expected = cx.update(|cx| Theme::global(cx).spacing.unit);
|
||||
let gap = panel.top() - trigger.bottom();
|
||||
// Painted bounds are snapped to device pixels; allow half a pixel.
|
||||
assert!(
|
||||
(gap - expected).abs() <= px(0.5),
|
||||
"the anchor gap is {gap:?}, expected {expected:?}"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user