mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-09 09:29:44 -06:00
Tests: move the empty text value test next to the new data set test
This commit is contained in:
@@ -378,25 +378,6 @@ mod tests {
|
||||
assert_eq!(sets["datasets"][0]["values"]["Badge"], json!({"visible": false}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn editing_a_dataset_opens_with_the_rows_own_values() {
|
||||
let mut app = app_with_variables();
|
||||
app.run("dataset.new", json!({"name": "Row 1", "values": {"Title": "Hello", "Badge": false}})).unwrap();
|
||||
app.run("dataset.set", json!({"name": "Row 1", "values": {"Badge": true}})).unwrap();
|
||||
open(&mut app, "dataset.set", None);
|
||||
{
|
||||
let d = app.ui.dialog.as_ref().unwrap();
|
||||
assert_eq!(d.str("name"), "Row 1");
|
||||
assert_eq!(d.str(&value_key("Title")), "", "the row carries no value for it");
|
||||
assert!(d.bool(&value_key("Badge")), "the row's own value");
|
||||
}
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert(value_key("Title"), json!("Changed"));
|
||||
crate::dialogs::confirm(&mut app).unwrap();
|
||||
let sets = app.run("dataset.list", json!({})).unwrap();
|
||||
assert_eq!(sets["datasets"][0]["values"]["Title"], json!({"text": "Changed"}));
|
||||
assert_eq!(sets["datasets"][0]["values"]["Badge"], json!({"visible": true}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_untouched_edit_keeps_an_empty_text_value() {
|
||||
let mut app = app_with_variables();
|
||||
@@ -442,6 +423,25 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn editing_a_dataset_opens_with_the_rows_own_values() {
|
||||
let mut app = app_with_variables();
|
||||
app.run("dataset.new", json!({"name": "Row 1", "values": {"Title": "Hello", "Badge": false}})).unwrap();
|
||||
app.run("dataset.set", json!({"name": "Row 1", "values": {"Badge": true}})).unwrap();
|
||||
open(&mut app, "dataset.set", None);
|
||||
{
|
||||
let d = app.ui.dialog.as_ref().unwrap();
|
||||
assert_eq!(d.str("name"), "Row 1");
|
||||
assert_eq!(d.str(&value_key("Title")), "", "the row carries no value for it");
|
||||
assert!(d.bool(&value_key("Badge")), "the row's own value");
|
||||
}
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert(value_key("Title"), json!("Changed"));
|
||||
crate::dialogs::confirm(&mut app).unwrap();
|
||||
let sets = app.run("dataset.list", json!({})).unwrap();
|
||||
assert_eq!(sets["datasets"][0]["values"]["Title"], json!({"text": "Changed"}));
|
||||
assert_eq!(sets["datasets"][0]["values"]["Badge"], json!({"visible": true}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn selecting_a_dataset_from_the_dialog_applies_it() {
|
||||
let mut app = app_with_variables();
|
||||
|
||||
Reference in New Issue
Block a user