fix: state of AppFlowyBoard is wrong after reordering the group

This commit is contained in:
appflowy
2022-10-07 14:42:40 +08:00
parent 73e81da356
commit fa3f9c21fc
14 changed files with 154 additions and 75 deletions

View File

@ -350,6 +350,36 @@ async fn group_move_from_default_group_test() {
#[tokio::test]
async fn group_move_group_test() {
let mut test = GridGroupTest::new().await;
let group_0 = test.group_at_index(0).await;
let group_1 = test.group_at_index(1).await;
let scripts = vec![
MoveGroup {
from_group_index: 0,
to_group_index: 1,
},
AssertGroupRowCount {
group_index: 0,
row_count: 2,
},
AssertGroup {
group_index: 0,
expected_group: group_1,
},
AssertGroupRowCount {
group_index: 1,
row_count: 2,
},
AssertGroup {
group_index: 1,
expected_group: group_0,
},
];
test.run_scripts(scripts).await;
}
#[tokio::test]
async fn group_move_group_row_after_move_group_test() {
let mut test = GridGroupTest::new().await;
let group_0 = test.group_at_index(0).await;
let group_1 = test.group_at_index(1).await;
@ -366,6 +396,20 @@ async fn group_move_group_test() {
group_index: 1,
expected_group: group_0,
},
MoveRow {
from_group_index: 0,
from_row_index: 0,
to_group_index: 1,
to_row_index: 0,
},
AssertGroupRowCount {
group_index: 0,
row_count: 1,
},
AssertGroupRowCount {
group_index: 1,
row_count: 3,
},
];
test.run_scripts(scripts).await;
}