mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: add board no status column
This commit is contained in:
@ -2,7 +2,7 @@ use crate::grid::grid_editor::GridEditorTest;
|
||||
use flowy_grid::entities::{
|
||||
CreateRowParams, FieldChangesetParams, FieldType, GridLayout, GroupPB, MoveGroupParams, MoveGroupRowParams, RowPB,
|
||||
};
|
||||
use flowy_grid::services::cell::insert_select_option_cell;
|
||||
use flowy_grid::services::cell::{delete_select_option_cell, insert_select_option_cell};
|
||||
use flowy_grid_data_model::revision::RowChangeset;
|
||||
use std::time::Duration;
|
||||
use tokio::time::interval;
|
||||
@ -128,11 +128,22 @@ impl GridGroupTest {
|
||||
let field_id = from_group.field_id;
|
||||
let field_rev = self.editor.get_field_rev(&field_id).await.unwrap();
|
||||
let field_type: FieldType = field_rev.ty.into();
|
||||
let cell_rev = match field_type {
|
||||
FieldType::SingleSelect => insert_select_option_cell(to_group.group_id.clone(), &field_rev),
|
||||
FieldType::MultiSelect => insert_select_option_cell(to_group.group_id.clone(), &field_rev),
|
||||
_ => {
|
||||
panic!("Unsupported group field type");
|
||||
|
||||
let cell_rev = if to_group.is_default {
|
||||
match field_type {
|
||||
FieldType::SingleSelect => delete_select_option_cell(to_group.group_id.clone(), &field_rev),
|
||||
FieldType::MultiSelect => delete_select_option_cell(to_group.group_id.clone(), &field_rev),
|
||||
_ => {
|
||||
panic!("Unsupported group field type");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
match field_type {
|
||||
FieldType::SingleSelect => insert_select_option_cell(to_group.group_id.clone(), &field_rev),
|
||||
FieldType::MultiSelect => insert_select_option_cell(to_group.group_id.clone(), &field_rev),
|
||||
_ => {
|
||||
panic!("Unsupported group field type");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@ use flowy_grid::entities::FieldChangesetParams;
|
||||
async fn group_init_test() {
|
||||
let mut test = GridGroupTest::new().await;
|
||||
let scripts = vec![
|
||||
AssertGroupCount(3),
|
||||
AssertGroupCount(4),
|
||||
AssertGroupRowCount {
|
||||
group_index: 0,
|
||||
row_count: 2,
|
||||
@ -19,6 +19,10 @@ async fn group_init_test() {
|
||||
group_index: 2,
|
||||
row_count: 1,
|
||||
},
|
||||
AssertGroupRowCount {
|
||||
group_index: 3,
|
||||
row_count: 0,
|
||||
},
|
||||
];
|
||||
test.run_scripts(scripts).await;
|
||||
}
|
||||
@ -294,6 +298,55 @@ async fn group_reorder_group_test() {
|
||||
test.run_scripts(scripts).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn group_move_to_default_group_test() {
|
||||
let mut test = GridGroupTest::new().await;
|
||||
let scripts = vec![
|
||||
UpdateRow {
|
||||
from_group_index: 0,
|
||||
row_index: 0,
|
||||
to_group_index: 3,
|
||||
},
|
||||
AssertGroupRowCount {
|
||||
group_index: 0,
|
||||
row_count: 1,
|
||||
},
|
||||
AssertGroupRowCount {
|
||||
group_index: 3,
|
||||
row_count: 1,
|
||||
},
|
||||
];
|
||||
test.run_scripts(scripts).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn group_move_from_default_group_test() {
|
||||
let mut test = GridGroupTest::new().await;
|
||||
let scripts = vec![UpdateRow {
|
||||
from_group_index: 0,
|
||||
row_index: 0,
|
||||
to_group_index: 3,
|
||||
}];
|
||||
test.run_scripts(scripts).await;
|
||||
|
||||
let scripts = vec![
|
||||
UpdateRow {
|
||||
from_group_index: 3,
|
||||
row_index: 0,
|
||||
to_group_index: 0,
|
||||
},
|
||||
AssertGroupRowCount {
|
||||
group_index: 0,
|
||||
row_count: 2,
|
||||
},
|
||||
AssertGroupRowCount {
|
||||
group_index: 3,
|
||||
row_count: 0,
|
||||
},
|
||||
];
|
||||
test.run_scripts(scripts).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn group_move_group_test() {
|
||||
let mut test = GridGroupTest::new().await;
|
||||
|
Reference in New Issue
Block a user