Identified issue with bidi binding that is causing the
This commit is contained in:
parent
56f700914f
commit
21a42ceb5e
|
@ -39,7 +39,7 @@
|
|||
# Config
|
||||
|
||||
* Test reset.
|
||||
- Not working, see `config.rs/fallback_reset`.
|
||||
- Not working, see `fallback_reset` and `binding_bidi_set_both`.
|
||||
- FallbackConfig loses connection with sources?
|
||||
- No amount of updates gets the value, so probably.
|
||||
- Sometimes the test works, but due to the fallback loading faster.
|
||||
|
|
|
@ -390,7 +390,6 @@ fn fallback_reset() {
|
|||
if status != ConfigStatus::Loaded {
|
||||
panic!("{status}");
|
||||
}
|
||||
|
||||
assert_eq!("fallback", key.get());
|
||||
}
|
||||
|
||||
|
|
|
@ -1423,6 +1423,7 @@ pub trait Var<T: VarValue>: IntoVar<T, Var = Self> + AnyVar + Clone {
|
|||
let (_, ots_id) = last_update.load(Relaxed);
|
||||
if update_id != ots_id {
|
||||
// other_to_self did not cause this assign, propagate.
|
||||
last_update.store((update_id, ots_id), Relaxed);
|
||||
if let Some(value) = map(value) {
|
||||
let _ = other.set(value);
|
||||
}
|
||||
|
|
|
@ -415,6 +415,33 @@ mod bindings {
|
|||
assert_eq!(1, a.strong_count());
|
||||
assert_eq!(1, b.strong_count());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn binding_bidi_set_both() {
|
||||
let mut app = App::minimal().run_headless(false);
|
||||
{
|
||||
// behavior of double assign in same update cycle
|
||||
let a = var(1);
|
||||
a.set(10);
|
||||
a.set(20);
|
||||
|
||||
app.update(false).assert_wait();
|
||||
|
||||
assert_eq!(20, a.get());
|
||||
}
|
||||
|
||||
let a = var(1);
|
||||
let b = var(1);
|
||||
|
||||
a.bind_bidi(&b);
|
||||
|
||||
a.set(10);
|
||||
b.set(20);
|
||||
app.update(false).assert_wait();
|
||||
|
||||
assert_eq!(20, a.get());
|
||||
assert_eq!(20, b.get());
|
||||
}
|
||||
}
|
||||
|
||||
mod context {
|
||||
|
|
Loading…
Reference in New Issue