Skip to content

Commit be84586

Browse files
committed
refactor: 更改扩展方法名
1 parent f853d2d commit be84586

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/BootstrapBlazor/Extensions/ObjectExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static bool IsNumber(this Type t)
6060
/// </summary>
6161
/// <param name="t"></param>
6262
/// <returns></returns>
63-
public static bool ShouldRenderInputNumber(this Type t)
63+
public static bool IsNumberWithDotSeparator(this Type t)
6464
{
6565
var separator = CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalSeparator;
6666
if (separator != ".")

src/BootstrapBlazor/Utils/Utility.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ private static Type GenerateComponentType(IEditorItem item)
638638
{
639639
ret = typeof(NullSwitch);
640640
}
641-
else if (fieldType.ShouldRenderInputNumber())
641+
else if (fieldType.IsNumberWithDotSeparator())
642642
{
643643
ret = typeof(BootstrapInputNumber<>).MakeGenericType(fieldType);
644644
}
@@ -704,7 +704,7 @@ private static Dictionary<string, object> CreateMultipleAttributes(Type fieldTyp
704704
ret.Add("rows", item.Rows);
705705
}
706706
}
707-
else if (type.ShouldRenderInputNumber())
707+
else if (type.IsNumberWithDotSeparator())
708708
{
709709
if (!string.IsNullOrEmpty(item.Step))
710710
{

test/UnitTest/Extensions/ObjectExtensionsTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ public void IsNumber_Culture()
4949
{
5050
var culture = new CultureInfo("es-ES");
5151
CultureInfo.CurrentCulture = culture;
52-
Assert.False(typeof(long).IsNumber());
52+
Assert.True(typeof(long).IsNumber());
53+
Assert.False(typeof(long).IsNumberWithDotSeparator());
5354

5455
culture = new CultureInfo("en-US");
5556
CultureInfo.CurrentCulture = culture;
5657
Assert.True(typeof(long).IsNumber());
58+
Assert.True(typeof(long).IsNumberWithDotSeparator());
5759
}
5860

5961
[Theory]

0 commit comments

Comments
 (0)