File tree Expand file tree Collapse file tree 4 files changed +42
-6
lines changed
Expand file tree Collapse file tree 4 files changed +42
-6
lines changed Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk.Razor" >
22
33 <PropertyGroup >
4- <Version >10.3.1-beta03 </Version >
4+ <Version >10.3.1-beta04 </Version >
55 </PropertyGroup >
66
77 <ItemGroup >
Original file line number Diff line number Diff line change @@ -155,6 +155,21 @@ public async Task<int> Next()
155155 return _currentStepIndex ;
156156 }
157157
158+ /// <summary>
159+ /// <para lang="zh">设置当前步骤索引 <see cref="StepIndex"/> 值</para>
160+ /// <para lang="en">Set current step index <see cref="StepIndex"/> value</para>
161+ /// </summary>
162+ /// <param name="index"></param>
163+ public async Task SetStepIndex ( int index )
164+ {
165+ _currentStepIndex = Math . Max ( 0 , Math . Min ( Items . Count , index ) ) ;
166+ if ( IsFinished && OnFinishedCallback != null )
167+ {
168+ await OnFinishedCallback ( ) ;
169+ }
170+ StateHasChanged ( ) ;
171+ }
172+
158173 /// <summary>
159174 /// <para lang="zh">重置步骤方法</para>
160175 /// <para lang="en">Reset Step Method</para>
Original file line number Diff line number Diff line change @@ -196,13 +196,13 @@ public partial class TreeView<TItem> : IModelEqualityComparer<TItem>
196196 public Func < TreeViewItem < TItem > , Task < IEnumerable < TreeViewItem < TItem > > > > ? OnExpandNodeAsync { get ; set ; }
197197
198198 /// <summary>
199- /// <inheritdoc/>
199+ /// <inheritdoc cref="IModelEqualityComparer{TItem}.CustomKeyAttribute" />
200200 /// </summary>
201201 [ Parameter ]
202202 public Type CustomKeyAttribute { get ; set ; } = typeof ( KeyAttribute ) ;
203203
204204 /// <summary>
205- /// <inheritdoc/>
205+ /// <inheritdoc cref="IModelEqualityComparer{TItem}.ModelEqualityComparer" />
206206 /// </summary>
207207 [ Parameter ]
208208 public Func < TItem , TItem , bool > ? ModelEqualityComparer { get ; set ; }
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ public void Step_Method()
128128 }
129129
130130 [ Fact ]
131- public void FinishedTemplate_Ok ( )
131+ public async Task FinishedTemplate_Ok ( )
132132 {
133133 bool finished = false ;
134134 var cut = Context . Render < Step > ( pb =>
@@ -143,8 +143,29 @@ public void FinishedTemplate_Ok()
143143 } ) ;
144144 } ) ;
145145 var step = cut . Instance ;
146- cut . InvokeAsync ( ( ) => step . Next ( ) ) ;
147- cut . WaitForAssertion ( ( ) => cut . Contains ( "Finished-Template" ) ) ;
146+ await cut . InvokeAsync ( ( ) => step . Next ( ) ) ;
147+ cut . Contains ( "Finished-Template" ) ;
148+ Assert . True ( finished ) ;
149+ }
150+
151+ [ Fact ]
152+ public async Task SetStepIndex ( )
153+ {
154+ bool finished = false ;
155+ var cut = Context . Render < Step > ( pb =>
156+ {
157+ pb . Add ( a => a . Items , GetStepItems ) ;
158+ pb . Add ( a => a . StepIndex , 2 ) ;
159+ pb . Add ( a => a . OnFinishedCallback , ( ) =>
160+ {
161+ finished = true ;
162+ return Task . CompletedTask ;
163+ } ) ;
164+ } ) ;
165+ var step = cut . Instance ;
166+ await cut . InvokeAsync ( ( ) => step . SetStepIndex ( 1 ) ) ;
167+ Assert . False ( finished ) ;
168+ await cut . InvokeAsync ( ( ) => step . SetStepIndex ( 3 ) ) ;
148169 Assert . True ( finished ) ;
149170 }
150171
You can’t perform that action at this time.
0 commit comments