commite0aa430d4cAuthor: Paul Johnson <pmj@umbraco.com> Date: Thu May 19 10:00:57 2022 +0100 Fix typo in pipeline yaml commit2ec450f2d6Author: Paul Johnson <pmj@umbraco.com> Date: Thu May 19 09:14:47 2022 +0100 Fix yaml conditions commitc2d548039aAuthor: Paul Johnson <pmj@umbraco.com> Date: Thu May 19 09:02:50 2022 +0100 Azure pipeline refactor (#12428) * Skip symbols for Umbraco.Templates * Resolve some test issues + Fixed whitespace dependant tests to pass regardless of build OS vs run OS. + Snap dictionary tests were failing when Configuration was release + Removed hardcoded baseUrl from one of the acceptance tests * Move docfx setup to ./build and fix * Update UI docs title * Added dockerfile that can be used when running the acceptance tests. * Take explicit dependency on System.Security.Cryptography.Pkcs * Refactor ci/cd pipeline commitee8359af75Author: Mole <nikolajlauridsen@protonmail.ch> Date: Thu May 19 09:57:21 2022 +0200 V10: Reintroduce appsettings-schema.json (#12416) * Reintroduce language files tests (#12367) * Reintroducing language files tests * Fix casing * Update tests/Umbraco.Tests.UnitTests/Umbraco.Core/EmbeddedResources/LanguageXmlTests.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Change Umbraco.Cms and Umbraco.Templates nuspecs to csproj * Remove Umbraco.Templates from VerifyNuGet step * Remove duplicate and unnecessary properties * Generate json schema on build * Add targets file * Gitignore auto generated appsettings schema * Fix build not copying file * Use the new path in appsettings * Update copy message * Build json schema as release * Update json schema options Otherwise just running the project will put the file in the wrong place * Generate schema if it doesn't exist in Web.Ui * Update json schema options Otherwise just running the project will put the file in the wrong place Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: Ronald Barendse <ronald@barend.se> commitdd617ede80Author: Ronald Barendse <ronald@barend.se> Date: Thu May 19 09:51:11 2022 +0200 v10: Change Umbraco.Cms and Umbraco.Templates nuspecs to csproj (#12413) * Reintroduce language files tests (#12367) * Reintroducing language files tests * Fix casing * Update tests/Umbraco.Tests.UnitTests/Umbraco.Core/EmbeddedResources/LanguageXmlTests.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Change Umbraco.Cms and Umbraco.Templates nuspecs to csproj * Remove Umbraco.Templates from VerifyNuGet step * Remove duplicate and unnecessary properties Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> commitb83216876fAuthor: Ronald Barendse <ronald@barend.se> Date: Thu May 19 08:36:04 2022 +0200 v10: Project template database/connection string improvements (#12407) * Add new connection-string-provider-name parameter * Use template value forms to correctly encode JSON values * Add new development-database-type parameter * Update package template and fix App_Plugins directory rename * Remove conflicting short parameter name * Lowercase framework parameter to align with MS templates * Cleanup default template settings * Write unattended install parameters when either connection string or development database is set * Include RootNamespace in UmbracoPackage template * Update Umbraco specific gitignore rules * Revert "Lowercase framework parameter to align with MS templates" This reverts commit 22de389272a7e119df569ec2e54190265f6d0ae0. * Add exclude-gitignore parameter * Update template schemas * Add minimal-gitignore parameter commite40049dcf1Author: Mole <nikolajlauridsen@protonmail.ch> Date: Wed May 18 15:22:51 2022 +0200 Fix domain for invariant content nodes (#12405) Co-authored-by: Elitsa Marinovska <elm@umbraco.dk> commita3692b887aAuthor: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Date: Mon May 9 11:42:10 2022 +0200 Use SnippetCollection to when working with snippets (#12355) * Introducing a new Snippet type * Adding a SnippetCollection and SnippetCollectionBuilder * Using snippetCollection to get the snippets instead of fileService * Fixed fetching the correct content * Make ISnippet non-discoverable * Split the SnippetCollection into PartialViewSnippetCollection and PartialViewMacroSnippetCollection * Update CodeFileController to use the 2 snippet collections * Display the names with Empty.cshtml on top * Remove merging embedded snippets with custom snippets from ~\Umbraco.Web.UI\umbraco\PartialViewMacros\Templates folder for the Partial View Collection * Fix naming * Fix another naming * Cleanup + Use base items Co-authored-by: Bjarke Berg <mail@bergmania.dk> (cherry picked from commit9326cc5fc6) commit4f48a4937bAuthor: patrickdemooij9 <patrickdemooij98@hotmail.com> Date: Fri Oct 8 11:18:00 2021 +0200 Cherry picked from4c08b44684commit4fdbfee597Author: Bjarne Fyrstenborg <bjarne_fyrstenborg@hotmail.com> Date: Wed May 11 00:51:37 2022 +0200 Show nicer overlay when clicking block card for deleted element type (#12140) * Show nicer overlay when clicking block card for deleted element type * Cleanup * Remove stop-scrolling container * Use flex-start instead on start * Remove legacy flexbox fallback * Remove unnecessary hack * Use standard gap property instead * Localization of message * Fix translation * End sentence with a dot (cherry picked from commitebb1dc21a9) commit3856bf8288Author: Henk Jan Pluim <henkjan.pluim@greenchoice.nl> Date: Mon Apr 25 10:02:06 2022 +0200 #fix 12254 return emptyresult (cherry picked from commit7993d19c1b) commit7087c3d9f6Author: Ronald Barendse <ronald@barend.se> Date: Tue May 17 12:59:01 2022 +0200 v10: Use ForceCreateDatabase during unattended install and extend GetUmbracoConnectionString extension methods (#12397) * Add extension methods to get the Umbraco connection string/provider name from configuration * Added tests for configuration extension methods. * Fix issue with InstallMissingDatabase and ForceCreateDatabase * Fix comments * Revert casing change in GenerateConnectionString * Re-add AddOptions (without config binding) to fix test * Update src/Umbraco.Core/Configuration/Models/ConnectionStrings.cs Co-authored-by: Ronald Barendse <ronald@barend.se> * Update src/Umbraco.Core/Configuration/Models/ConnectionStrings.cs * Update src/Umbraco.Infrastructure/Runtime/RuntimeState.cs * Whitespace and documentation updates * Add DatabaseProviderMetadataExtensions * Filter before ordering * Replace DataDirectory placeholder when setting connection string Co-authored-by: Andy Butland <abutland73@gmail.com> Co-authored-by: Bjarke Berg <mail@bergmania.dk> (cherry picked from commit8e6e262c7f) commite90bf26577Author: Ronald Barendse <ronald@barend.se> Date: Tue May 17 07:33:54 2022 +0200 v10: Support System.Data.SqlClient provider name (#12408) * Add support for System.Data.SqlClient provider name * Only update connection string when required (cherry picked from commite82bcb1b76) commitfd0637c96dAuthor: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Date: Mon May 16 14:23:59 2022 +0200 Reintroduce language files tests (#12367) * Reintroducing language files tests * Fix casing * Update tests/Umbraco.Tests.UnitTests/Umbraco.Core/EmbeddedResources/LanguageXmlTests.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> (cherry picked from commit2ed71a64ec)
378 lines
13 KiB
C#
378 lines
13 KiB
C#
// Copyright (c) Umbraco.
|
||
// See LICENSE for more details.
|
||
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using NUnit.Framework;
|
||
using Umbraco.Cms.Infrastructure.Macros;
|
||
using Umbraco.Cms.Tests.Common.Extensions;
|
||
using Umbraco.Cms.Tests.Common.TestHelpers;
|
||
|
||
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Web.Common.Macros
|
||
{
|
||
[TestFixture]
|
||
public class MacroParserTests
|
||
{
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_With_No_Macros()
|
||
{
|
||
string content = @"<p>hello world</p>";
|
||
string result = MacroTagParser.FormatRichTextContentForPersistence(content);
|
||
Assert.AreEqual(@"<p>hello world</p>", content);
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_With_Non_AlphaNumeric_Char_In_Alias()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO macroAlias=""My.Map.isCool eh[boy!]"" />
|
||
<p>asdfasdf</p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""My.Map.isCool eh[boy!]"" /> -->
|
||
<ins>Macro alias: <strong>My.Map.isCool eh[boy!]</strong></ins></div>
|
||
<p>asdfasdf</p>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO macroAlias=""Map"" />
|
||
<p>asdfasdf</p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""Map"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfasdf</p>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_Closing_Tag()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO macroAlias=""Map"" ></?UMBRACO_MACRO>
|
||
<p>asdfasdf</p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""Map"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfasdf</p>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_With_Params()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" />
|
||
<p>asdfasdf</p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfasdf</p>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_With_Params_When_MacroAlias_Not_First()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO test1=""value1"" test2=""value2"" macroAlias=""Map"" />
|
||
<p>asdfasdf</p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO test1=""value1"" test2=""value2"" macroAlias=""Map"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfasdf</p>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_With_Params_When_MacroAlias_Is_First()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" />
|
||
<p>asdfasdf</p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfasdf</p>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_With_Params_When_Multiple_Macros()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO test1=""value1"" test2=""value2"" macroAlias=""Map"" />
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO test1=""value1"" macroAlias=""Map"" test2=""value2"" />
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" />
|
||
<p>asdfasdf</p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO test1=""value1"" test2=""value2"" macroAlias=""Map"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO test1=""value1"" macroAlias=""Map"" test2=""value2"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfasdf</p>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_With_Multiple_Macros()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<?UMBRACO_MACRO macroAlias=""Breadcrumb"" />
|
||
<p>asdfsadf</p>
|
||
<p> </p>
|
||
<?UMBRACO_MACRO macroAlias=""login"" />
|
||
<p> </p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>());
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""Breadcrumb"" /> -->
|
||
<ins>Macro alias: <strong>Breadcrumb</strong></ins></div>
|
||
<p>asdfsadf</p>
|
||
<p> </p>
|
||
<div class=""umb-macro-holder mceNonEditable"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""login"" /> -->
|
||
<ins>Macro alias: <strong>login</strong></ins></div>
|
||
<p> </p>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Persistence_Multiline_Parameters()
|
||
{
|
||
string content = @"<html>
|
||
<body>
|
||
<h1>asdfasdf</h1>
|
||
<div class='umb-macro-holder mceNonEditable' att1='asdf' att2='asdfasdfasdf' att3=""sdfsdfd"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""myMacro"" param1=""test1"" param2=""test2
|
||
dfdsfds"" /> -->
|
||
asdfasdf
|
||
asdfas
|
||
<span>asdfasdfasdf</span>
|
||
<p>asdfasdf</p>
|
||
</div>
|
||
<span>asdfdasf</span>
|
||
<div>
|
||
asdfsdf
|
||
</div>
|
||
</body>
|
||
</html>";
|
||
string result = MacroTagParser.FormatRichTextContentForPersistence(content);
|
||
|
||
Assert.AreEqual(
|
||
@"<html>
|
||
<body>
|
||
<h1>asdfasdf</h1>
|
||
<?UMBRACO_MACRO macroAlias=""myMacro"" param1=""test1"" param2=""test2
|
||
dfdsfds"" />
|
||
<span>asdfdasf</span>
|
||
<div>
|
||
asdfsdf
|
||
</div>
|
||
</body>
|
||
</html>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_With_Params_Closing_Tag()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" ></?UMBRACO_MACRO>
|
||
<p>asdfasdf</p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfasdf</p>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_With_Params_Closing_Tag_And_Content()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" ><img src='blah.jpg'/></?UMBRACO_MACRO>
|
||
<p>asdfasdf</p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfasdf</p>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Editor_With_Multiline_Parameters()
|
||
{
|
||
string content = @"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2
|
||
test"" />
|
||
<p>asdfasdf</p>";
|
||
string result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2\r\ntest" } });
|
||
|
||
Assert.AreEqual(
|
||
@"<p>asdfasdf</p>
|
||
<p>asdfsadf</p>
|
||
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2
|
||
test"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2
|
||
test"" /> -->
|
||
<ins>Macro alias: <strong>Map</strong></ins></div>
|
||
<p>asdfasdf</p>".NoCrLf(),
|
||
result.NoCrLf());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Persistence()
|
||
{
|
||
string content = @"<html>
|
||
<body>
|
||
<h1>asdfasdf</h1>
|
||
<div class='umb-macro-holder mceNonEditable' att1='asdf' att2='asdfasdfasdf' att3=""sdfsdfd"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""myMacro"" param1=""test1"" param2=""test2"" /> -->
|
||
asdfasdf
|
||
asdfas
|
||
<span>asdfasdfasdf</span>
|
||
<p>asdfasdf</p>
|
||
</div>
|
||
<span>asdfdasf</span>
|
||
<div>
|
||
asdfsdf
|
||
</div>
|
||
</body>
|
||
</html>";
|
||
string result = MacroTagParser.FormatRichTextContentForPersistence(content);
|
||
|
||
Assert.AreEqual(
|
||
@"<html>
|
||
<body>
|
||
<h1>asdfasdf</h1>
|
||
<?UMBRACO_MACRO macroAlias=""myMacro"" param1=""test1"" param2=""test2"" />
|
||
<span>asdfdasf</span>
|
||
<div>
|
||
asdfsdf
|
||
</div>
|
||
</body>
|
||
</html>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Persistence_No_Class()
|
||
{
|
||
string content = @"<html>
|
||
<body>
|
||
<h1>asdfasdf</h1>
|
||
<div att1='asdf' att2='asdfasdfasdf' att3=""sdfsdfd"">
|
||
<!-- <?UMBRACO_MACRO macroAlias=""myMacro"" param1=""test1"" param2=""test2"" /> -->
|
||
asdfasdf
|
||
asdfas
|
||
<span>asdfasdfasdf</span>
|
||
<p>asdfasdf</p>
|
||
</div>
|
||
<span>asdfdasf</span>
|
||
<div>
|
||
asdfsdf
|
||
</div>
|
||
</body>
|
||
</html>";
|
||
string result = MacroTagParser.FormatRichTextContentForPersistence(content);
|
||
|
||
Assert.AreEqual(
|
||
@"<html>
|
||
<body>
|
||
<h1>asdfasdf</h1>
|
||
<?UMBRACO_MACRO macroAlias=""myMacro"" param1=""test1"" param2=""test2"" />
|
||
<span>asdfdasf</span>
|
||
<div>
|
||
asdfsdf
|
||
</div>
|
||
</body>
|
||
</html>".StripNewLines(),
|
||
result.StripNewLines());
|
||
}
|
||
|
||
[Test]
|
||
public void Format_RTE_Data_For_Persistence_Custom_Single_Entry()
|
||
{
|
||
string content = @"<div class=""umb-macro-holder mceNonEditable umb-macro-mce_1""><!-- <?UMBRACO_MACRO macroAlias=""Test"" content=""1089"" textArea=""asdfasdf"" title="""" bool=""0"" number="""" contentType="""" multiContentType="""" multiProperties="""" properties="""" tabs="""" multiTabs="""" /> --><ins>
|
||
<div class=""facts-box"">
|
||
<div class=""fatcs-box-header"">
|
||
<h3>null</h3>
|
||
</div>
|
||
<div class=""fatcs-box-body"">1089</div>
|
||
</div>
|
||
</ins></div>";
|
||
string result = MacroTagParser.FormatRichTextContentForPersistence(content);
|
||
|
||
Assert.AreEqual(@"<?UMBRACO_MACRO macroAlias=""Test"" content=""1089"" textArea=""asdfasdf"" title="""" bool=""0"" number="""" contentType="""" multiContentType="""" multiProperties="""" properties="""" tabs="""" multiTabs="""" />", result);
|
||
}
|
||
}
|
||
}
|