mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-08 09:33:54 +00:00

* chore: create orphan view handler * feat: save icon url and cover url in view * feat: implement emoji picker UI * chore: config ui * chore: config ui again * chore: replace RowPB with RowMetaPB to exposing more row information * fix: compile error * feat: show emoji in row * chore: update * test: insert emoji test * test: add update emoji test * test: add remove emoji test * test: add create field tests * test: add create row and delete row integration tests * test: add create row from row menu * test: document in row detail page * test: delete, duplicate row in row detail page * test: check the row count displayed in grid page * test: rename existing field in grid page * test: update field type of exisiting field in grid page * test: delete field test * test: add duplicate field test * test: add hide field test * test: add edit text cell test * test: add insert text to text cell test * test: add edit number cell test * test: add edit multiple number cells * test: add edit checkbox cell test * feat: integrate editor into database row * test: add edit create time and last edit time cell test * test: add edit date cell by selecting a date test * chore: remove unused code * chore: update checklist bg color * test: add update database layout test --------- Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
72 lines
1.7 KiB
Rust
72 lines
1.7 KiB
Rust
use collab_database::database::gen_row_id;
|
|
use collab_database::rows::RowId;
|
|
|
|
use lib_infra::util::timestamp;
|
|
|
|
use crate::database::database_editor::DatabaseEditorTest;
|
|
|
|
pub enum RowScript {
|
|
CreateEmptyRow,
|
|
UpdateTextCell { row_id: RowId, content: String },
|
|
AssertRowCount(usize),
|
|
}
|
|
|
|
pub struct DatabaseRowTest {
|
|
inner: DatabaseEditorTest,
|
|
}
|
|
|
|
impl DatabaseRowTest {
|
|
pub async fn new() -> Self {
|
|
let editor_test = DatabaseEditorTest::new_grid().await;
|
|
Self { inner: editor_test }
|
|
}
|
|
|
|
pub async fn run_scripts(&mut self, scripts: Vec<RowScript>) {
|
|
for script in scripts {
|
|
self.run_script(script).await;
|
|
}
|
|
}
|
|
|
|
pub async fn run_script(&mut self, script: RowScript) {
|
|
match script {
|
|
RowScript::CreateEmptyRow => {
|
|
let params = collab_database::rows::CreateRowParams {
|
|
id: gen_row_id(),
|
|
timestamp: timestamp(),
|
|
..Default::default()
|
|
};
|
|
let row_detail = self
|
|
.editor
|
|
.create_row(&self.view_id, None, params)
|
|
.await
|
|
.unwrap()
|
|
.unwrap();
|
|
self
|
|
.row_by_row_id
|
|
.insert(row_detail.row.id.to_string(), row_detail.meta.into());
|
|
self.row_details = self.get_rows().await;
|
|
},
|
|
RowScript::UpdateTextCell { row_id, content } => {
|
|
self.update_text_cell(row_id, &content).await.unwrap();
|
|
},
|
|
RowScript::AssertRowCount(expected_row_count) => {
|
|
assert_eq!(expected_row_count, self.row_details.len());
|
|
},
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::ops::Deref for DatabaseRowTest {
|
|
type Target = DatabaseEditorTest;
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
&self.inner
|
|
}
|
|
}
|
|
|
|
impl std::ops::DerefMut for DatabaseRowTest {
|
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
|
&mut self.inner
|
|
}
|
|
}
|