mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
Merge pull request #3299 from dotCooCoo/fix/data-set-status-clears-after-applying
Variables: the nothing-applied message clears when a later data set applies
This commit is contained in:
@@ -807,6 +807,11 @@ impl VectorcraftApp {
|
||||
self.ui.view.pixel_preview = true;
|
||||
}
|
||||
}
|
||||
// Choosing a data set, or stepping to one, clears the status bar. The reply's `warning`
|
||||
// below then shows when no object is bound to a variable the data set has a value for.
|
||||
if matches!(id, "dataset.select" | "dataset.next" | "dataset.prev") {
|
||||
self.ui.status.clear();
|
||||
}
|
||||
if id == "text.setStyle"
|
||||
&& let Some(font) = params.get("font").and_then(Value::as_str)
|
||||
{
|
||||
|
||||
@@ -392,7 +392,8 @@ mod tests {
|
||||
|
||||
/// Choosing a data set, or stepping to one with the arrows, shows a status message when no
|
||||
/// object is bound to a variable it has a value for, for example after Import Data Sets…
|
||||
/// defines new variables. With such an object bound, it shows none.
|
||||
/// defines new variables. With such an object bound, choosing a data set or stepping to one
|
||||
/// clears the message.
|
||||
#[test]
|
||||
fn a_data_set_with_nothing_bound_shows_a_status_message() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
@@ -407,10 +408,18 @@ mod tests {
|
||||
app.run("dataset.prev", json!({})).unwrap();
|
||||
assert_eq!(app.ui.status, message("A"));
|
||||
|
||||
app.ui.status.clear();
|
||||
app.run("variable.bind", json!({"variable": "Name", "ids": [t]})).unwrap();
|
||||
app.run("dataset.select", json!({"name": "B"})).unwrap();
|
||||
assert_eq!(app.ui.status, "");
|
||||
// Stepping to a data set that applies clears the message as well.
|
||||
for step in ["dataset.next", "dataset.prev"] {
|
||||
app.run("variable.unbind", json!({"variable": "Name", "ids": [t]})).unwrap();
|
||||
app.run("dataset.select", json!({"name": "A"})).unwrap();
|
||||
assert_eq!(app.ui.status, message("A"));
|
||||
app.run("variable.bind", json!({"variable": "Name", "ids": [t]})).unwrap();
|
||||
app.run(step, json!({})).unwrap();
|
||||
assert_eq!(app.ui.status, "", "{step}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user