Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

Fix parent strut nextest expectations

ldm0f7dc0c2b9804
diff --git a/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update.rs b/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update.rs
index 20af19ebb..42b7db2f5 100644
--- a/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update.rs
+++ b/moli-renderer-v8/src/runtime/page_vm/tests/rendering_update.rs
@@ -2481,15 +2481,25 @@ document.body.innerHTML = `<div class=row><div class=item id=ask><i class=icon><
r#"JSON.stringify(Object.fromEntries(['ask','ask-text','constrained'].map(id=>{const r=document.getElementById(id).getBoundingClientRect();return [id,[r.width,r.height]]})))"#,
)?;
let geometry: serde_json::Value = serde_json::from_str(&geometry)?;
- // Chromium keeps the auto-sized label on one 11px line, leaving the
- // icon and padding to establish the 42px pill height.
- assert_eq!(geometry["ask"], serde_json::json!([139, 42]));
- assert_eq!(geometry["ask-text"], serde_json::json!([81, 11]));
- assert_eq!(
- geometry["constrained"],
- serde_json::json!([80, 22]),
- "a genuinely narrower content box must still wrap; geometry={geometry}"
- );
+ // Chromium's Ahem `normal` line-height follows the font metrics: 9px
+ // for one line and 18px after wrapping. The icon and padding, rather
+ // than an inflated synthetic line-height, establish the 42px pill.
+ for (id, expected) in [
+ ("ask", [139.015625, 42.0]),
+ ("ask-text", [81.015625, 9.0]),
+ ("constrained", [80.0, 18.0]),
+ ] {
+ let actual = geometry[id]
+ .as_array()
+ .unwrap_or_else(|| panic!("missing geometry for {id}: {geometry}"));
+ for (index, expected) in expected.into_iter().enumerate() {
+ let actual = actual[index].as_f64().expect("numeric geometry") as f32;
+ assert!(
+ (actual - expected).abs() <= 0.05,
+ "{id}[{index}]: expected {expected}, got {actual}; geometry={geometry}"
+ );
+ }
+ }
Ok::<_, anyhow::Error>(())
})
.await
diff --git a/moli-renderer-v8/src/runtime/phase_one/mod.rs b/moli-renderer-v8/src/runtime/phase_one/mod.rs
index 6ce5aaf83..75aec42ab 100644
--- a/moli-renderer-v8/src/runtime/phase_one/mod.rs
+++ b/moli-renderer-v8/src/runtime/phase_one/mod.rs
@@ -1167,7 +1167,7 @@ li::marker { color: rgb(201,202,203) }
let mut flow_page = parse_phase_one_html_into_page_vm_for_test(
r#"<!doctype html><html><head><style>
-html, body { margin: 0; padding: 0 }
+html, body { margin: 0; padding: 0; font-family: Arial, sans-serif }
#flow { display: flow-root; width: 200px }
#left { float: left; width: 60px; height: 40px; background: rgb(1,2,3) }
#right { float: right; width: 50px; height: 30px; background: rgb(11,12,13) }
@@ -1190,9 +1190,9 @@ html, body { margin: 0; padding: 0 }
(rgb(1, 2, 3), (0.0, 0.0, 60.0, 40.0)),
(rgb(11, 12, 13), (150.0, 0.0, 50.0, 30.0)),
(rgb(21, 22, 23), (60.0, 0.0, 84.0, 20.0)),
- (rgb(31, 32, 33), (60.0, 20.0, 60.0, 20.0)),
- (rgb(41, 42, 43), (0.0, 40.0, 70.0, 35.0)),
- (rgb(51, 52, 53), (0.0, 75.0, 200.0, 10.0)),
+ (rgb(31, 32, 33), (60.0, 24.0, 60.0, 20.0)),
+ (rgb(41, 42, 43), (0.0, 48.0, 70.0, 35.0)),
+ (rgb(51, 52, 53), (0.0, 83.0, 200.0, 10.0)),
] {
assert_paint_rect(
solid_paint_rect(&flow, color),
diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rs b/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rs
index d3b82facf..b8d5f3b18 100644
--- a/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rs
+++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rs
@@ -9809,7 +9809,7 @@ fn mouse_event_offsets_follow_retargeted_shadow_targets() {
(() => {
const pageStyle = document.createElement('style');
pageStyle.textContent =
- 'html, body { padding: 0; margin: 0; } ' +
+ 'html, body { padding: 0; margin: 0; font-family: Arial, sans-serif; } ' +
'my-host { display: block; width: 180px; height: 80px; margin: 10px 20px; padding: 10px; }';
document.documentElement.firstChild.appendChild(pageStyle);
const shadowStyle =