File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,16 @@ public void Checkbox_Ok()
2727 Assert . DoesNotContain ( "is-label" , cut . Markup ) ;
2828 }
2929
30+ [ Fact ]
31+ public void ChildContent_Ok ( )
32+ {
33+ var cut = Context . RenderComponent < Checkbox < string > > ( builder =>
34+ {
35+ builder . Add ( a => a . ChildContent , pb => pb . AddContent ( 0 , "test-childcontent" ) ) ;
36+ } ) ;
37+ cut . MarkupMatches ( "<div class=\" form-check\" ><input type=\" checkbox\" diff:ignore class=\" form-check-input\" blazor:onclick=\" 1\" /><label class=\" form-check-label\" diff:ignore>test-childcontent</label></div>" ) ;
38+ }
39+
3040 [ Fact ]
3141 public void StopPropagation_Ok ( )
3242 {
@@ -443,6 +453,26 @@ await cut.InvokeAsync(async () =>
443453 Assert . False ( max ) ;
444454 }
445455
456+ [ Fact ]
457+ public void ItemTemplate_Ok ( )
458+ {
459+ var items = new List < SelectedItem > ( )
460+ {
461+ new ( "1" , "Test 1" ) ,
462+ new ( "2" , "Test 2" ) ,
463+ new ( "3" , "Test 3" )
464+ } ;
465+ var cut = Context . RenderComponent < CheckboxList < string > > ( pb =>
466+ {
467+ pb . Add ( a => a . Items , items ) ;
468+ pb . Add ( a => a . ItemTemplate , item => b =>
469+ {
470+ b . AddContent ( 0 , item . Text ) ;
471+ } ) ;
472+ } ) ;
473+ cut . MarkupMatches ( "<div diff:ignore class=\" checkbox-list form-control\" tabindex=\" 0\" hidefocus=\" true\" ><div class=\" checkbox-item\" ><div class=\" form-check is-label\" ><input type=\" checkbox\" diff:ignore class=\" form-check-input\" blazor:onclick=\" 1\" /><label class=\" form-check-label\" diff:ignore>Test 1</label></div></div><div class=\" checkbox-item\" ><div class=\" form-check is-label\" ><input type=\" checkbox\" diff:ignore class=\" form-check-input\" blazor:onclick=\" 2\" /><label class=\" form-check-label\" diff:ignore>Test 2</label></div></div><div class=\" checkbox-item\" ><div class=\" form-check is-label\" ><input type=\" checkbox\" diff:ignore class=\" form-check-input\" blazor:onclick=\" 3\" /><label class=\" form-check-label\" diff:ignore>Test 3</label></div></div></div>" ) ;
474+ }
475+
446476 private class CheckboxListGenericMock < T >
447477 {
448478
You can’t perform that action at this time.
0 commit comments