mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: add sub data type
This commit is contained in:
@ -18,7 +18,7 @@ pub struct GridRowTestBuilder<'a> {
|
||||
impl<'a> GridRowTestBuilder<'a> {
|
||||
pub fn new(block_id: &str, field_revs: &'a [Arc<FieldRevision>]) -> Self {
|
||||
assert_eq!(field_revs.len(), FieldType::COUNT);
|
||||
let inner_builder = RowRevisionBuilder::new(field_revs);
|
||||
let inner_builder = RowRevisionBuilder::new(block_id, field_revs);
|
||||
Self {
|
||||
block_id: block_id.to_owned(),
|
||||
field_revs,
|
||||
@ -77,8 +77,7 @@ impl<'a> GridRowTestBuilder<'a> {
|
||||
let type_option = SingleSelectTypeOptionPB::from(&single_select_field);
|
||||
let option = f(type_option.options);
|
||||
self.inner_builder
|
||||
.insert_select_option_cell(&single_select_field.id, option.id)
|
||||
.unwrap();
|
||||
.insert_select_option_cell(&single_select_field.id, option.id);
|
||||
|
||||
single_select_field.id.clone()
|
||||
}
|
||||
@ -96,8 +95,7 @@ impl<'a> GridRowTestBuilder<'a> {
|
||||
.collect::<Vec<_>>()
|
||||
.join(SELECTION_IDS_SEPARATOR);
|
||||
self.inner_builder
|
||||
.insert_select_option_cell(&multi_select_field.id, ops_ids)
|
||||
.unwrap();
|
||||
.insert_select_option_cell(&multi_select_field.id, ops_ids);
|
||||
|
||||
multi_select_field.id.clone()
|
||||
}
|
||||
@ -115,7 +113,7 @@ impl<'a> GridRowTestBuilder<'a> {
|
||||
}
|
||||
|
||||
pub fn build(self) -> RowRevision {
|
||||
self.inner_builder.build(&self.block_id)
|
||||
self.inner_builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ pub fn create_text_field(grid_id: &str) -> (InsertFieldParams, FieldRevision) {
|
||||
|
||||
pub fn create_single_select_field(grid_id: &str) -> (InsertFieldParams, FieldRevision) {
|
||||
let single_select = SingleSelectTypeOptionBuilder::default()
|
||||
.option(SelectOptionPB::new("Done"))
|
||||
.option(SelectOptionPB::new("Progress"));
|
||||
.add_option(SelectOptionPB::new("Done"))
|
||||
.add_option(SelectOptionPB::new("Progress"));
|
||||
|
||||
let field_rev = FieldBuilder::new(single_select).name("Name").visibility(true).build();
|
||||
let cloned_field_rev = field_rev.clone();
|
||||
|
@ -138,9 +138,9 @@ fn make_test_grid() -> BuildGridContext {
|
||||
FieldType::SingleSelect => {
|
||||
// Single Select
|
||||
let single_select = SingleSelectTypeOptionBuilder::default()
|
||||
.option(SelectOptionPB::new(COMPLETED))
|
||||
.option(SelectOptionPB::new(PLANNED))
|
||||
.option(SelectOptionPB::new(PAUSED));
|
||||
.add_option(SelectOptionPB::new(COMPLETED))
|
||||
.add_option(SelectOptionPB::new(PLANNED))
|
||||
.add_option(SelectOptionPB::new(PAUSED));
|
||||
let single_select_field = FieldBuilder::new(single_select).name("Status").visibility(true).build();
|
||||
grid_builder.add_field(single_select_field);
|
||||
}
|
||||
|
Reference in New Issue
Block a user