diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElementCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElementCollection.cs index 075db3f074..58caac22e4 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElementCollection.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElementCollection.cs @@ -5,6 +5,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { internal class NotDynamicXmlDocumentElementCollection : ConfigurationElementCollection, IEnumerable { + internal void Add(NotDynamicXmlDocumentElement element) + { + BaseAdd(element); + } + protected override ConfigurationElement CreateNewElement() { return new NotDynamicXmlDocumentElement(); diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs index 240d193a2d..c79f1d1d63 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs @@ -8,7 +8,26 @@ namespace Umbraco.Core.Configuration.UmbracoSettings [ConfigurationProperty("notDynamicXmlDocumentElements", IsDefaultCollection = true)] public NotDynamicXmlDocumentElementCollection NotDynamicXmlDocumentElements { - get { return (NotDynamicXmlDocumentElementCollection) base["notDynamicXmlDocumentElements"]; } + get + { + //here we need to check if this element is defined, if it is not then we'll setup the defaults + var prop = Properties["notDynamicXmlDocumentElements"]; + var autoFill = this[prop] as ConfigurationElement; + if (autoFill != null && autoFill.ElementInformation.IsPresent == false) + { + var collection = new NotDynamicXmlDocumentElementCollection + { + new NotDynamicXmlDocumentElement {RawValue = "p"}, + new NotDynamicXmlDocumentElement {RawValue = "div"}, + new NotDynamicXmlDocumentElement {RawValue = "ul"}, + new NotDynamicXmlDocumentElement {RawValue = "span"} + }; + + return collection; + } + + return (NotDynamicXmlDocumentElementCollection)base["notDynamicXmlDocumentElements"]; + } } [ConfigurationCollection(typeof (RazorStaticMappingCollection), AddItemName = "mapping")] diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ScriptingElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ScriptingElementTests.cs index e5db045f09..8c6c675a35 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/ScriptingElementTests.cs +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ScriptingElementTests.cs @@ -4,6 +4,22 @@ using NUnit.Framework; namespace Umbraco.Tests.Configurations.UmbracoSettings { + [TestFixture] + public class ScriptingElementDefaultTests : ScriptingElementTests + { + protected override bool TestingDefaults + { + get { return true; } + } + + [Test] + public override void DataTypeModelStaticMappings() + { + Assert.AreEqual(0, Section.Scripting.Razor.DataTypeModelStaticMappings.Count); + } + + } + [TestFixture] public class ScriptingElementTests : UmbracoSettingsTests { @@ -15,7 +31,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings } [Test] - public void DataTypeModelStaticMappings() + public virtual void DataTypeModelStaticMappings() { var mappings = Section.Scripting.Razor.DataTypeModelStaticMappings.ToArray(); Assert.IsTrue(mappings[0].DataTypeGuid == Guid.Parse("A3DB4034-BCB0-4E69-B3EE-DD4E6ECA74C2")); diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config index 67523b840b..4133f25e18 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config @@ -48,26 +48,6 @@ Mvc - - - - - p - div - ul - span - - - MyName.1 - MyName.2 - MyName.3 - MyName.4 - MyName.5 - MyName.6 - - - -