-
Notifications
You must be signed in to change notification settings - Fork 14
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 #50 from tryretool/bb/add-testing
Add testing framework
- Loading branch information
Showing
4 changed files
with
1,106 additions
and
12 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -69,6 +69,10 @@ You will also see any lint errors in the console. | |
3. Navigate to `/dst` directory. | ||
4. Publish to npm with `npm publish` | ||
|
||
## Testing | ||
|
||
Tests exist in the `/src/__tests__` directory. Running `yarn test` will run the test suite. | ||
|
||
## Support | ||
|
||
Need help? Please report issues or requests to [email protected], through in app chat, or on https://community.retool.com/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import Retool from "../components/Retool"; | ||
|
||
describe("react-retool", () => { | ||
it("has the correct src attribute", () => { | ||
render( | ||
<Retool url="https://support.retool.com/embedded/public/cb9e15f0-5d7c-43a7-a746-cdec870dde9a" /> | ||
); | ||
|
||
const iframe = screen.getByTitle("retool"); | ||
expect(iframe.src).toBe( | ||
"https://support.retool.com/embedded/public/cb9e15f0-5d7c-43a7-a746-cdec870dde9a" | ||
); | ||
}); | ||
|
||
it("has the correct height attribute", () => { | ||
render(<Retool height="100%" />); | ||
|
||
const iframe = screen.getByTitle("retool"); | ||
expect(iframe.height).toBe("100%"); | ||
}); | ||
|
||
it("has the correct width attribute", () => { | ||
render(<Retool width="500px" />); | ||
|
||
const iframe = screen.getByTitle("retool"); | ||
expect(iframe.width).toBe("500px"); | ||
}); | ||
|
||
it("has the correct sandbox attribute", () => { | ||
render(<Retool sandbox="allow-popups" />); | ||
|
||
const iframe = screen.getByTitle("retool"); | ||
expect(iframe.getAttribute("sandbox")).toBe( | ||
"allow-scripts allow-same-origin allow-popups" | ||
); | ||
}); | ||
|
||
it("has the correct allow attribute", () => { | ||
render(<Retool allow="fullscreen" />); | ||
|
||
const iframe = screen.getByTitle("retool"); | ||
expect(iframe.getAttribute("allow")).toBe("fullscreen"); | ||
}); | ||
}); |
Oops, something went wrong.