mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing shape display when casting to Shape explicitly
--HG-- branch : 1.x
This commit is contained in:
@@ -79,12 +79,14 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
dynamic shapeHelperFactory = _container.Resolve<IShapeFactory>();
|
||||
|
||||
var result1 = displayHelperFactory.Something();
|
||||
var result2 = ((DisplayHelper)displayHelperFactory).ShapeExecute((Shape)shapeHelperFactory.Pager());
|
||||
var result2 = ((DisplayHelper)displayHelperFactory).ShapeExecute(shapeHelperFactory.Pager());
|
||||
var result3 = ((DisplayHelper)displayHelperFactory).ShapeExecute((Shape)shapeHelperFactory.Pager());
|
||||
|
||||
displayHelperFactory(shapeHelperFactory.Pager());
|
||||
|
||||
Assert.That(result1.ToString(), Is.EqualTo("<br/>"));
|
||||
Assert.That(result2.ToString(), Is.EqualTo("<div>hello</div>"));
|
||||
Assert.That(result3.ToString(), Is.EqualTo("<div>hello</div>"));
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,6 +3,7 @@ using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
|
||||
namespace Orchard.DisplayManagement.Implementation {
|
||||
|
||||
@@ -71,6 +72,11 @@ namespace Orchard.DisplayManagement.Implementation {
|
||||
return ShapeExecute(shape);
|
||||
}
|
||||
|
||||
public object ShapeExecute(Shape shape) {
|
||||
// disambiguates the call to ShapeExecute(object) as Shape also implements IEnumerable
|
||||
return ShapeExecute((object) shape);
|
||||
}
|
||||
|
||||
public object ShapeExecute(object shape) {
|
||||
if (shape == null) {
|
||||
return new HtmlString(string.Empty);
|
||||
|
Reference in New Issue
Block a user