@@ -177,4 +177,28 @@ public void ShouldAcceptInputWithoutLosingFocusOrEnter()
177
177
blogPost . Tags . Should ( ) . HaveCount ( 3 ) ;
178
178
blogPost . Tags . Select ( t => t . Content ) . Should ( ) . Contain ( new [ ] { "Tag1" , "Tag2" , "Tag3" } ) ;
179
179
}
180
+
181
+ [ Theory ]
182
+ [ InlineData ( "short" , "b" , true , "**" , "**Test**" ) ]
183
+ [ InlineData ( "short" , "i" , true , "*" , "*Test*" ) ]
184
+ [ InlineData ( "short" , "b" , false , "**" , "Test" ) ]
185
+ [ InlineData ( "short" , "f" , false , "**" , "Test" ) ]
186
+ [ InlineData ( "content" , "b" , true , "**" , "**Test**" ) ]
187
+ [ InlineData ( "content" , "i" , true , "*" , "*Test*" ) ]
188
+ [ InlineData ( "content" , "b" , false , "**" , "Test" ) ]
189
+ [ InlineData ( "content" , "f" , false , "**" , "Test" ) ]
190
+ public void ShouldSetMarkerOnKeyUp ( string id , string key , bool ctrlPressed , string fence , string expected )
191
+ {
192
+ var markerMock = new Mock < IMarkerService > ( ) ;
193
+ markerMock . Setup ( m => m . GetNewMarkdownForElementAsync ( id , "Test" , fence , fence ) )
194
+ . ReturnsAsync ( expected ) ;
195
+ Services . AddScoped ( _ => markerMock . Object ) ;
196
+ var cut = RenderComponent < CreateNewBlogPost > ( ) ;
197
+ cut . Find ( $ "#{ id } ") . Input ( "Test" ) ;
198
+ cut . Find ( $ "#{ id } ") . KeyUp ( key , ctrlKey : ctrlPressed ) ;
199
+
200
+ var content = cut . Find ( $ "#{ id } ") . TextContent ;
201
+
202
+ content . Should ( ) . Be ( expected ) ;
203
+ }
180
204
}
0 commit comments