Skip to content

Commit 792bf86

Browse files
Fix scrollbars visual test
1 parent 4830b1b commit 792bf86

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

packages/leptos/tests/visual/src/spec/hide.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ pub fn Hide() -> impl IntoView {
9696
move || hide_data().map_or(false, |data| data.reference_hidden.unwrap_or(false));
9797
let escaped = move || hide_data().map_or(false, |data| data.escaped.unwrap_or(false));
9898

99-
// let hierarchy_update = update.clone();
100-
10199
let UseScrollReturn {
102100
scroll_ref,
103101
indicator,
@@ -339,6 +337,7 @@ pub fn Hide() -> impl IntoView {
339337
log::info!("set hierarchy {:?}", local_hierarchy);
340338
set_hierarchy(local_hierarchy);
341339

340+
// Match React test behaviour
342341
if ['j', 'm', 'k', 'l'].contains(&local_hierarchy) {
343342
update_scroll();
344343
}

packages/leptos/tests/visual/src/spec/scrollbars.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ pub fn Scrollbars() -> impl IntoView {
2222
))];
2323

2424
let UseFloatingReturn {
25-
floating_styles,
25+
x,
26+
y,
27+
strategy,
2628
update,
2729
..
2830
} = use_floating(
@@ -50,7 +52,15 @@ pub fn Scrollbars() -> impl IntoView {
5052
<div _ref=reference_ref class="reference">
5153
Reference
5254
</div>
53-
<div _ref=floating_ref class="floating" style=move || format!("{} width: {}px; height: {}px;", String::from(floating_styles()), size(), size())>
55+
<div
56+
_ref=floating_ref
57+
class="floating"
58+
style:position=move || format!("{:?}", strategy()).to_lowercase()
59+
style:top=move || format!("{}px", y())
60+
style:left=move || format!("{}px", x())
61+
style:width=move || format!("{}px", size())
62+
style:height=move || format!("{}px", size())
63+
>
5464
Floating
5565
</div>
5666
</div>

0 commit comments

Comments
 (0)