File tree Expand file tree Collapse file tree 2 files changed +36
-35
lines changed
src/BootstrapBlazor/Components/EditorForm Expand file tree Collapse file tree 2 files changed +36
-35
lines changed Original file line number Diff line number Diff line change 33@inherits BootstrapComponentBase
44
55<div @attributes =" AdditionalAttributes" class =" @ClassString" >
6- < CascadingValue Value = " @_editorItems " IsFixed = " false " >
7- @FieldItems ?.Invoke(Model)
8- </ CascadingValue >
9- < CascadingValue Value = " this " Name = " EditorForm " >
10- <div class = " form-body " >
11- @if ( ShowUnsetGroupItemsOnTop )
12- {
13- if (UnsetGroupItems . Any () )
6+ @if ( Model != null )
7+ {
8+ < CascadingValue Value = " @_editorItems " IsFixed = " false " >
9+ @FieldItems ? . Invoke ( Model )
10+ </ CascadingValue >
11+ < CascadingValue Value = " this " Name = " EditorForm " >
12+ < div class = " form-body " >
13+ @ if (ShowUnsetGroupItemsOnTop )
1414 {
15- @RenderUnsetGroupItems
15+ if (UnsetGroupItems .Any ())
16+ {
17+ @RenderUnsetGroupItems
18+ }
19+ @foreach ( var g in GroupItems )
20+ {
21+ @RenderGroupItems(g)
22+ }
1623 }
17- @foreach ( var g in GroupItems )
24+ else
1825 {
19- @RenderGroupItems(g)
26+ @foreach ( var g in GroupItems )
27+ {
28+ @RenderGroupItems(g)
29+ }
30+ if (UnsetGroupItems .Any ())
31+ {
32+ @RenderUnsetGroupItems
33+ }
2034 }
21- }
22- else
35+ </div >
36+
37+ @if (Buttons != null )
2338 {
24- @foreach ( var g in GroupItems )
25- {
26- @RenderGroupItems(g)
27- }
28- if (UnsetGroupItems .Any ())
29- {
30- @RenderUnsetGroupItems
31- }
39+ <div class =" bb-editor-footer form-footer" >
40+ @Buttons
41+ </div >
3242 }
33- </div >
34-
35- @if (Buttons != null )
36- {
37- <div class =" bb-editor-footer form-footer" >
38- @Buttons
39- </div >
40- }
41- </CascadingValue >
43+ </CascadingValue >
44+ }
4245</div >
4346
4447@code
Original file line number Diff line number Diff line change @@ -51,13 +51,11 @@ public void CascadedEditContext_Ok()
5151 [ Fact ]
5252 public void Model_Error ( )
5353 {
54- Assert . ThrowsAny < ArgumentNullException > ( ( ) =>
54+ var cut = Context . RenderComponent < EditorForm < Foo > > ( pb =>
5555 {
56- Context . RenderComponent < EditorForm < Foo > > ( pb =>
57- {
58- pb . Add ( a => a . Model , null ) ;
59- } ) ;
56+ pb . Add ( a => a . Model , null ) ;
6057 } ) ;
58+ Assert . Equal ( "<div class=\" bb-editor\" ></div>" , cut . Markup ) ;
6159 }
6260
6361 [ Fact ]
You can’t perform that action at this time.
0 commit comments