mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-15 04:56:12 +00:00

* chore: move to latest appflowy collab version * chore: filter mapping * chore: remove mutex folder * chore: cleanup borrow checker issues * chore: fixed flowy user crate compilation errors * chore: removed parking lot crate * chore: adjusting non locking approach * chore: remove with folder method * chore: fix folder manager * chore: fixed workspace database compilation errors * chore: initialize database plugins * chore: fix locks in flowy core * chore: remove supabase * chore: async traits * chore: add mutexes in dart ffi * chore: post rebase fixes * chore: remove supabase dart code * chore: fix deadlock * chore: fix page_id is empty * chore: use data source to init collab * chore: fix user awareness test * chore: fix database deadlock * fix: initialize user awareness * chore: fix open workspace test * chore: fix import csv * chore: fix update row meta deadlock * chore: fix document size test * fix: timestamp set/get type convert * fix: calculation * chore: revert Arc to Rc * chore: attach plugin to database and database row * chore: async get row * chore: clippy * chore: fix tauri build * chore: clippy * fix: duplicate view deadlock * chore: fmt * chore: tauri build --------- Co-authored-by: nathan <nathan@appflowy.io>
123 lines
2.9 KiB
Rust
123 lines
2.9 KiB
Rust
use flowy_database2::entities::FieldType;
|
|
use flowy_database2::entities::FieldVisibility;
|
|
use flowy_database2::services::field_settings::DEFAULT_WIDTH;
|
|
|
|
use crate::database::field_settings_test::script::FieldSettingsTest;
|
|
|
|
/// Check default field settings for grid, kanban and calendar
|
|
#[tokio::test]
|
|
async fn get_default_grid_field_settings() {
|
|
// grid
|
|
let mut test = FieldSettingsTest::new_grid().await;
|
|
test
|
|
.assert_all_field_settings(FieldVisibility::AlwaysShown, DEFAULT_WIDTH)
|
|
.await;
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn get_default_board_field_settings() {
|
|
// board
|
|
let mut test = FieldSettingsTest::new_board().await;
|
|
let non_primary_field_ids: Vec<String> = test
|
|
.get_fields()
|
|
.await
|
|
.into_iter()
|
|
.filter(|field| !field.is_primary)
|
|
.map(|field| field.id)
|
|
.collect();
|
|
let primary_field_id = test.get_first_field(FieldType::RichText).await.id;
|
|
test
|
|
.assert_field_settings(
|
|
non_primary_field_ids.clone(),
|
|
FieldVisibility::HideWhenEmpty,
|
|
DEFAULT_WIDTH,
|
|
)
|
|
.await;
|
|
test
|
|
.assert_field_settings(
|
|
vec![primary_field_id.clone()],
|
|
FieldVisibility::AlwaysShown,
|
|
DEFAULT_WIDTH,
|
|
)
|
|
.await;
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn get_default_calendar_field_settings() {
|
|
// calendar
|
|
let mut test = FieldSettingsTest::new_calendar().await;
|
|
let non_primary_field_ids: Vec<String> = test
|
|
.get_fields()
|
|
.await
|
|
.into_iter()
|
|
.filter(|field| !field.is_primary)
|
|
.map(|field| field.id)
|
|
.collect();
|
|
let primary_field_id = test.get_first_field(FieldType::RichText).await.id;
|
|
test
|
|
.assert_field_settings(
|
|
non_primary_field_ids.clone(),
|
|
FieldVisibility::HideWhenEmpty,
|
|
DEFAULT_WIDTH,
|
|
)
|
|
.await;
|
|
test
|
|
.assert_field_settings(
|
|
vec![primary_field_id.clone()],
|
|
FieldVisibility::AlwaysShown,
|
|
DEFAULT_WIDTH,
|
|
)
|
|
.await;
|
|
}
|
|
|
|
/// Update field settings for a field
|
|
#[tokio::test]
|
|
async fn update_field_settings_test() {
|
|
let mut test = FieldSettingsTest::new_board().await;
|
|
let non_primary_field_ids: Vec<String> = test
|
|
.get_fields()
|
|
.await
|
|
.into_iter()
|
|
.filter(|field| !field.is_primary)
|
|
.map(|field| field.id)
|
|
.collect();
|
|
let primary_field_id = test.get_first_field(FieldType::RichText).await.id;
|
|
|
|
test
|
|
.assert_field_settings(
|
|
non_primary_field_ids.clone(),
|
|
FieldVisibility::HideWhenEmpty,
|
|
DEFAULT_WIDTH,
|
|
)
|
|
.await;
|
|
test
|
|
.assert_field_settings(
|
|
vec![primary_field_id.clone()],
|
|
FieldVisibility::AlwaysShown,
|
|
DEFAULT_WIDTH,
|
|
)
|
|
.await;
|
|
|
|
test
|
|
.update_field_settings(
|
|
primary_field_id.clone(),
|
|
Some(FieldVisibility::HideWhenEmpty),
|
|
None,
|
|
)
|
|
.await;
|
|
test
|
|
.assert_field_settings(
|
|
non_primary_field_ids.clone(),
|
|
FieldVisibility::HideWhenEmpty,
|
|
DEFAULT_WIDTH,
|
|
)
|
|
.await;
|
|
test
|
|
.assert_field_settings(
|
|
vec![primary_field_id.clone()],
|
|
FieldVisibility::HideWhenEmpty,
|
|
DEFAULT_WIDTH,
|
|
)
|
|
.await;
|
|
}
|