Skip to content

Commit 45c73a2

Browse files
authored
test: UnitTest Switching from Multi to text (#1585)
1 parent ce86227 commit 45c73a2

File tree

1 file changed

+33
-0
lines changed
  • frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option

1 file changed

+33
-0
lines changed

frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option/text_tests.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,37 @@ mod tests {
4343
done_option.name,
4444
);
4545
}
46+
/*
47+
- [Unit Test] Testing the switching from Multi-selection type to Text type
48+
- Tracking : https://github.com/AppFlowy-IO/AppFlowy/issues/1183
49+
*/
50+
#[test]
51+
fn multiselect_to_text_type() {
52+
let text_type_option = RichTextTypeOptionPB::default();
53+
let field_type = FieldType::MultiSelect;
54+
55+
let France = SelectOptionPB::new("France");
56+
let france_optionId = France.id.clone();
57+
58+
let Argentina = SelectOptionPB::new("Argentina");
59+
let argentina_optionId = Argentina.id.clone();
60+
61+
let multi_select = MultiSelectTypeOptionBuilder::default()
62+
.add_option(France.clone())
63+
.add_option(Argentina.clone());
64+
65+
let field_rev = FieldBuilder::new(multi_select).build();
66+
67+
assert_eq!(
68+
text_type_option
69+
.decode_cell_data(
70+
format!("{},{}", france_optionId, argentina_optionId),
71+
&field_type,
72+
&field_rev
73+
)
74+
.unwrap()
75+
.to_string(),
76+
format!("{},{}", France.name, Argentina.name)
77+
);
78+
}
4679
}

0 commit comments

Comments
 (0)