File tree Expand file tree Collapse file tree 3 files changed +73
-0
lines changed
src/BlazorWebFormsComponents.Test/LinkButton Expand file tree Collapse file tree 3 files changed +73
-0
lines changed Original file line number Diff line number Diff line change 1+ @inherits TestComponentBase
2+
3+ <Fixture Test =" FirstTest" >
4+ <ComponentUnderTest >
5+ <LinkButton OnClick =" OnClick" >Click me!</LinkButton >
6+ </ComponentUnderTest >
7+ </Fixture >
8+
9+ @code {
10+ public string TheContent { get ; set ; } = " Not clicked yet!" ;
11+
12+ void OnClick ()
13+ {
14+ TheContent = " I've been clicked" ;
15+ }
16+
17+ void FirstTest ()
18+ {
19+ // Given
20+ var cut = GetComponentUnderTest ();
21+
22+ TheContent .ShouldBe (" Not clicked yet!" );
23+
24+ // When
25+ cut .Find (" a" ).Click ();
26+
27+ // Then
28+ TheContent .ShouldBe (" I've been clicked" );
29+ }
30+ }
Original file line number Diff line number Diff line change 1+ @inherits TestComponentBase
2+
3+ <Fixture Test =" FirstTest" >
4+ <ComponentUnderTest >
5+ <LinkButton CommandName =" Foo" CommandArgument =" CommandArgument" OnCommand =" OnCommand" >Click me!</LinkButton >
6+ </ComponentUnderTest >
7+ </Fixture >
8+
9+ @code {
10+ public string TheContent { get ; set ; } = " No Command yet!" ;
11+
12+ public string CommandArgument = " bar" ;
13+
14+ void OnCommand (CommandEventArgs args )
15+ {
16+ TheContent = $" Command '{args .CommandName }' : '{args .CommandArgument .ToString ()}'" ;
17+ }
18+
19+ void FirstTest ()
20+ {
21+ // Given
22+ var cut = GetComponentUnderTest ();
23+
24+ TheContent .ShouldBe (" No Command yet!" );
25+
26+ // When
27+ cut .Find (" a" ).Click ();
28+
29+ // Then
30+ TheContent .ShouldBe (" Command 'Foo' : 'bar'" );
31+
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ @inherits TestComponentBase
2+
3+ <SnapshotTest Description =" Verify HTML format of LinkButton" >
4+ <TestInput >
5+ <LinkButton Text =" Go to Bing!!" PostBackUrl =" https://www.bing.com" />
6+ </TestInput >
7+ <ExpectedOutput >
8+ <a href =" https://www.bing.com" >Go to Bing!!</a >
9+ </ExpectedOutput >
10+ </SnapshotTest >
You can’t perform that action at this time.
0 commit comments