Skip to content

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.

test: grid switch from date to text test (#1616)

Kelvinaae8259f636f
diff --git a/frontend/rust-lib/flowy-grid/tests/grid/field_test/test.rs b/frontend/rust-lib/flowy-grid/tests/grid/field_test/test.rs
index 77c8921873..c79090c3af 100644
--- a/frontend/rust-lib/flowy-grid/tests/grid/field_test/test.rs
+++ b/frontend/rust-lib/flowy-grid/tests/grid/field_test/test.rs
@@ -270,7 +270,29 @@ async fn grid_switch_from_text_to_checkbox_test() {}
// input:
// 1647251762 -> Mar 14,2022 (This string will be different base on current data setting)
#[tokio::test]
-async fn grid_switch_from_date_to_text_test() {}
+async fn grid_switch_from_date_to_text_test() {
+ let mut test = GridFieldTest::new().await;
+ let field_rev = test.get_first_field_rev(FieldType::DateTime).clone();
+ let scripts = vec![
+ SwitchToField {
+ field_id: field_rev.id.clone(),
+ new_field_type: FieldType::RichText,
+ },
+ AssertCellContent {
+ field_id: field_rev.id.clone(),
+ row_index: 2,
+ from_field_type: FieldType::DateTime,
+ expected_content: "2022/03/14".to_string(),
+ },
+ AssertCellContent {
+ field_id: field_rev.id.clone(),
+ row_index: 3,
+ from_field_type: FieldType::DateTime,
+ expected_content: "2022/11/17".to_string(),
+ },
+ ];
+ test.run_scripts(scripts).await;
+}
// Test when switching the current field from Number to Text test
// input: