FIX: Make category slug validation less strict (#8915)

This was changed recently and caused issues saving old categories which
already had digits at the beginning of the slug (for example, '30-days').
This commit is contained in:
Dan Ungureanu
2020-02-11 17:01:12 +02:00
committed by GitHub
parent 902d0e1e3a
commit ecaf2c2f4e
6 changed files with 17 additions and 13 deletions

View File

@ -17,13 +17,13 @@ QUnit.test("slugFor", assert => {
);
slugFor(
store.createRecord("category", { id: 123, slug: "" }),
"-",
"It returns - for empty slugs"
"123-category",
"It returns id-category for empty strings"
);
slugFor(
store.createRecord("category", { id: 456 }),
"-",
"It returns - for undefined slugs"
"456-category",
"It returns id-category for undefined slugs"
);
slugFor(
store.createRecord("category", { slug: "熱帶風暴畫眉" }),
@ -46,14 +46,14 @@ QUnit.test("slugFor", assert => {
slugFor(
store.createRecord("category", { id: 555, parentCategory: parentCategory }),
"darth/-",
"darth/555-category",
"it uses the parent slug before the child and then uses id"
);
parentCategory.set("slug", null);
slugFor(
store.createRecord("category", { id: 555, parentCategory: parentCategory }),
"-/-",
"345-category/555-category",
"it uses the parent before the child and uses ids for both"
);
});