Merge remote-tracking branch 'origin/v13/dev' into v14/dev

# Conflicts:
#	src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyValueEditor.cs
#	src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyEditor.cs
#	src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs
#	tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/DataValueEditorReuseTests.cs
#	version.json
This commit is contained in:
Bjarke Berg
2024-01-24 08:36:55 +01:00
34 changed files with 893 additions and 501 deletions

View File

@@ -1,5 +1,4 @@
using System.Linq;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
using Moq;
using NUnit.Framework;
using Umbraco.Cms.Core.IO;
@@ -16,6 +15,7 @@ public class DataValueEditorReuseTests
{
private Mock<IDataValueEditorFactory> _dataValueEditorFactoryMock;
private PropertyEditorCollection _propertyEditorCollection;
private DataValueReferenceFactoryCollection _dataValueReferenceFactories;
[SetUp]
public void SetUp()
@@ -32,6 +32,7 @@ public class DataValueEditorReuseTests
Mock.Of<IIOHelper>()));
_propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<IDataEditor>));
_dataValueReferenceFactories = new DataValueReferenceFactoryCollection(Enumerable.Empty<IDataValueReferenceFactory>);
_dataValueEditorFactoryMock
.Setup(m =>
@@ -40,6 +41,7 @@ public class DataValueEditorReuseTests
new DataEditorAttribute("a", "b", "c"),
new BlockListEditorDataConverter(Mock.Of<IJsonSerializer>()),
_propertyEditorCollection,
_dataValueReferenceFactories,
Mock.Of<IDataTypeService>(),
Mock.Of<IContentTypeService>(),
Mock.Of<ILocalizedTextService>(),
@@ -95,7 +97,7 @@ public class DataValueEditorReuseTests
{
var blockListPropertyEditor = new BlockListPropertyEditor(
_dataValueEditorFactoryMock.Object,
new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<IDataEditor>)),
_propertyEditorCollection,
Mock.Of<IIOHelper>(),
Mock.Of<IEditorConfigurationParser>(),
Mock.Of<IBlockValuePropertyIndexValueFactory>(),
@@ -117,7 +119,7 @@ public class DataValueEditorReuseTests
{
var blockListPropertyEditor = new BlockListPropertyEditor(
_dataValueEditorFactoryMock.Object,
new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<IDataEditor>)),
_propertyEditorCollection,
Mock.Of<IIOHelper>(),
Mock.Of<IEditorConfigurationParser>(),
Mock.Of<IBlockValuePropertyIndexValueFactory>(),

View File

@@ -176,14 +176,11 @@ public class DataValueReferenceFactoryCollectionTests
{
var collection = new DataValueReferenceFactoryCollection(Enumerable.Empty<IDataValueReferenceFactory>);
var propertyEditors = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<IDataEditor>));
var properties = new PropertyCollection();
var resultA = collection.GetAutomaticRelationTypesAliases(propertyEditors).ToArray();
var resultB = collection.GetAutomaticRelationTypesAliases(properties, propertyEditors).ToArray();
var result = collection.GetAllAutomaticRelationTypesAliases(propertyEditors).ToArray();
var expected = Constants.Conventions.RelationTypes.AutomaticRelationTypes;
CollectionAssert.AreEquivalent(expected, resultA, "Result A does not contain the expected relation type aliases.");
CollectionAssert.AreEquivalent(expected, resultB, "Result B does not contain the expected relation type aliases.");
CollectionAssert.AreEquivalent(expected, result, "Result does not contain the expected relation type aliases.");
}
[Test]
@@ -194,15 +191,11 @@ public class DataValueReferenceFactoryCollectionTests
var labelPropertyEditor = new LabelPropertyEditor(DataValueEditorFactory, IOHelper, EditorConfigurationParser);
var propertyEditors = new PropertyEditorCollection(new DataEditorCollection(() => labelPropertyEditor.Yield()));
var serializer = new ConfigurationEditorJsonSerializer();
var property = new Property(new PropertyType(ShortStringHelper, new DataType(labelPropertyEditor, serializer)));
var properties = new PropertyCollection { property, property }; // Duplicate on purpose to test distinct aliases
var resultA = collection.GetAutomaticRelationTypesAliases(propertyEditors).ToArray();
var resultB = collection.GetAutomaticRelationTypesAliases(properties, propertyEditors).ToArray();
var result = collection.GetAllAutomaticRelationTypesAliases(propertyEditors).ToArray();
var expected = Constants.Conventions.RelationTypes.AutomaticRelationTypes.Append("umbTest");
CollectionAssert.AreEquivalent(expected, resultA, "Result A does not contain the expected relation type aliases.");
CollectionAssert.AreEquivalent(expected, resultB, "Result B does not contain the expected relation type aliases.");
CollectionAssert.AreEquivalent(expected, result, "Result does not contain the expected relation type aliases.");
}
private class TestDataValueReferenceFactory : IDataValueReferenceFactory