File tree Expand file tree Collapse file tree 4 files changed +15
-11
lines changed
examples/Demo/FluentUI.Demo.Client/Documentation/Components/Badges/CounterBadge/Examples
src/Core/Components/Badge
tests/Core/Components/Badge Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 1515<FluentStack VerticalAlignment =" VerticalAlignment.Top" >
1616 <span >
1717 <FluentStack HorizontalAlignment =" HorizontalAlignment.Left" Orientation =" Orientation.Vertical" >
18- <FluentTextInput InputMode =" TextInputMode.Numeric" @bind-Value =" @count" Label =" Count" AutoComplete =" off" />
19- <FluentTextInput InputMode =" TextInputMode.Numeric" @bind-Value =" @offsetX" Label =" Offset X" AutoComplete =" off" />
18+ <FluentTextInput InputMode =" TextInputMode.Numeric" @bind-Value =" @count" Label =" Count" AutoComplete =" off" />
19+ <FluentTextInput InputMode =" TextInputMode.Numeric" @bind-Value =" @overflowCount" Label =" Overflow count" AutoComplete =" off" />
20+ <FluentTextInput InputMode =" TextInputMode.Numeric" @bind-Value =" @offsetX" Label =" Offset X" AutoComplete =" off" />
2021 <FluentTextInput InputMode =" TextInputMode.Numeric" @bind-Value =" @offsetY" Label =" Offset Y" AutoComplete =" off" />
2122 </FluentStack >
2223 </span >
2324 <div class =" grid" >
2425 <div style =" grid-area :contents " >
2526 <FluentCounterBadge Color =" BadgeColor.Danger"
26- Count =" @(UInt16.TryParse(count, out ushort c) ? c : null)"
27+ Count =" @(int.TryParse(count, out int c) ? c : null)"
28+ OverflowCount =" @(int.TryParse(overflowCount, out int oc) ? oc : null)"
2729 OffsetX =" @(SByte.TryParse(offsetX, out sbyte x) ? x : null)"
2830 OffsetY =" @(SByte.TryParse(offsetY, out sbyte y) ? y : null)"
2931 Size =" BadgeSize.Small"
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ namespace FluentUI.Demo.Client.Documentation.Components.Badges.CounterBadge.Exam
88public partial class CounterBadgeAttached
99{
1010 private string ? count = "3" ;
11+ private string ? overflowCount = string . Empty ;
1112 private string ? offsetX ;
1213 private string ? offsetY ;
1314
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public FluentCounterBadge(LibraryConfiguration configuration) : base(configurati
5353 /// With ShowZero being false by default, the default result will be an empty counter badge
5454 /// </summary>
5555 [ Parameter ]
56- public ushort ? Count { get ; set ; }
56+ public int ? Count { get ; set ; }
5757
5858 /// <summary>
5959 /// Gets or sets the badge's overflow count.
Original file line number Diff line number Diff line change 3030
3131 // Assert
3232 var cb = cut .FindComponent <FluentCounterBadge >();
33- Assert .Equal (( ushort ?) 3 , cb .Instance .Count );
33+ Assert .Equal (3 , cb .Instance .Count );
3434 }
3535
3636 [Fact ]
3737 public void FluentCounterBadge_CountOutOfRange ()
3838 {
39- // Arrange && Act
40- var cut = Render (@< FluentCounterBadge Count = " 256" / > );
39+ // Arrange
40+ long c = (long )int .MaxValue + 1 ;
41+
42+ // Act
43+ var cut = Render (@< FluentCounterBadge Count = " @((int)c)" / > );
4144
4245 // Assert
4346 Assert .NotNull (cut .Find (" fluent-counter-badge" ));
4447 var count = cut .Find (" fluent-counter-badge" ).GetAttribute (" count" );
45- Assert .Equal ( " 256 " , count );
48+ Assert .Null ( count );
4649 }
4750
4851 [Theory ]
227230 var cut = Render (@< FluentCounterBadge Count = " 11" OverflowCount = " 10" / > );
228231 // Assert
229232 Assert .Equal (" 10" , cut .Find (" fluent-counter-badge" ).GetAttribute (" overflow-count" ));
233+ Assert .Equal (" 11" , cut .Find (" fluent-counter-badge" ).GetAttribute (" count" ));
230234 }
231235
232236 [Fact ]
403407 Assert .NotNull (cb );
404408 }
405409}
406-
407-
408-
You can’t perform that action at this time.
0 commit comments