Merge branch 'release/16.4' into v16/dev

This commit is contained in:
Jacob Overgaard
2025-11-24 16:28:24 +01:00
18 changed files with 345 additions and 161 deletions

View File

@@ -417,3 +417,22 @@ test('can add a variant block element with invariant RTE Tiptap in the content',
await umbracoApi.documentType.ensureNameNotExists(customElementTypeName);
await umbracoApi.language.ensureNameNotExists('Danish');
});
// Tests regression issue: https://github.com/umbraco/Umbraco-CMS/issues/20680
test('can move away from a content node with a block grid after making no changes without seeing discard unsaved changes', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, elementTypeId, true, true);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
await umbracoUi.goToBackOffice();
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
await umbracoUi.content.goToContentWithName(contentName);
// Act
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);
// Assert
// We do this to make sure that there is no discard changes button visible, if the discard changes was visible, we would not be able to go to the document type
await umbracoUi.documentType.goToDocumentType(documentTypeName);
});

View File

@@ -364,3 +364,21 @@ test('can add a variant block element with invariant RTE Tiptap in the content',
await umbracoApi.documentType.ensureNameNotExists(customElementTypeName);
await umbracoApi.language.ensureNameNotExists('Danish');
});
// Tests regression issue: https://github.com/umbraco/Umbraco-CMS/issues/20680
test('can move away from a content node with a block list after making no changes without seeing discard unsaved changes', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, elementTypeId);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
await umbracoUi.goToBackOffice();
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
await umbracoUi.content.goToContentWithName(contentName);
// Act
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);
// Assert
// We do this to make sure that there is no discard changes button visible, if the discard changes was visible, we would not be able to go to the document type
await umbracoUi.documentType.goToDocumentType(documentTypeName);
});

View File

@@ -10,6 +10,7 @@ using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Configuration;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Migrations;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Scoping;
using Umbraco.Cms.Core.Services;
@@ -38,6 +39,7 @@ internal sealed class AdvancedMigrationTests : UmbracoIntegrationTest
private IServiceScopeFactory ServiceScopeFactory => GetRequiredService<IServiceScopeFactory>();
private DistributedCache DistributedCache => GetRequiredService<DistributedCache>();
private IDatabaseCacheRebuilder DatabaseCacheRebuilder => GetRequiredService<IDatabaseCacheRebuilder>();
private IPublishedContentTypeFactory PublishedContentTypeFactory => GetRequiredService<IPublishedContentTypeFactory>();
private IMigrationPlanExecutor MigrationPlanExecutor => new MigrationPlanExecutor(
CoreScopeProvider,
ScopeAccessor,
@@ -48,7 +50,8 @@ internal sealed class AdvancedMigrationTests : UmbracoIntegrationTest
DistributedCache,
Mock.Of<IKeyValueService>(),
ServiceScopeFactory,
AppCaches.NoCache);
AppCaches.NoCache,
PublishedContentTypeFactory);
[Test]
public async Task CreateTableOfTDtoAsync()

View File

@@ -110,15 +110,16 @@ public class RichTextPropertyEditorHelperTests
Assert.IsNull(value.Blocks);
}
[Test]
public void Can_Parse_Blocks_With_Both_Content_And_Settings()
[TestCase(Constants.PropertyEditors.Aliases.RichText)]
[TestCase("Umbraco.TinyMCE")]
public void Can_Parse_Blocks_With_Both_Content_And_Settings(string propertyEditorAlias)
{
const string input = """
string input = """
{
"markup": "<p>this is some markup</p><umb-rte-block data-content-key=\"36cc710a-d8a6-45d0-a07f-7bbd8742cf02\"><!--Umbraco-Block--></umb-rte-block>",
"blocks": {
"layout": {
"Umbraco.RichText": [{
"[PropertyEditorAlias]": [{
"contentKey": "36cc710a-d8a6-45d0-a07f-7bbd8742cf02",
"settingsKey": "d2eeef66-4111-42f4-a164-7a523eaffbc2"
}
@@ -143,6 +144,7 @@ public class RichTextPropertyEditorHelperTests
}
}
""";
input = input.Replace("[PropertyEditorAlias]", propertyEditorAlias);
var result = RichTextPropertyEditorHelper.TryParseRichTextEditorValue(input, JsonSerializer(), Logger(), out RichTextEditorValue? value);
Assert.IsTrue(result);
@@ -180,6 +182,12 @@ public class RichTextPropertyEditorHelperTests
Assert.AreEqual("settingsPropertyAlias", settingsProperties.First().Alias);
Assert.AreEqual("A settings property value", settingsProperties.First().Value);
});
Assert.IsTrue(value.Blocks.Layout.ContainsKey(Constants.PropertyEditors.Aliases.RichText));
var layout = value.Blocks.Layout[Constants.PropertyEditors.Aliases.RichText];
Assert.AreEqual(1, layout.Count());
Assert.AreEqual(Guid.Parse("36cc710a-d8a6-45d0-a07f-7bbd8742cf02"), layout.First().ContentKey);
Assert.AreEqual(Guid.Parse("d2eeef66-4111-42f4-a164-7a523eaffbc2"), layout.First().SettingsKey);
}
[Test]

View File

@@ -12,6 +12,7 @@ using NUnit.Framework;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;
@@ -85,7 +86,8 @@ public class MigrationPlanTests
distributedCache,
Mock.Of<IKeyValueService>(),
Mock.Of<IServiceScopeFactory>(),
appCaches);
appCaches,
Mock.Of<IPublishedContentTypeFactory>());
var plan = new MigrationPlan("default")
.From(string.Empty)