mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-29 01:34:29 +01:00
Scripts: ScriptUI dialogs refuse look-alike containers, noecho fields and stale descriptions
- An answer step with an empty control matches only an unnamed control whose
text is empty, not the first unnamed control.
- add() and add("item") on an object made to look like a container or list
throw a TypeError and charge nothing to the dialog's limits.
- A new list's initial items are read through ordinary property access, so an
index getter gives its value.
- findElement() keeps the controls it has still to look at rooted while a
name getter runs, and skips a control the element no longer holds.
- A close() that onClose calls before it returns false belongs to the close it
refuses; the dialog waits for the next event.
- show() throws for an edittext with noecho before the dialog opens.
- show() reads the dialog again when a getter adds or removes a control after
the controls were read, and throws when it changes again.
- An edit field takes at most 32,768 characters while it is typed.
This commit is contained in:
1 parent
3ede7a59f4
commit
9dc197b4e4
7 files changed
+200
-32
No files matched your search
@@ -131,6 +131,13 @@ fn a_step_names_a_control_by_its_text_only_when_it_has_no_name() {
|
||||
let go = "var w = new Window('dialog'); w.add('button', undefined, 'Go', {name: 'go'}); w.show();";
|
||||
let e = headless(&mut s, go, window(json!([{"control": "Go", "event": "click"}]))).unwrap_err().to_string();
|
||||
assert!(e.contains("the dialog has no control named Go"), "{e}");
|
||||
let help = "var w = new Window('dialog'); w.add('button', undefined, 'Help').onClick = function () { vc.log('help'); }; w.show();";
|
||||
let e = headless(&mut s, help, window(json!([{"control": "", "event": "click"}]))).unwrap_err().to_string();
|
||||
assert!(e.contains("the dialog has no control named"), "an empty step names no control without a name: {e}");
|
||||
let blank = "var w = new Window('dialog'); w.add('button', undefined, 'Help').onClick = function () { vc.log('help'); }; \
|
||||
w.add('button', undefined, '').onClick = function () { vc.log('blank'); }; w.add('button', undefined, 'OK'); w.show();";
|
||||
headless(&mut s, blank, window(json!([{"control": "", "event": "click"}, {"control": "OK", "event": "click"}]))).unwrap();
|
||||
assert_eq!(s.script_report().unwrap()["log"], json!(["blank"]), "an empty step names the unnamed control whose text is empty");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user