-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Andrea-gli/play
add testing snippet area
- Loading branch information
Showing
9 changed files
with
234 additions
and
77 deletions.
There are no files selected for viewing
108 changes: 51 additions & 57 deletions
108
src/client/components/composer/NewRequest/TestEntryForm.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/client/components/composer/NewRequest/TestSnippets/RestTestSnippets.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* eslint-disable jsx-a11y/no-static-element-interactions */ | ||
/* eslint-disable jsx-a11y/click-events-have-key-events */ | ||
import React from "react"; | ||
|
||
export default function RestTestSnippets(props) { | ||
const { setNewTestContent, setShowTests } = props; | ||
|
||
const snippets = { | ||
"Status code: Code is 200": | ||
"assert.strictEqual(response.status, 200, 'response is 200')", | ||
|
||
"Access the cookies from the response object": | ||
"assert.exists(response.cookies, 'cookies exists on response object')", | ||
}; | ||
|
||
const handleClickOne = () => { | ||
setShowTests(true); | ||
setNewTestContent(snippets["Status code: Code is 200"]); | ||
}; | ||
|
||
const handleClickTwo = () => { | ||
setShowTests(true); | ||
setNewTestContent(snippets["Access the cookies from the response object"]); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<span onClick={handleClickOne}>Status code: Code is 200</span>; | ||
<br /> | ||
<span onClick={handleClickTwo}> | ||
Access the cookies from the response object | ||
</span> | ||
; | ||
</div> | ||
); | ||
} |
64 changes: 64 additions & 0 deletions
64
src/client/components/composer/NewRequest/TestSnippets/RestTestSnippetsContainer.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* eslint-disable jsx-a11y/no-static-element-interactions */ | ||
/* eslint-disable jsx-a11y/click-events-have-key-events */ | ||
import React, { useState } from "react"; | ||
import dropDownArrow from "../../../../../assets/icons/caret-down-tests.svg"; | ||
|
||
import dropDownArrowUp from "../../../../../assets/icons/caret-up-tests.svg"; | ||
|
||
import RestTestSnippets from "./RestTestSnippets"; | ||
|
||
export default function RestTestSnippetsContainer(props) { | ||
console.log("propsssss=>", props); | ||
const { setShowTests, testContent, setNewTestContent } = props; | ||
const [showSnippets, setShowSnippets] = useState(false); | ||
|
||
const handleShowSnippets = () => { | ||
setShowSnippets(!showSnippets); | ||
}; | ||
return ( | ||
<div> | ||
<div | ||
className="is-rest-invert show-hide-tests cards-dropdown minimize-card is-flex is-align-items-center is-justify-content-center" | ||
onClick={handleShowSnippets} | ||
> | ||
{showSnippets === true && ( | ||
<> | ||
<span>Test Snippets</span> | ||
<span className="icon is-medium is-align-self-center show-hide-tests-icon"> | ||
<img | ||
alt="" | ||
src={dropDownArrowUp} | ||
className="is-awesome-icon" | ||
aria-hidden="false" | ||
/> | ||
</span> | ||
</> | ||
)} | ||
|
||
{showSnippets === false && ( | ||
<> | ||
<span>Test Snippets</span> | ||
<span className="icon is-medium is-align-self-center show-hide-tests-icon"> | ||
<img | ||
alt="" | ||
src={dropDownArrow} | ||
className="is-awesome-icon" | ||
aria-hidden="false" | ||
/> | ||
</span> | ||
</> | ||
)} | ||
</div> | ||
|
||
{showSnippets === true && ( | ||
<div id="test-snippets"> | ||
<RestTestSnippets | ||
testContent={testContent} | ||
setNewTestContent={setNewTestContent} | ||
setShowTests={setShowTests} | ||
/> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.