mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Allowing the '/' in slugs.
- Also moved the RoutableServiceTests to a more appropriate location --HG-- branch : dev
This commit is contained in:
@@ -101,7 +101,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Common\Providers\CommonPartProviderTests.cs" />
|
||||
<Compile Include="Common\Services\RoutableServiceTests.cs" />
|
||||
<Compile Include="Routable\Services\RoutableServiceTests.cs" />
|
||||
<Compile Include="Feeds\Controllers\FeedControllerTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Scheduling\ScheduledTaskManagerTests.cs" />
|
||||
|
@@ -24,7 +24,7 @@ using System.Web.Routing;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Core.Tests.Common.Services {
|
||||
namespace Orchard.Core.Tests.Routable.Services {
|
||||
[TestFixture]
|
||||
public class RoutableServiceTests : DatabaseEnabledTestsBase {
|
||||
[SetUp]
|
||||
@@ -60,12 +60,17 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
|
||||
var thing = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
|
||||
t.As<RoutePart>().Record = new RoutePartRecord();
|
||||
t.Title = "Please do not use any of the following characters in your slugs: \":\", \"/\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\"";
|
||||
t.Title = "Please do not use any of the following characters in your slugs: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\"";
|
||||
});
|
||||
|
||||
_routableService.FillSlugFromTitle(thing.As<RoutePart>());
|
||||
|
||||
Assert.That(thing.Slug, Is.EqualTo("please-do-not-use-any-of-the-following-characters-in-your-slugs-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\""));
|
||||
Assert.That(thing.Slug, Is.EqualTo("please-do-not-use-any-of-the-following-characters-in-your-slugs-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\""));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SlashInSlugIsAllowed() {
|
||||
Assert.That(_routableService.IsSlugValid("some/page"), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -80,7 +85,7 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
public void InvalidCharacterShouldBeRefusedInSlugs() {
|
||||
Assert.That(_routableService.IsSlugValid("aaaa-_aaaa"), Is.True);
|
||||
|
||||
foreach (var c in @"/:?#[]@!$&'()*+,;= ") {
|
||||
foreach (var c in @":?#[]@!$&'()*+,;= ") {
|
||||
Assert.That(_routableService.IsSlugValid("a" + c + "b"), Is.False);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user