-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathAttributes.razor
More file actions
70 lines (57 loc) · 1.53 KB
/
Attributes.razor
File metadata and controls
70 lines (57 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
@using TBM = BlazorWebFormsComponents.Enums.TextBoxMode
@code {
[Fact]
public void TextBox_WithMaxLength_RendersMaxLengthAttribute()
{
// Arrange & Act
var cut = Render(@<TextBox MaxLength="10" />);
// Assert
var input = cut.Find("input");
input.GetAttribute("maxlength").ShouldBe("10");
}
[Fact]
public void TextBox_WithColumns_RendersSizeAttribute()
{
// Arrange & Act
var cut = Render(@<TextBox Columns="20" />);
// Assert
var input = cut.Find("input");
input.GetAttribute("size").ShouldBe("20");
}
[Fact]
public void TextBox_ReadOnly_RendersReadonlyAttribute()
{
// Arrange & Act
var cut = Render(@<TextBox ReadOnly="true" Text="Cannot edit" />);
// Assert
var input = cut.Find("input");
input.HasAttribute("readonly").ShouldBeTrue();
}
[Fact]
public void TextBox_Disabled_RendersDisabledAttribute()
{
// Arrange & Act
var cut = Render(@<TextBox Enabled="false" Text="Disabled" />);
// Assert
var input = cut.Find("input");
input.HasAttribute("disabled").ShouldBeTrue();
}
[Fact]
public void TextBox_WithTabIndex_RendersTabIndexAttribute()
{
// Arrange & Act
var cut = Render(@<TextBox TabIndex="5" />);
// Assert
var input = cut.Find("input");
input.GetAttribute("tabindex").ShouldBe("5");
}
[Fact]
public void TextBox_MultiLineWithMaxLength_DoesNotRenderMaxLength()
{
// Arrange & Act
var cut = Render(@<TextBox TextMode="TBM.MultiLine" MaxLength="100" />);
// Assert
var textarea = cut.Find("textarea");
textarea.HasAttribute("maxlength").ShouldBeFalse();
}
}