-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix RefreshView indicator hiding immediately (#118)
- Loading branch information
1 parent
78fb00d
commit fe4e9a3
Showing
2 changed files
with
42 additions
and
3 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: 33 additions & 0 deletions
33
src/BlazorBindings.UnitTests/Elements/RefreshViewTests.razor
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,33 @@ | ||
@inherits ElementTestBase | ||
|
||
@code { | ||
[Test] | ||
public async Task InvokeOnRefreshingCallback() | ||
{ | ||
int refreshCount = 0; | ||
bool refreshInvokeStarted = false; | ||
var refreshAction = async () => { refreshInvokeStarted = true; await Task.Delay(20); refreshCount++; }; | ||
Label labelRef = null; | ||
|
||
var refreshView = await Render<MC.RefreshView>( | ||
@<RefreshView OnRefreshing="refreshAction"> | ||
<ScrollView> | ||
<VerticalStackLayout> | ||
<Label @ref="labelRef">@refreshCount</Label> | ||
</VerticalStackLayout> | ||
</ScrollView> | ||
</RefreshView> | ||
); | ||
|
||
refreshView.IsRefreshing = true; | ||
|
||
await Task.Delay(5); | ||
Assert.That(refreshInvokeStarted, Is.True); | ||
Assert.That(refreshView.IsRefreshing, Is.True); | ||
|
||
await Task.Delay(20); | ||
Assert.That(refreshCount, Is.EqualTo(1)); | ||
Assert.That(refreshView.IsRefreshing, Is.False); | ||
Assert.That(labelRef.NativeControl.Text, Is.EqualTo("1")); | ||
} | ||
} |