Selaa lähdekoodia

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

* test: grid switch from date to text test

* test: change back the DateTime format to US
Kelvin 2 vuotta sitten
vanhempi
commit
aae8259f63
1 muutettua tiedostoa jossa 23 lisäystä ja 1 poistoa
  1. 23 1
      frontend/rust-lib/flowy-grid/tests/grid/field_test/test.rs

+ 23 - 1
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: