File tree Expand file tree Collapse file tree 3 files changed +27
-5
lines changed
LinkDotNet.Blog.Infrastructure/Persistence/Sql
LinkDotNet.Blog.Web/Shared/Skills
tests/LinkDotNet.Blog.IntegrationTests/Web/Shared/Skills Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -70,4 +70,4 @@ public async ValueTask DeleteAsync(string id)
70
70
await blogDbContext . SaveChangesAsync ( ) ;
71
71
}
72
72
}
73
- }
73
+ }
Original file line number Diff line number Diff line change 25
25
<td >@skillCapabilityGroup.Key </td >
26
26
@foreach ( var skillLevel in ProficiencyLevel .All )
27
27
{
28
- <td @ondrop =" @(() => HandleDrop(skillLevel))" >
28
+ <td @ondrop =" @(() => HandleDrop(skillLevel))" class = " proficiency-level " >
29
29
@foreach ( var skill in skillCapabilityGroup .Where (s => s .ProficiencyLevel == skillLevel ))
30
30
{
31
31
@if (IsAuthenticated )
32
32
{
33
- <div draggable =" true" @ondrag =" @(() => currentDragItem = skill)" style =" cursor : grab " >
34
- <SkillTag Skill =" @skill" IsAuthenticated =" @true" DeleteSkill =" @(() =>
35
- DeleteSkill(skill))" />
33
+ <div draggable =" true" @ondrag =" @(() => currentDragItem = skill)" style =" cursor : grab "
34
+ class =" skill-tag" >
35
+ <SkillTag Skill =" @skill"
36
+ IsAuthenticated =" @true"
37
+ DeleteSkill =" @(() => DeleteSkill(skill))" />
36
38
</div >
37
39
}
38
40
else
Original file line number Diff line number Diff line change @@ -77,4 +77,24 @@ public async Task ShouldNotAllowToEditSkillTagsWhenNotAdmin()
77
77
cut . WaitForState ( ( ) => cut . FindComponents < SkillTag > ( ) . Any ( ) ) ;
78
78
cut . FindComponent < SkillTag > ( ) . Instance . IsAuthenticated . Should ( ) . BeFalse ( ) ;
79
79
}
80
+
81
+ [ Fact ]
82
+ public async Task ShouldUpdateProficiencyWhenSkillTagDragged ( )
83
+ {
84
+ using var ctx = new TestContext ( ) ;
85
+ var skill = new SkillBuilder ( ) . WithProficiencyLevel ( ProficiencyLevel . Familiar ) . Build ( ) ;
86
+ await DbContext . AddAsync ( skill ) ;
87
+ await DbContext . SaveChangesAsync ( ) ;
88
+ ctx . Services . AddScoped < IRepository < Skill > > ( _ => Repository ) ;
89
+ ctx . Services . AddScoped ( _ => Mock . Of < IToastService > ( ) ) ;
90
+ var cut = ctx . RenderComponent < SkillTable > ( p =>
91
+ p . Add ( s => s . IsAuthenticated , true ) ) ;
92
+ cut . WaitForElement ( ".skill-tag" ) ;
93
+
94
+ cut . FindAll ( ".skill-tag" ) [ 0 ] . Drag ( ) ;
95
+ cut . FindAll ( ".proficiency-level" ) [ 1 ] . Drop ( ) ;
96
+
97
+ var skillFromDb = await Repository . GetByIdAsync ( skill . Id ) ;
98
+ skillFromDb . ProficiencyLevel . Should ( ) . Be ( ProficiencyLevel . Proficient ) ;
99
+ }
80
100
}
You can’t perform that action at this time.
0 commit comments