Browse Source

Removed ViewComponentType

pull/13082/head
malik masis 4 years ago
parent
commit
0b3319b8d9
  1. 4
      modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/CmsKitContentWidgetOptions.cs
  2. 9
      modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentWidgetConfig.cs
  3. 12
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentParser_Test.cs

4
modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/CmsKitContentWidgetOptions.cs

@ -11,8 +11,8 @@ public class CmsKitContentWidgetOptions
WidgetConfigs = new();
}
public void AddWidgetConfig(string name, ContentWidgetConfig contentWidgetConfig)
public void AddWidget(string widgetName, string widgetKey)
{
WidgetConfigs.Add(name, contentWidgetConfig);
WidgetConfigs.Add(widgetName, new ContentWidgetConfig(widgetKey));
}
}

9
modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentWidgetConfig.cs

@ -1,14 +1,11 @@
using System;
namespace Volo.CmsKit.Contents;
namespace Volo.CmsKit.Contents;
public class ContentWidgetConfig
{
public string Name { get; }
public Type ViewComponentType { get; set; } //TODO: Remove this
public ContentWidgetConfig(string name) //TODO: widgetName
public ContentWidgetConfig(string widgetName)
{
Name = name;
Name = widgetName;
}
}

12
modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentParser_Test.cs

@ -20,8 +20,8 @@ public class ContentParser_Test : CmsKitDomainTestBase
[Fact]
public async Task ParseAsync_ShouldWorkWithDifferentWidgetTypes()
{
_options.Value.AddWidgetConfig(testData.PollName, new ContentWidgetConfig(testData.WidgetName));
_options.Value.AddWidgetConfig("ImageGallery", new ContentWidgetConfig("ImageGallery"));//test
_options.Value.AddWidget(testData.PollName, testData.WidgetName);
_options.Value.AddWidget("ImageGallery", "ImageGallery");
contentParser = new ContentParser(_options);
var content = @"**ABP Framework** is completely open source and developed in a community-driven manner.
@ -54,7 +54,7 @@ public class ContentParser_Test : CmsKitDomainTestBase
[Fact]
public async Task ParseAsync_ShouldWorkWithWrongConfigOptions()
{
_options.Value.AddWidgetConfig(testData.WidgetName, new ContentWidgetConfig(testData.PollName));
_options.Value.AddWidget(testData.WidgetName, testData.PollName);
contentParser = new ContentParser(_options);
var content = @"**ABP Framework** is completely open source and developed in a community-driven manner.
@ -70,7 +70,7 @@ public class ContentParser_Test : CmsKitDomainTestBase
[Fact]
public async Task ParseAsync_ShouldWorkWithWrongWidgetType()
{
_options.Value.AddWidgetConfig(testData.PollName, new ContentWidgetConfig(testData.WidgetName));
_options.Value.AddWidget(testData.PollName, testData.WidgetName);
contentParser = new ContentParser(_options);
var content = @"**ABP Framework** is completely open source and developed in a community-driven manner.
@ -86,7 +86,7 @@ public class ContentParser_Test : CmsKitDomainTestBase
[Fact]
public async Task ParseAsync_ShouldWorkWithWrongPollName()
{
_options.Value.AddWidgetConfig(testData.PollName, new ContentWidgetConfig(testData.WidgetName));
_options.Value.AddWidget(testData.PollName, testData.WidgetName);
contentParser = new ContentParser(_options);
var content = @"**ABP Framework** is completely open source and developed in a community-driven manner.
@ -103,7 +103,7 @@ public class ContentParser_Test : CmsKitDomainTestBase
[MemberData(nameof(ExampleData))]
public async Task ParseAsync_ShouldWorkProperlyWithCorrectInputs(string content, int expectedLine)
{
_options.Value.AddWidgetConfig(testData.PollName, new ContentWidgetConfig(testData.WidgetName));
_options.Value.AddWidget(testData.PollName, testData.WidgetName);
contentParser = new ContentParser(_options);
var widgets = await contentParser.ParseAsync(content);

Loading…
Cancel
Save