mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-29 12:56:47 -06:00
M6: keep Vue attribute context and escape plain attribute entities
A quoted Vue attribute stays open across placeholders, so `title="{a} {b}"` escapes both values as attribute text. Plain Vue attribute values in instance calls now HTML-escape `&`, `<` and `>`, so a literal `&` survives the round trip. Tests cover both.
This commit is contained in:
@@ -129,6 +129,12 @@ fn instances_are_calls_passing_the_values_they_set() {
|
||||
assert_eq!(component_code(&mut s, i, "vue")["usage"], "<Card :showDot=\"false\" :title=\""Say \\"hi\\" $5\\nnow"\" />\n");
|
||||
let vue = code(&mut s, i, "vue");
|
||||
assert!(vue.starts_with("<Card :showDot=\"false\" :title=\""Say \\"hi\\" $5\\nnow"\" />\n"), "{vue}");
|
||||
// A plain attribute keeps HTML entities intact: a literal ampersand is written as `&`,
|
||||
// and a literal `&` as `&amp;`.
|
||||
ex(&mut s, "instance.setProperties", json!({"ids": [i], "properties": {"Title": "Fish & Chips"}}));
|
||||
assert_eq!(component_code(&mut s, i, "vue")["usage"], "<Card :showDot=\"false\" title=\"Fish & Chips\" />\n");
|
||||
ex(&mut s, "instance.setProperties", json!({"ids": [i], "properties": {"Title": "Fish & Chips"}}));
|
||||
assert_eq!(component_code(&mut s, i, "vue")["usage"], "<Card :showDot=\"false\" title=\"Fish &amp; Chips\" />\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user