diff --git a/cypress/integration/e2e/2-admin-actions_spec.js b/cypress/integration/e2e/2-admin-actions_spec.js index 19ee857..c6d9e6d 100644 --- a/cypress/integration/e2e/2-admin-actions_spec.js +++ b/cypress/integration/e2e/2-admin-actions_spec.js @@ -38,7 +38,7 @@ describe('Admin create/edit/delete flows', () => { // author username cy.root().should('contain', 'AdminUser'); // severity - cy.root().should('contain', 'high'); + cy.root().should('contain', 'High'); // body text cy.root().should('contain', bodyText); }); @@ -56,12 +56,26 @@ describe('Admin create/edit/delete flows', () => { // verify issue contents cy.get('.IssueView-content').within(() => { // severity - cy.root().should('contain', 'low'); + cy.root().should('contain', 'Low'); // body text cy.root().should('contain', bodyText); }); }); + it('Close issue', () => { + // issue should start open + cy.get('.IssueView-content').contains('Open'); + + // click close button + cy.get('[data-testid="closeIssue"]').click(); + + // verify issue is closed + cy.get('.IssueView-content').contains('Closed'); + + // verify close button is gone + cy.get('[data-testid="closeIssue"]').should('not.exist'); + }); + it('Delete issue', () => { cy.get('[data-testid="deleteIssue"]').click(); // did we navigate? we deleted the only issue, and should be back on diff --git a/server/src/graphql/resolvers.ts b/server/src/graphql/resolvers.ts index e043943..6904342 100644 --- a/server/src/graphql/resolvers.ts +++ b/server/src/graphql/resolvers.ts @@ -354,6 +354,10 @@ export default (db: any) => { throw new Error(`Insufficient Permissions. (required ${ PermissionLevel.Create }, had ${ level })`); } + if (args.status) { + args.status = args.status.toLowerCase(); + } + return new db.Issue({ ...args, creator: ctx.state.user.id, diff --git a/src/components/Issue/Segments.tsx b/src/components/Issue/Segments.tsx index 68168f6..df2130e 100644 --- a/src/components/Issue/Segments.tsx +++ b/src/components/Issue/Segments.tsx @@ -9,6 +9,8 @@ interface Props extends HTMLAttributes { children: any; } +const capitalize = (str: string) => `${str[0].toUpperCase()}${str.slice(1)}`; + export default ({ issue, children, ...props }: Props) => { const renderTitle = () => (

{issue.title}

@@ -30,8 +32,9 @@ export default ({ issue, children, ...props }: Props) => {
-

{issue.type} | {issue.severity}

-

{issue.status}

+ {/* capitalize first letter of each field*/} +

{capitalize(issue.type)} | {capitalize(issue.severity)}

+

{capitalize(issue.status)}

);