perf: retain precise name observations in property binding caches
This commit is contained in:
@@ -6175,6 +6175,37 @@ returned = button.dispatch(dispatched)"#,
|
||||
assert!(!session.is_faulted());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn property_bindings_use_precise_names_and_repair_direct_output_changes() {
|
||||
let (mut session, _) = ReplSession::load(
|
||||
r#"
|
||||
size = 80
|
||||
function readWidth(): Number { return size }
|
||||
rect = RectBlock(1,20)
|
||||
hidden = RectBlock(1,20)
|
||||
rect.bind("width",readWidth)
|
||||
hidden.bind("width",readWidth)
|
||||
page = Page()
|
||||
page.render(rect)
|
||||
"#, "app.main", 903, 1,
|
||||
).unwrap();
|
||||
let count = |session: &mut ReplSession| {
|
||||
session.execute("ui.stats().bindingEvaluations", "app.main").unwrap().value
|
||||
.parse::<usize>().unwrap()
|
||||
};
|
||||
let baseline = count(&mut session);
|
||||
assert_eq!(baseline, 2);
|
||||
assert!(session.execute("42", "app.main").unwrap().document.is_none());
|
||||
assert_eq!(count(&mut session), baseline);
|
||||
session.execute("size = 120", "app.main").unwrap();
|
||||
assert_eq!(count(&mut session), baseline + 2);
|
||||
assert_eq!(session.execute("hidden.width", "app.main").unwrap().value, "120");
|
||||
session.execute("rect.width = 200", "app.main").unwrap();
|
||||
assert_eq!(count(&mut session), baseline + 3);
|
||||
assert_eq!(session.execute("rect.width", "app.main").unwrap().value, "120");
|
||||
assert_eq!(count(&mut session), baseline + 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn source_render_caches_do_not_root_a_page_block_waiting_frame_cycle() {
|
||||
let (mut session, _) = ReplSession::load(
|
||||
|
||||
Reference in New Issue
Block a user