Skip to content

Commit f4cace4

Browse files
committed
Added Test for skill table drag and drop
1 parent 4f83a7e commit f4cace4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/LinkDotNet.Blog.IntegrationTests/Web/Shared/Skills/SkillTableTests.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,24 @@ public async Task ShouldUpdateProficiencyWhenSkillTagDragged()
9494
var skillFromDb = await Repository.GetByIdAsync(skill.Id);
9595
skillFromDb.ProficiencyLevel.Should().Be(ProficiencyLevel.Proficient);
9696
}
97+
98+
[Fact]
99+
public async Task ShouldStayOnSameProficiencyWhenDroppedOnSameProficiencyLevel()
100+
{
101+
using var ctx = new TestContext();
102+
var skill = new SkillBuilder().WithProficiencyLevel(ProficiencyLevel.Familiar).Build();
103+
await DbContext.AddAsync(skill);
104+
await DbContext.SaveChangesAsync();
105+
ctx.Services.AddScoped<IRepository<Skill>>(_ => Repository);
106+
ctx.Services.AddScoped(_ => Mock.Of<IToastService>());
107+
var cut = ctx.RenderComponent<SkillTable>(p =>
108+
p.Add(s => s.IsAuthenticated, true));
109+
cut.WaitForState(() => cut.FindAll(".skill-tag").Any());
110+
111+
cut.FindAll(".skill-tag")[0].Drag();
112+
cut.FindAll(".proficiency-level")[0].Drop();
113+
114+
var skillFromDb = await Repository.GetByIdAsync(skill.Id);
115+
skillFromDb.ProficiencyLevel.Should().Be(ProficiencyLevel.Familiar);
116+
}
97117
}

0 commit comments

Comments
 (0)