Skip to content

Commit f9a6064

Browse files
author
Ives van Hoorne
committed
Add test documentation
1 parent 2b9711f commit f9a6064

File tree

9 files changed

+62
-18
lines changed

9 files changed

+62
-18
lines changed

packages/homepage/content/docs/2-git.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Git Integration"
2+
title: "Git Committing and PRs"
33
authors: ["CompuIves"]
44
description: "CodeSandbox allows you to import, commit and make a pull requests to GitHub repositories."
55
---

packages/homepage/content/docs/2-live.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "CodeSandbox Live"
2+
title: "Collaboration with Live"
33
authors: ["CompuIves"]
44
description: "With CodeSandbox Live you can open up your sandbox for real time collaboration."
55
---
@@ -8,21 +8,21 @@ description: "With CodeSandbox Live you can open up your sandbox for real time c
88

99
![Live Sidebar](./images/live-screenshot.png)
1010

11-
Live is a mode in CodeSandbox that allows you to share your sandbox with others for real time collaboration. You can access Live with the Live tab in the sidebar:
11+
Live is a mode in CodeSandbox that allows you to share your sandbox with others for real time collaboration. You can simultaneously create, delete, edit and move files in real time. It's like Google Docs, but for your code! You can access Live under the Live tab in the sidebar:
1212

1313
![Live Sidebar](./images/live-sidebar.png)
1414

1515
## Demo
1616

1717
We recorded a demo to show what CodeSandbox Live exactly is, you can watch it here:
1818

19-
`youtube:https://www.youtube.com/embed/DnnJ0sLn28s`
19+
<iframe width="740" height="370" src="https://www.youtube.com/embed/DnnJ0sLn28s" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe><br />
2020

2121
We also made an announcement blog post, which you can read [here](https://medium.com/@compuives/introducing-codesandbox-live-real-time-code-collaboration-in-the-browser-6d508cfc70c9).
2222

2323
## Going Live
2424

25-
You can go live by simply pressing the 'Go Live' button in the sidebar. This will give you a URL that you can share with others to join the session.
25+
You can go live by simply pressing the 'Go Live' button in the sidebar. This will give you a URL that you can share with others to join the session. Others can only make edits to the sandbox while they are in the live session, they cannot do this when just viewing the sandbox.
2626

2727
![Going Live](./images/live-live.png)
2828

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "Jest Tests"
3+
authors: ["CompuIves"]
4+
description: "CodeSandbox has a native integration with Jest Tests for running tests."
5+
---
6+
7+
## What is Jest
8+
9+
Jest is a zero configuration test runner that allows you easily write JavaScript tests without setting anything up. For more info on Jest you can look [here](https://facebook.github.io/jest/).
10+
11+
## How to use Jest in CodeSandbox
12+
13+
You can run Jest tests by creating files that and with `.test.js`, `.spec.js`, `.test.ts(x)` and `.spec.js(x)`. We will automatically detect these test files and show the results in the bottom bar.
14+
15+
![Test Bottom](./images/jest-tests.png)
16+
17+
You can also open the test view instead of the browser preview by clicking on the 'Show Tests' icon in the top right.
18+
19+
![Show Tests](./images/show-tests.png)
20+
21+
The left side of the test view is an overview of all test files. The right side shows the details of a file when you select it.
22+
23+
![Test Details](./images/jest-details.png)
24+
25+
You can decide to rerun tests manually by clicking on the Play icon. We automatically watch for file changes, you can disable this by clicking on the 'Refresh' icon on the left side.
26+
27+
## Test Failures
28+
29+
We show failed tests in two ways: in the test overview and in the code editor itself.
30+
31+
A failed test looks like this in the Test View:
32+
33+
![Test Error](./images/jest-error-overview.png)
34+
35+
And will also show squiggles in the editor:
36+
37+
![Test Squiggles](./images/jest-squiggles.png)
151 KB
Loading
145 KB
Loading
265 KB
Loading
81.5 KB
Loading
30.8 KB
Loading

packages/homepage/src/components/StickyNavigation.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import styled, { css } from 'styled-components';
33
import theme from 'common/theme';
44

55
import Link from 'gatsby-link';
6+
import { Route } from 'react-router-dom';
67
import slugify from 'common/utils/slugify';
78

89
import media from '../utils/media';
@@ -11,7 +12,7 @@ import getScrollPos from '../utils/scroll';
1112
const Navigation = styled.nav`
1213
padding-top: 2rem;
1314
margin-right: 1rem;
14-
width: 250px;
15+
width: 300px;
1516
1617
${props =>
1718
props.fixed &&
@@ -166,18 +167,24 @@ export default class StickyNavigation extends React.PureComponent<Props> {
166167
>
167168
{node.frontmatter.title}
168169
</PrimaryNavigationLink>
169-
<ul>
170-
{node.headings.map(({ value }) => (
171-
<li key={value}>
172-
<SecondaryNavigationLink
173-
to={`${node.fields.url}#${slugify(value)}`}
174-
exact
175-
>
176-
{value}
177-
</SecondaryNavigationLink>
178-
</li>
179-
))}
180-
</ul>
170+
<Route
171+
path={node.fields.url}
172+
exact
173+
render={() => (
174+
<ul>
175+
{node.headings.map(({ value }) => (
176+
<li key={value}>
177+
<SecondaryNavigationLink
178+
to={`${node.fields.url}#${slugify(value)}`}
179+
exact
180+
>
181+
{value}
182+
</SecondaryNavigationLink>
183+
</li>
184+
))}
185+
</ul>
186+
)}
187+
/>
181188
</NavigationItem>
182189
))}
183190
</ul>

0 commit comments

Comments
 (0)