diff --git a/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/Controllers/ContentControllerTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/Controllers/ContentControllerTests.cs index ab2acf9825..486a5c094d 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/Controllers/ContentControllerTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/Controllers/ContentControllerTests.cs @@ -406,5 +406,41 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Web.BackOffice.Controllers CollectionAssert.Contains(display.Errors.Keys, "_content_variant_en-US_null_"); }); } + + [Test] + public async Task PostSave_Validates_Domains() + { + ILocalizationService localizationService = GetRequiredService(); + localizationService.Save(new LanguageBuilder() + .WithCultureInfo("da-DK") + .WithIsDefault(false) + .Build()); + + IContentTypeService contentTypeService = GetRequiredService(); + var contentType = new ContentTypeBuilder().WithContentVariation(ContentVariation.Culture).Build(); + contentTypeService.Save(contentType); + + var content = new ContentBuilder() + .WithId(1) + .WithContentType(contentType) + .WithCultureName("en-US", "Root") + .WithCultureName("da-DK", "Rod") + .Build(); + + var model = new ContentItemSaveBuilder() + .WithContent(content) + .WithAction(ContentSaveAction.PublishNew) + .Build(); + + string url = PrepareApiControllerUrl(x => x.PostSave(null)); + + HttpResponseMessage response = await Client.PostAsync(url, new MultipartFormDataContent + { + { new StringContent(JsonConvert.SerializeObject(model)), "contentItem" } + }); + string body = await response.Content.ReadAsStringAsync(); + body = body.TrimStart(AngularJsonMediaTypeFormatter.XsrfPrefix); + ContentItemDisplay display = JsonConvert.DeserializeObject(body); + } } }