Merge remote-tracking branch 'origin/v11/dev' into v12/dev

This commit is contained in:
Bjarke Berg
2023-03-20 08:41:29 +01:00
88 changed files with 4481 additions and 1099 deletions

View File

@@ -114,9 +114,9 @@
}
},
"node_modules/@sideway/formula": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz",
"integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz",
"integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==",
"dev": true
},
"node_modules/@sideway/pinpoint": {
@@ -1055,9 +1055,9 @@
}
},
"@sideway/formula": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz",
"integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz",
"integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==",
"dev": true
},
"@sideway/pinpoint": {

View File

@@ -0,0 +1,26 @@
using Moq;
using NUnit.Framework;
using Umbraco.Cms.Core.Strings;
using Umbraco.Extensions;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Extensions;
[TestFixture]
public class HtmlEncodedStringExtensionsTests
{
[TestCase(null, false, true)]
[TestCase("", false, true)]
[TestCase(" ", false, true)]
[TestCase("This is a non-empty string", false, false)]
[TestCase("<p>This is a non-empty string</p>", true,false)]
[TestCase("<p>This is a non-empty string</p>", false,false)]
[TestCase("<p></p>", true, true)]
[TestCase("<p></p>", false, false)]
public void IsNullOrWhiteSpace(string? htmlString, bool stripHtml, bool expectedResult)
{
var htmlEncodedString = htmlString == null ? null : Mock.Of<IHtmlEncodedString>(x => x.ToHtmlString() == htmlString);
var result = htmlEncodedString.IsNullOrWhiteSpace(stripHtml: stripHtml);
Assert.AreEqual(expectedResult, result);
}
}

View File

@@ -4,9 +4,11 @@ using System.Globalization;
using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Moq;
using NUnit.Framework;
using Umbraco.Cms.Core.Actions;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Dictionary;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Mapping;
@@ -266,7 +268,8 @@ public class ContentControllerTests
Mock.Of<ICoreScopeProvider>(),
Mock.Of<IAuthorizationService>(),
Mock.Of<IContentVersionService>(),
Mock.Of<ICultureImpactFactory>());
Mock.Of<ICultureImpactFactory>(),
new OptionsWrapper<ContentSettings>(new ContentSettings()));
return controller;
}

View File

@@ -396,4 +396,25 @@ asdfsdf
@"<?UMBRACO_MACRO macroAlias=""Test"" content=""1089"" textArea=""asdfasdf"" title="""" bool=""0"" number="""" contentType="""" multiContentType="""" multiProperties="""" properties="""" tabs="""" multiTabs="""" />",
result);
}
[Test]
public void Format_RTE_WhenMacroContainsParameter_EnableInlineMacro_WithValue_1_ItShouldBeInASpan()
{
var content = @"<p>asdfasdf</p>
<p>asdfsadf</p>
<?UMBRACO_MACRO macroAlias=""My.Map.isCool eh[boy!]"" test1=""value1"" enableInlineMacro=""1""/>
<p>asdfasdf</p>";
var result = MacroTagParser.FormatRichTextPersistedDataForEditor(
content,
new Dictionary<string, string> { { "test1", "value1" }, { "enableInlineMacro", "1"} });
Assert.AreEqual(
@"<p>asdfasdf</p>
<p>asdfsadf</p>
<span class=""umb-macro-holder inlined-macro mceNonEditable"" test1=""value1"" enableInlineMacro=""1"">
<!-- <?UMBRACO_MACRO macroAlias=""My.Map.isCool eh[boy!]"" test1=""value1"" enableInlineMacro=""1"" /> -->
<ins>Macro alias: <strong>My.Map.isCool eh[boy!]</strong></ins></span>
<p>asdfasdf</p>".StripNewLines(),
result.StripNewLines());
}
}