mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-04 13:02:50 -05:00
Scripts: format the new palette tests
This commit is contained in:
1 parent
e26768c531
commit
49af2bf194
2 files changed
+6
-4
No files matched your search
@@ -695,8 +695,8 @@ fn a_handler_that_update_runs_plays_the_actions_of_the_run_that_showed_its_palet
|
||||
let before = objects(&s);
|
||||
assert_eq!(s.script_palette_event(id, UiEvent::Click(1)), Ok(Waiting::Added));
|
||||
// A later run of the engine, given no actions, takes the click in its update().
|
||||
let log = run(&mut s, "#targetengine acts\np.update(); try { app.doScript('Box', 'Set'); } catch (e) { vc.log(e.message); }").unwrap()["log"]
|
||||
.clone();
|
||||
let log =
|
||||
run(&mut s, "#targetengine acts\np.update(); try { app.doScript('Box', 'Set'); } catch (e) { vc.log(e.message); }").unwrap()["log"].clone();
|
||||
assert_eq!(log, json!(["played", "there is no action set “Set”"]), "the run's own call plays the run's own actions");
|
||||
assert_eq!(objects(&s), before + 1, "the handler's action drew its rectangle");
|
||||
}
|
||||
|
||||
@@ -872,8 +872,10 @@ fn a_palette_list_change_throws_when_an_item_s_text_comes_from_a_getter() {
|
||||
#[test]
|
||||
fn update_asks_the_host_once_more_after_a_handler_s_exception() {
|
||||
let (mut r, calls) = palette_realm_with(Vec::new(), vec![palette_event(1.0, click(1))], Vec::new());
|
||||
r.run("var p = new Window('palette'); var b = p.add('button', undefined, 'Go'); b.onClick = function () { throw new Error('broken'); }; p.show();")
|
||||
.unwrap();
|
||||
r.run(
|
||||
"var p = new Window('palette'); var b = p.add('button', undefined, 'Go'); b.onClick = function () { throw new Error('broken'); }; p.show();",
|
||||
)
|
||||
.unwrap();
|
||||
let thrown = r.run("try { p.update(); 'none'; } catch (e) { e.message; }").unwrap();
|
||||
assert_eq!(thrown, JsValue::String("broken".into()));
|
||||
let asked: Vec<String> = names(&calls).into_iter().filter(|n| n == "palettePending" || n == "paletteTake").collect();
|
||||
|
||||
Reference in new issue
Block a user