-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Handle reordedering of keyed children (#1015)
* fix: Handle reoderdering of keyed children * fmt * comment out some compositor tests * feat: Add invalidation reasons in torin * adapt tests * test reordering of nodes in torin * test reordering of nodes in freya-core * update
- Loading branch information
Showing
8 changed files
with
278 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use freya::prelude::*; | ||
use freya_testing::prelude::*; | ||
|
||
#[tokio::test] | ||
pub async fn nodes_reorder() { | ||
fn nodes_reorder() -> Element { | ||
let mut data = use_signal(|| vec![1, 2, 3]); | ||
|
||
rsx!( | ||
rect { | ||
onclick: move |_| { | ||
let item = data.write().remove(0); | ||
data.write().push(item); | ||
}, | ||
label { | ||
"Move" | ||
} | ||
} | ||
for d in data.read().iter() { | ||
label { | ||
key: "{d}", | ||
height: "20", | ||
"{d}" | ||
} | ||
} | ||
) | ||
} | ||
|
||
let mut utils = launch_test(nodes_reorder); | ||
utils.wait_for_update().await; | ||
|
||
assert_eq!(utils.root().get(1).get(0).text(), Some("1")); | ||
assert_eq!(utils.root().get(2).get(0).text(), Some("2")); | ||
assert_eq!(utils.root().get(3).get(0).text(), Some("3")); | ||
|
||
utils.click_cursor((5., 5.)).await; | ||
|
||
assert_eq!(utils.root().get(1).get(0).text(), Some("2")); | ||
assert_eq!(utils.root().get(2).get(0).text(), Some("3")); | ||
assert_eq!(utils.root().get(3).get(0).text(), Some("1")); | ||
|
||
utils.click_cursor((5., 5.)).await; | ||
|
||
assert_eq!(utils.root().get(1).get(0).text(), Some("3")); | ||
assert_eq!(utils.root().get(2).get(0).text(), Some("1")); | ||
assert_eq!(utils.root().get(3).get(0).text(), Some("2")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.