Merge branch 'v8hackathon-library-delete' of https://github.com/AnthonyCogworks/Umbraco-CMS into temp8-2746

This commit is contained in:
Stephan
2018-07-09 13:02:25 +02:00
5 changed files with 14 additions and 1575 deletions

View File

@@ -65,85 +65,6 @@ namespace Umbraco.Tests.Misc
Container.RegisterCollectionBuilder<PropertyValueConverterCollectionBuilder>();
}
[Test]
public void Json_To_Xml_Object()
{
var json = "{ id: 1, name: 'hello', children: [{id: 2, name: 'child1'}, {id:3, name: 'child2'}]}";
var result = library.JsonToXml(json);
Assert.AreEqual(@"<json>
<id>1</id>
<name>hello</name>
<children>
<id>2</id>
<name>child1</name>
</children>
<children>
<id>3</id>
<name>child2</name>
</children>
</json>".CrLf(), result.Current.OuterXml.CrLf());
}
[Test]
public void Json_To_Xml_Array()
{
var json = "[{id: 2, name: 'child1'}, {id:3, name: 'child2'}]";
var result = library.JsonToXml(json);
Assert.AreEqual(@"<json>
<arrayitem>
<id>2</id>
<name>child1</name>
</arrayitem>
<arrayitem>
<id>3</id>
<name>child2</name>
</arrayitem>
</json>".CrLf(), result.Current.OuterXml.CrLf());
}
[Test]
public void Json_To_Xml_Error()
{
var json = "{ id: 1, name: 'hello', children: }";
var result = library.JsonToXml(json);
Assert.IsTrue(result.Current.OuterXml.StartsWith("<error>"));
}
[Test]
public void Get_Item_User_Property()
{
var val = library.GetItem(1173, "content");
var legacyVal = LegacyGetItem(1173, "content");
Assert.AreEqual(legacyVal, val);
Assert.AreEqual("<div>This is some content</div>", val);
}
[Test]
public void Get_Item_Document_Property()
{
//first test a single static val
var val = library.GetItem(1173, "template");
var legacyVal = LegacyGetItem(1173, "template");
Assert.AreEqual(legacyVal, val);
Assert.AreEqual("1234", val);
//now test them all to see if they all match legacy
foreach(var s in new[]{"id","parentID","level","writerID","template","sortOrder","createDate","updateDate","nodeName","writerName","path"})
{
val = library.GetItem(1173, s);
legacyVal = LegacyGetItem(1173, s);
Assert.AreEqual(legacyVal, val);
}
}
[Test]
public void Get_Item_Invalid_Property()
{
var val = library.GetItem(1173, "dontfindme");
var legacyVal = LegacyGetItem(1173, "dontfindme");
Assert.AreEqual(legacyVal, val);
Assert.AreEqual("", val);
}
/// <summary>
/// The old method, just using this to make sure we're returning the correct exact data as before.

View File

@@ -60,7 +60,9 @@ namespace umbraco
if (_fieldName.StartsWith("#"))
{
_fieldContent = library.GetDictionaryItem(_fieldName.Substring(1, _fieldName.Length - 1));
var umbHelper = new UmbracoHelper(Current.UmbracoContext, Current.Services, Current.ApplicationCache);
_fieldContent = umbHelper.GetDictionaryValue(_fieldName.Substring(1, _fieldName.Length - 1));
}
else
{

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,8 @@ using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.Composing;
using Umbraco.Web._Legacy.BusinessLogic;
using Umbraco.Web;
namespace umbraco.presentation.umbraco.translation {
public partial class details : Umbraco.Web.UI.Pages.UmbracoEnsuredPage {
@@ -49,7 +51,11 @@ namespace umbraco.presentation.umbraco.translation {
//pp_totalWords.Text = Services.TextService.Localize("translation/totalWords");
lt = new Literal();
lt.Text = library.ReplaceLineBreaks(t.Comment);
var umbHelper = new UmbracoHelper(Current.UmbracoContext, Current.Services, Current.ApplicationCache);
lt.Text = umbHelper.ReplaceLineBreaksForHtml(t.Comment);
pp_comment.Controls.Add(lt);
pp_comment.Text = Services.TextService.Localize("comment");

View File

@@ -124,7 +124,9 @@ namespace umbraco.presentation.webservices
AuthorizeRequest(true);
return library.NiceUrl(nodeId);
var umbHelper = new UmbracoHelper(Current.UmbracoContext, Current.Services, Current.ApplicationCache);
return umbHelper.Url(nodeId);
}
[WebMethod]