mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
Merge pull request #16482 from strapi/feautre/rw-colors
This commit is contained in:
commit
6fc31d84bd
@ -270,10 +270,25 @@ describeOnCondition(edition === 'EE')('Review workflows', () => {
|
||||
];
|
||||
});
|
||||
|
||||
test("It should assign a default color to stages if they don't have one", async () => {
|
||||
await requests.admin.put(`/admin/review-workflows/workflows/${testWorkflow.id}/stages`, {
|
||||
body: {
|
||||
data: [defaultStage, { id: secondStage.id, name: 'new_name', color: '#000000' }],
|
||||
},
|
||||
});
|
||||
|
||||
const workflowRes = await requests.admin.get(
|
||||
`/admin/review-workflows/workflows/${testWorkflow.id}?populate=*`
|
||||
);
|
||||
|
||||
expect(workflowRes.status).toBe(200);
|
||||
expect(workflowRes.body.data.stages[0].color).toBe('#4945FF');
|
||||
expect(workflowRes.body.data.stages[1].color).toBe('#000000');
|
||||
});
|
||||
test("It shouldn't be available for public", async () => {
|
||||
const stagesRes = await requests.public.put(
|
||||
`/admin/review-workflows/workflows/${testWorkflow.id}/stages`,
|
||||
stagesUpdateData
|
||||
{ body: { data: stagesUpdateData } }
|
||||
);
|
||||
const workflowRes = await requests.public.get(
|
||||
`/admin/review-workflows/workflows/${testWorkflow.id}`
|
||||
|
||||
@ -24,6 +24,11 @@ module.exports = {
|
||||
type: 'string',
|
||||
configurable: false,
|
||||
},
|
||||
color: {
|
||||
type: 'string',
|
||||
configurable: false,
|
||||
default: '#4945FF',
|
||||
},
|
||||
workflow: {
|
||||
type: 'relation',
|
||||
target: 'admin::workflow',
|
||||
|
||||
@ -5,6 +5,7 @@ const { yup, validateYupSchema } = require('@strapi/utils');
|
||||
const stageObject = yup.object().shape({
|
||||
id: yup.number().integer().min(1),
|
||||
name: yup.string().max(255).required(),
|
||||
color: yup.string().matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i), // hex color
|
||||
});
|
||||
|
||||
const validateUpdateStagesSchema = yup
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user