* insert umb rte block web component in rte * First stab at moving the RTE markup to a nested "markup" property in the property value. * initial work * only rewrite markup * transform RTE into component * parse scope in grid.rte * revert use a fallback instead * block insertion and sync in place * block picker partly impl * remove test of old controller * remove test of old controller * block with block data * proper block with api connection * remove log * styling * Persist blocks data (still a temporary solution) * styling allows for interaction * block actions * tinyMCE styling * paste feature * prevalue display Inline toggle * inline mode in RTE * todo note * fixes wording * preparation for editor communication * remove val-server-match for now * clean up blocks that does not belong in markup * remove blocks not used in the markup * liveEditing * displayAsBlock formatting * clean up * TODO note * Serverside handling for RTE blocks (incl. refactor of Block List and Block Grid) * ensure rich text loads after block editor * trigger resize on block init * Handle RTE blocks output in Delivery API * sanitize ng classes * simplify calls to init blocks * move sanitisation * make validation work * only warn when missing one * clean up * remove validation border as it does not work * more clean up * add unsupported block entry editor * Revert breaking functionality for Block List and Grid * prevent re-inits of blocks * make sure delete blocks triggers an update * Refactor RichTextPropertyIndexValueFactory to index values from blocks + clean up RichTextPropertyEditor dependencies * first working cursor solution * inline element approach * Handle both inline and block level blocks * Fix the RTE block parser regex so it handles multiple inline blocks. * Fix reference and tags tracking, add tests, make the editor backwards compatible and make deploy happy * Use RichTextPropertyEditorHelper serialization in tests * Ensure correct model in Block Grid value converter (incl unit test to prove it) * do not include umbblockpicker in grid * make blocks the new default, instead of macros * only send value of body from DOMParser * Blocks of deleted ElementTypes shows unsupported * do not edit a unsupported block * remove trying to be smart on the init * fix missing culture issue * set dirty * alert when no blocks * Revert "make blocks the new default, instead of macros" This reverts commit 283e8aa473fdfde075197d34aa47e35dfc64a8ae. --------- Co-authored-by: kjac <kja@umbraco.dk>
65 lines
2.7 KiB
C#
65 lines
2.7 KiB
C#
using Moq;
|
|
using Umbraco.Cms.Core.Models.PublishedContent;
|
|
using Umbraco.Cms.Core.PublishedCache;
|
|
|
|
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.PropertyEditors;
|
|
|
|
public abstract class BlockPropertyValueConverterTestsBase<TPropertyEditorConfig>
|
|
{
|
|
protected abstract string PropertyEditorAlias { get; }
|
|
|
|
protected const string ContentAlias1 = "Test1";
|
|
protected const string ContentAlias2 = "Test2";
|
|
protected const string SettingAlias1 = "Setting1";
|
|
protected const string SettingAlias2 = "Setting2";
|
|
|
|
protected Guid ContentKey1 { get; } = Guid.NewGuid();
|
|
|
|
protected Guid ContentKey2 { get; } = Guid.NewGuid();
|
|
|
|
protected Guid SettingKey1 { get; } = Guid.NewGuid();
|
|
|
|
protected Guid SettingKey2 { get; } = Guid.NewGuid();
|
|
|
|
/// <summary>
|
|
/// Setup mocks for IPublishedSnapshotAccessor
|
|
/// </summary>
|
|
protected IPublishedSnapshotAccessor GetPublishedSnapshotAccessor()
|
|
{
|
|
var test1ContentType = Mock.Of<IPublishedContentType>(x =>
|
|
x.IsElement == true
|
|
&& x.Key == ContentKey1
|
|
&& x.Alias == ContentAlias1);
|
|
var test2ContentType = Mock.Of<IPublishedContentType>(x =>
|
|
x.IsElement == true
|
|
&& x.Key == ContentKey2
|
|
&& x.Alias == ContentAlias2);
|
|
var test3ContentType = Mock.Of<IPublishedContentType>(x =>
|
|
x.IsElement == true
|
|
&& x.Key == SettingKey1
|
|
&& x.Alias == SettingAlias1);
|
|
var test4ContentType = Mock.Of<IPublishedContentType>(x =>
|
|
x.IsElement == true
|
|
&& x.Key == SettingKey2
|
|
&& x.Alias == SettingAlias2);
|
|
var contentCache = new Mock<IPublishedContentCache>();
|
|
contentCache.Setup(x => x.GetContentType(ContentKey1)).Returns(test1ContentType);
|
|
contentCache.Setup(x => x.GetContentType(ContentKey2)).Returns(test2ContentType);
|
|
contentCache.Setup(x => x.GetContentType(SettingKey1)).Returns(test3ContentType);
|
|
contentCache.Setup(x => x.GetContentType(SettingKey2)).Returns(test4ContentType);
|
|
var publishedSnapshot = Mock.Of<IPublishedSnapshot>(x => x.Content == contentCache.Object);
|
|
var publishedSnapshotAccessor =
|
|
Mock.Of<IPublishedSnapshotAccessor>(x => x.TryGetPublishedSnapshot(out publishedSnapshot));
|
|
return publishedSnapshotAccessor;
|
|
}
|
|
|
|
protected IPublishedPropertyType GetPropertyType(TPropertyEditorConfig config)
|
|
{
|
|
var dataType = new PublishedDataType(1, "test", new Lazy<object>(() => config));
|
|
var propertyType = Mock.Of<IPublishedPropertyType>(x =>
|
|
x.EditorAlias == PropertyEditorAlias
|
|
&& x.DataType == dataType);
|
|
return propertyType;
|
|
}
|
|
}
|