File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
bunit.testassets/BlazorE2E
bunit.web.query.tests/Labels Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 33
33
@( (MarkupString ) $""" <{htmlElement } aria-labelledby="{htmlElement }-with-aria-labelledby"></{htmlElement }>""" )
34
34
}
35
35
36
+ @* Testing we get back the re-rendered element *@
37
+ <label for =" re-rendered-element" >Re-rendered Element</label >
38
+ <input id =" re-rendered-element" @bind =" @_count" />
39
+ <button id =" increment-button" @onclick =" IncrementCount" >Click</button >
40
+
36
41
@code {
37
42
readonly List <string > htmlElementsThatCanHaveALabel = new ()
38
43
{
44
49
" output" ,
45
50
" progress" ,
46
51
};
52
+
53
+ private int _count ;
54
+ public void IncrementCount () => _count ++ ;
47
55
}
Original file line number Diff line number Diff line change @@ -85,4 +85,16 @@ public void Test006(string htmlElementWithLabel)
85
85
input . NodeName . ShouldBe ( htmlElementWithLabel , StringCompareShould . IgnoreCase ) ;
86
86
input . GetAttribute ( "aria-labelledby" ) . ShouldBe ( $ "{ htmlElementWithLabel } -with-aria-labelledby") ;
87
87
}
88
+
89
+ [ Fact ( DisplayName = "Should reflect latest value when component re-renders" ) ]
90
+ public void Test007 ( )
91
+ {
92
+ var cut = RenderComponent < LabelQueryComponent > ( ) ;
93
+
94
+ var input = cut . FindByLabelText ( "Re-rendered Element" ) ;
95
+ input . GetAttribute ( "value" ) . ShouldBe ( "0" ) ;
96
+
97
+ cut . Find ( "#increment-button" ) . Click ( ) ;
98
+ input . GetAttribute ( "value" ) . ShouldBe ( "1" ) ;
99
+ }
88
100
}
You can’t perform that action at this time.
0 commit comments