-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
81 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 22 additions & 11 deletions
33
...le_mode/tests/__swc_snapshots__/src/tests/condition.rs/should_support_conditional_expr.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><view hover-class="{{xs.b(i.cn[0].p1,\'none\')}}" wx:if="{{i.cn[0].compileIf}}">{{i.cn[0].cn[0].v}}</view><text selectable="true" wx:else>hello</text><block wx:if="{{i.cn[1].compileIf}}"><view wx:if="{{i.cn[1].cn[0].compileIf}}">{{i.cn[1].cn[0].cn[0].v}}</view><text wx:else>{{i.cn[1].cn[0].cn[0].v}}</text></block><view wx:else>{{i.cn[1].cn[0].v}}</view><view wx:if="{{i.cn[2].compileIf}}">{{i.cn[2].cn[0].v}}</view><block wx:else><view wx:if="{{i.cn[2].cn[0].compileIf}}">{{i.cn[2].cn[0].cn[0].v}}</view><text wx:else>{{i.cn[2].cn[0].cn[0].v}}</text></block><view wx:if="{{i.cn[3].compileIf}}">{{i.cn[3].cn[0].v}}</view><block wx:else><view wx:if="{{i.cn[3].cn[0].compileIf}}">{{i.cn[3].cn[0].cn[0].v}}</view><text wx:else>{{i.cn[3].cn[0].cn[0].v}}</text></block><block wx:if="{{i.cn[4].compileIf}}"><view wx:if="{{i.cn[4].cn[0].compileIf}}">{{i.cn[4].cn[0].cn[0].v}}</view></block><view wx:else>{{i.cn[4].cn[0].v}}</view><view wx:if="{{i.cn[5].compileIf}}">{{i.cn[5].cn[0].v}}</view><block wx:else><view wx:if="{{i.cn[5].cn[0].compileIf}}">{{i.cn[5].cn[0].cn[0].v}}</view></block><block wx:if="{{i.cn[6].compileIf}}">{{i.cn[6].cn[0].v}}</block><block wx:else>{{i.cn[6].cn[0].v}}</block><view class="{{i.cn[7].cl}}" wx:if="{{i.cn[7].compileIf}}"></view><view wx:else></view><view wx:if="{{i.cn[8].compileIf}}"><view wx:if="{{i.cn[8].cn[0].compileIf}}"></view><view wx:else></view></view><view wx:else></view><view hover-class="{{xs.b(i.cn[9].p1,\'none\')}}"></view></view></template>'; | ||
function Index() { | ||
return <View compileMode="f0t0"> | ||
{condition ? <View hoverClass={myClass} compileIf={condition}>{content}</View> : <Text></Text>} | ||
{condition1 ? <block compileIf={condition1}>{condition2 ? <View compileIf={condition2}>{a}</View> : <Text>{b}</Text>}</block> : <View>{c}</View>} | ||
{condition1 ? <View compileIf={condition1}>{a}</View> : <block>{condition2 ? <View compileIf={condition2}>{b}</View> : <Text>{c}</Text>}</block>} | ||
{condition1 ? <View compileIf={condition1}>{a}</View> : <block>{condition2 ? <View compileIf={condition2}>{b}</View> : <Text>{c}</Text>}</block>} | ||
{condition1 ? <block compileIf={condition1}>{condition2 ? <View compileIf={condition2}>{a}</View> : <View/>}</block> : <View>{b}</View>} | ||
{condition1 ? <View compileIf={condition1}>{a}</View> : <block>{condition2 ? <View compileIf={condition2}>{b}</View> : <View/>}</block>} | ||
{condition1 ? <block compileIf={condition1}>{"someText"}</block> : <block>{789}</block>} | ||
{condition1 ? <View className={condition2 ? '' : ''} compileIf={condition1}/> : <View/>} | ||
{condition1 ? <View compileIf={condition1}>{condition2 ? <View compileIf={condition2}/> : <View/>}</View> : <View/>} | ||
<View hoverClass={myClass}></View> | ||
</View>; | ||
|
||
{condition ? <View hoverClass={myClass} compileIf={condition}>{content}</View> : <Text></Text>} | ||
|
||
{condition1 ? <block compileIf={condition1}>{condition2 ? <View compileIf={condition2}>{a}</View> : <Text>{b}</Text>}</block> : <View>{c}</View>} | ||
|
||
{condition1 ? <View compileIf={condition1}>{a}</View> : <block>{condition2 ? <View compileIf={condition2}>{b}</View> : <Text>{c}</Text>}</block>} | ||
|
||
{condition1 ? <View compileIf={condition1}>{a}</View> : <block>{condition2 ? <View compileIf={condition2}>{b}</View> : <Text>{c}</Text>}</block>} | ||
|
||
{condition1 ? <block compileIf={condition1}>{condition2 ? <View compileIf={condition2}>{a}</View> : <View/>}</block> : <View>{b}</View>} | ||
|
||
{condition1 ? <View compileIf={condition1}>{a}</View> : <block>{condition2 ? <View compileIf={condition2}>{b}</View> : <View/>}</block>} | ||
|
||
{condition1 ? <block compileIf={condition1}>{"someText"}</block> : <block>{789}</block>} | ||
|
||
{condition1 ? <View className={condition2 ? '' : ''} compileIf={condition1}/> : <View/>} | ||
|
||
{condition1 ? <View compileIf={condition1}>{condition2 ? <View compileIf={condition2}/> : <View/>}</View> : <View/>} | ||
|
||
<View hoverClass={myClass}></View> | ||
|
||
</View>; | ||
} |
8 changes: 8 additions & 0 deletions
8
..._mode/tests/__swc_snapshots__/src/tests/condition.rs/should_support_jsx_container_expr.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><view hover-class="{{xs.b(i.cn[0].p1,\'none\')}}"></view></view></template>'; | ||
function Index() { | ||
return <View compileMode="f0t0"> | ||
|
||
{<View hoverClass={myClass}></View>} | ||
|
||
</View>; | ||
} |
2 changes: 1 addition & 1 deletion
2
...re_process/tests/__swc_snapshots__/src/tests/entry.rs/should_support_default_export_fn.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...re_process/tests/__swc_snapshots__/src/tests/props.rs/should_not_replace_dynamic_props.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export default function Index() { | ||
const list = [ | ||
1, | ||
2, | ||
3 | ||
]; | ||
function renderA(listA) { | ||
return <View> {listA.map((item, index)=>{ | ||
return <View key={index}> {item} </View>; | ||
})} </View>; | ||
} | ||
return <View compileMode> | ||
|
||
{renderA(list.map((item)=>item + 1))} | ||
|
||
</View>; | ||
} |