Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: type option transform for checklists (#4779)
Richard Shiue01f2b15f7066
diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/text_type_option/text_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/text_type_option/text_type_option.rsindex 32e9096e87..5f39f6ad24 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/text_type_option/text_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/text_type_option/text_type_option.rs@@ -73,6 +73,7 @@ impl TypeOptionTransform for RichTextTypeOption {|| transformed_field_type.is_multi_select()|| transformed_field_type.is_number()|| transformed_field_type.is_url()+ || transformed_field_type.is_checklist(){Some(StrCellData::from(stringify_cell_data(cell,diff --git a/frontend/rust-lib/flowy-database2/tests/database/field_test/test.rs b/frontend/rust-lib/flowy-database2/tests/database/field_test/test.rsindex 03b42a69b7..bc54883697 100644--- a/frontend/rust-lib/flowy-database2/tests/database/field_test/test.rs+++ b/frontend/rust-lib/flowy-database2/tests/database/field_test/test.rs@@ -206,7 +206,7 @@ async fn grid_switch_from_multi_select_to_text_test() {// Test when switching the current field from Checkbox to Text test// input:// check -> "Yes"-// unchecked -> ""+// unchecked -> "No"#[tokio::test]async fn grid_switch_from_checkbox_to_text_test() {let mut test = DatabaseFieldTest::new().await;@@ -290,3 +290,24 @@ async fn grid_switch_from_number_to_text_test() {test.run_scripts(scripts).await;}++/// Test when switching the current field from Checklist to Text test+#[tokio::test]+async fn grid_switch_from_checklist_to_text_test() {+ let mut test = DatabaseFieldTest::new().await;+ let field_rev = test.get_first_field(FieldType::Checklist);++ let scripts = vec![+ SwitchToField {+ field_id: field_rev.id.clone(),+ new_field_type: FieldType::RichText,+ },+ AssertCellContent {+ field_id: field_rev.id.clone(),+ row_index: 0,+ from_field_type: FieldType::Checklist,+ expected_content: "First thing".to_string(),+ },+ ];+ test.run_scripts(scripts).await;+}