File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,42 @@ public void Readonly_Ok()
6969 cut . Contains ( "readonly=\" true\" " ) ;
7070 }
7171
72+ [ Fact ]
73+ public void Clearable_Ok ( )
74+ {
75+ var cut = Context . RenderComponent < BootstrapInput < string > > ( builder => builder . Add ( a => a . Clearable , false ) ) ;
76+ cut . DoesNotContain ( "bb-clearable-input" ) ;
77+
78+ cut . SetParametersAndRender ( pb => pb . Add ( a => a . Clearable , true ) ) ;
79+ cut . Contains ( "bb-clearable-input" ) ;
80+ cut . Contains ( "form-control-clear-icon" ) ;
81+
82+ cut . SetParametersAndRender ( pb => pb . Add ( a => a . Readonly , true ) ) ;
83+ cut . DoesNotContain ( "form-control-clear-icon" ) ;
84+
85+ cut . SetParametersAndRender ( pb => pb . Add ( a => a . Readonly , false ) ) ;
86+ cut . SetParametersAndRender ( pb => pb . Add ( a => a . IsDisabled , true ) ) ;
87+ cut . DoesNotContain ( "form-control-clear-icon" ) ;
88+ }
89+
90+ [ Fact ]
91+ public async Task OnClear_Ok ( )
92+ {
93+ var clicked = false ;
94+ var cut = Context . RenderComponent < BootstrapInput < string > > ( builder =>
95+ {
96+ builder . Add ( a => a . Clearable , true ) ;
97+ builder . Add ( a => a . OnClear , v =>
98+ {
99+ clicked = true ;
100+ return Task . CompletedTask ;
101+ } ) ;
102+ } ) ;
103+ var icon = cut . Find ( ".form-control-clear-icon" ) ;
104+ await cut . InvokeAsync ( ( ) => icon . Click ( ) ) ;
105+ Assert . True ( clicked ) ;
106+ }
107+
72108 [ Fact ]
73109 public async Task OnInput_Ok ( )
74110 {
You can’t perform that action at this time.
0 commit comments