Skip to content

Commit

Permalink
fixed changes
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed May 12, 2024
1 parent 1f02d13 commit 1299f6e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 20 deletions.
22 changes: 11 additions & 11 deletions cypress/e2e/53_workspaceMission.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ describe('Create Workspace And Update Mission', () => {
cy.login('carol');
cy.wait(1000);

const WorkSpaceName = 'Workspace Mission5';
const WorkSpaceName = 'Workspace Mission';

const workspace = {
loggedInAs: 'carol',
Expand All @@ -19,12 +19,14 @@ describe('Create Workspace And Update Mission', () => {
cy.contains(workspace.name).contains('Manage').click();
cy.wait(1000);

cy.get('[data-testid="mission-link"]').then(($link: JQuery<HTMLElement>) => {
const modifiedHref = $link.attr('href');
cy.wrap($link).invoke('removeAttr', 'target');
cy.wrap($link).click();
cy.url().should('include', modifiedHref);
});
cy.get('[data-testid="mission-link"]')
.invoke('show')
.then(($link: JQuery<HTMLElement>) => {
const modifiedHref = $link.attr('href');
cy.wrap($link).invoke('removeAttr', 'target');
cy.wrap($link).click();
cy.url().should('include', modifiedHref);
});
cy.wait(1000);

cy.contains('No mission yet');
Expand All @@ -36,18 +38,16 @@ describe('Create Workspace And Update Mission', () => {
const missionStatment = 'This is my Mission';
cy.get('[data-testid="mission-textarea"]').type(missionStatment);
cy.get('[data-testid="mission-update-btn"]').click();
cy.get('[data-testid="mission-cancel-btn"]').click();

cy.get('[data-testid="tactics-option-btn"]').click();
cy.get('[data-testid="tactics-edit-btn"]').click();

const tacticsStatment = 'This is my Tactics';
cy.get('[data-testid="tactics-textarea"]').type(tacticsStatment);
cy.get('[data-testid="tactics-update-btn"]').click();
cy.get('[data-testid="tactics-cancel-btn"]').click();

cy.contains(missionStatment);
cy.contains(tacticsStatment);
cy.contains(missionStatment).should('exist', { timeout: 1000 });
cy.contains(tacticsStatment).should('exist', { timeout: 1000 });

cy.logout('carol');
});
Expand Down
2 changes: 1 addition & 1 deletion src/people/widgetViews/WorkspaceDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ const WorkspaceDetails = (props: {
style={{
textDecoration: 'none',
color: 'inherit',
display: 'block'
display: 'none'
}}
target="_blank"
data-testid="mission-link"
Expand Down
42 changes: 34 additions & 8 deletions src/people/widgetViews/WorkspaceMission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,32 @@ const OptionsWrap = styled.div`
`;

const TextArea = styled.textarea`
border: 0.5px solid #000000;
padding: 12px 20px;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
border: 2px solid #dde1e5;
outline: none;
caret-color: #618aff;
color: #3c3f41;
font-family: 'Barlow';
font-size: 1rem;
font-style: normal;
font-weight: 500;
line-height: 20px;
width: 100%;
margin-top: 10px;
border-radius: 5px;
resize: none;
min-height: 5.9375rem;
::placeholder {
color: #b0b7bc;
font-family: 'Barlow';
font-size: 13px;
font-style: normal;
font-weight: 400;
line-height: 20px;
}
:focus {
border: 2px solid #82b4ff;
}
`;

const ButtonWrap = styled.div`
Expand Down Expand Up @@ -206,8 +227,11 @@ const WorkspaceMission = () => {
setDidplayMission(false);
};

const missionChange = (e: any) => {
setMission(e.target.value);
const missionChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
const newValue = e.target.value;
if (newValue.length) {
setMission(newValue);
}
};

const tacticsChange = (e: any) => {
Expand All @@ -222,6 +246,7 @@ const WorkspaceMission = () => {
};
await main.workspaceUpdateMission(body);
await getWorkspaceData();
setEditMission(false);
};

const submitTactics = async () => {
Expand All @@ -232,6 +257,7 @@ const WorkspaceMission = () => {
};
await main.workspaceUpdateTactics(body);
await getWorkspaceData();
setEditTactics(false);
};

return (
Expand Down Expand Up @@ -298,7 +324,7 @@ const WorkspaceMission = () => {
<TextArea
placeholder="Enter mission"
onChange={missionChange}
value={mission}
value={mission ?? workspaceData?.mission}
data-testid="mission-textarea"
/>
<ButtonWrap>
Expand Down Expand Up @@ -347,7 +373,7 @@ const WorkspaceMission = () => {
<TextArea
placeholder="Enter tactics"
onChange={tacticsChange}
value={tactics}
value={tactics ?? workspaceData?.tactics}
data-testid="tactics-textarea"
/>
<ButtonWrap>
Expand Down

0 comments on commit 1299f6e

Please sign in to comment.