-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ContentPartFIeldDefinition Settings.ToObject Deserialization (#16774
) --------- Co-authored-by: Mike Alhayek <[email protected]>
- Loading branch information
1 parent
f5b335d
commit fc65471
Showing
23 changed files
with
716 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
test/OrchardCore.Tests/Modules/OrchardCore.ContentFields/Settings/DisplayDriverTestHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using OrchardCore.ContentManagement.Metadata.Builders; | ||
using OrchardCore.ContentManagement.Metadata.Models; | ||
using OrchardCore.ContentTypes.Editors; | ||
using OrchardCore.DisplayManagement; | ||
using OrchardCore.DisplayManagement.Handlers; | ||
using OrchardCore.DisplayManagement.Views; | ||
using OrchardCore.DisplayManagement.Zones; | ||
|
||
namespace OrchardCore.Tests.Modules.OrchardCore.ContentFields.Settings; | ||
|
||
public class DisplayDriverTestHelper | ||
{ | ||
public static ContentPartDefinition GetContentPartDefinition<TField>(Action<ContentPartFieldDefinitionBuilder> configuration) | ||
{ | ||
return new ContentPartDefinitionBuilder() | ||
.Named("SomeContentPart") | ||
.WithField<TField>("SomeField", configuration) | ||
.Build(); | ||
} | ||
|
||
public static Task<ShapeResult> GetShapeResultAsync<TDriver>(IShapeFactory factory, ContentPartDefinition contentDefinition) | ||
where TDriver : IContentPartFieldDefinitionDisplayDriver, new() | ||
=> GetShapeResultAsync(factory, contentDefinition, new TDriver()); | ||
|
||
public static async Task<ShapeResult> GetShapeResultAsync(IShapeFactory factory, ContentPartDefinition contentDefinition, IContentPartFieldDefinitionDisplayDriver driver) | ||
{ | ||
var partFieldDefinition = contentDefinition.Fields.First(); | ||
|
||
var partFieldDefinitionShape = await factory.CreateAsync("ContentPartFieldDefinition_Edit", () => | ||
ValueTask.FromResult<IShape>(new ZoneHolding(() => factory.CreateAsync("ContentZone")))); | ||
partFieldDefinitionShape.Properties["ContentField"] = partFieldDefinition; | ||
|
||
var editorContext = new BuildEditorContext(partFieldDefinitionShape, "", false, "", factory, null, null); | ||
|
||
var result = await driver.BuildEditorAsync(partFieldDefinition, editorContext); | ||
await result.ApplyAsync(editorContext); | ||
|
||
return (ShapeResult)result; | ||
} | ||
} |
Oops, something went wrong.