You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let expect = r#"{const _tag_=tags['view'];var _class_:string="a "+data.b;}"#;
996
+
let expect = r#"{const _tag_=tags['view'];var _class_:string="a "+(data.b);}"#;
965
997
let(out, sm) = convert(src);
966
998
assert_eq!(out, expect);
967
999
assert_eq!(find_token(&sm,0,26),Some((0,6)));
@@ -1107,11 +1139,12 @@ mod test {
1107
1139
#[test]
1108
1140
fnelement_with_scripts(){
1109
1141
let src = r#"<view let:a="{{ b.c() }}" /><wxs module="b">;</wxs>"#;
1110
-
let expect = r#"{const _tag_=tags['view'];const a=b?.c?.();}"#;
1142
+
let expect = r#"const b={}as{[k:string]:any};{const _tag_=tags['view'];const a=b?.c?.();}"#;
1111
1143
let(out, sm) = convert(src);
1112
1144
assert_eq!(out, expect);
1113
-
assert_eq!(find_token(&sm,0,32),Some((0,10)));
1114
-
assert_eq!(find_token(&sm,0,34),Some((0,16)));
1145
+
assert_eq!(find_token(&sm,0,6),Some((0,41)));
1146
+
assert_eq!(find_token(&sm,0,61),Some((0,10)));
1147
+
assert_eq!(find_token(&sm,0,63),Some((0,16)));
1115
1148
}
1116
1149
1117
1150
#[test]
@@ -1218,6 +1251,14 @@ mod test {
1218
1251
assert_eq!(find_token(&sm,0,202),Some((0,1)));
1219
1252
}
1220
1253
1254
+
#[test]
1255
+
fnmixed_scopes(){
1256
+
let src = r#"<view wx:for="{{ list }}" wx:for-item="v" wx:for-index="k" hidden="{{ k && v }}" /><view let:a="{{ b }}">{{ a }}</view>"#;
1257
+
let expect = r#"{const _for_=data.list;const v=0 as unknown as _ForItem_<typeof _for_>;const k=0 as unknown as _ForIndex_<typeof _for_>;{const _tag_=tags['view'];_tag_.hidden=k&&v;}}{const _tag_=tags['view'];const a=data.b;a;}"#;
1258
+
let(out, _) = convert(src);
1259
+
assert_eq!(out, expect);
1260
+
}
1261
+
1221
1262
#[test]
1222
1263
fnif_branches(){
1223
1264
let src = r#"<block wx:if="{{ a }}" /><block wx:elif="{{ b }}" /><block wx:else />"#;
0 commit comments