-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
105 changed files
with
3,453 additions
and
343 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 |
---|---|---|
@@ -1,18 +1,9 @@ | ||
[ignore] | ||
|
||
# Disable module with broken flow types. | ||
.*/node_modules/babylon/*.* | ||
.*/node_modules/config-chain/*.* | ||
.*/node_modules/npm/*.* | ||
.*/node_modules/npmi/*.* | ||
.*/node_modules/react-native/*.* | ||
.*/node_modules/fbjs/lib/partitionObjectByKey.js | ||
.*/node_modules/conventional-changelog-core/test/fixtures/_malformation.json | ||
.*/node_modules/polished/*.* | ||
.*/node_modules/findup/*.* | ||
.*/node_modules/jss/*.* | ||
.*/lib/ | ||
.*/es/ | ||
./benchmarks/ | ||
./examples/ | ||
|
||
module.name_mapper='(react-native)' -> 'empty/object' | ||
module.name_mapper='(preact)' -> 'empty/object' | ||
[version] | ||
^0.57.3 | ||
^0.81.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# createSnapshot | ||
|
||
Renders Fela components into a string snapshot including both rendered HTML and CSS to achieve predictable component tests. | ||
|
||
It formats and optimises the output for maximum readability. | ||
|
||
## Arguments | ||
|
||
| Argument | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| component | [*Component*](https://facebook.github.io/react/docs/top-level-api.html#react.component) | | A valid React component that is rendered. | | ||
| theme | *Object?* | `{}` | A theme object that is automatically used for rendering. | | ||
| renderer | [*Renderer?*](../fela/Renderer.md) | `createRenderer()` | A Fela renderer with custom configuration | | ||
| Provider | [*Provider?*](../bindings/Provider.md) | bindings specific Provider | A custom Provider component | | ||
| ThemeProvider | [*ThemeProvider?*](../bindings/ThemeProvider.md) | bindings specific ThemeProvider | A custom ThemeProvider component | | ||
|
||
## Returns | ||
(*string*): Formatted string including CSS and HTML. | ||
|
||
## Imports | ||
```javascript | ||
import { createSnapshot } from 'jest-react-fela' | ||
import { createSnapshot } from 'jest-preact-fela' | ||
import { createSnapshot } from 'jest-inferno-fela' | ||
``` | ||
|
||
## Example | ||
```javascript | ||
describe('Rendering a Fela component', () => { | ||
it('should render correctly', () => { | ||
const snapshot = createSnapshot( | ||
<FelaComponent style={{ color: 'blue', backgroundColor: 'black' }} /> | ||
) | ||
|
||
expect(snapshot).toMatchSnapshot() | ||
}) | ||
}) | ||
``` | ||
##### Snapshot | ||
``` | ||
.a { | ||
color: blue | ||
} | ||
.b { | ||
background-color: black | ||
} | ||
<div className=a b /> | ||
``` | ||
|
||
### Using theme | ||
|
||
```javascript | ||
describe('Rendering a Fela component', () => { | ||
it('should render correctly', () => { | ||
const rule = ({ theme }) => ({ | ||
backgroundColor: theme.primary, | ||
color: theme.secondary | ||
}) | ||
|
||
const theme = { | ||
primary: 'blue', | ||
secondary: 'red' | ||
} | ||
|
||
const snapshot = createSnapshot( | ||
<FelaComponent rule={rule} />, | ||
theme | ||
) | ||
|
||
expect(snapshot).toMatchSnapshot() | ||
}) | ||
}) | ||
``` | ||
##### Snapshot | ||
``` | ||
.a { | ||
background-color: blue | ||
} | ||
.b { | ||
color: red | ||
} | ||
<div className=a b /> | ||
``` |
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
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 |
---|---|---|
@@ -1,22 +1,22 @@ | ||
{ | ||
"private": true, | ||
"name": "example-react-native", | ||
"version": "1.0.29", | ||
"version": "1.0.30", | ||
"scripts": { | ||
"start": "node node_modules/react-native/local-cli/cli.js start" | ||
}, | ||
"devDependencies": { | ||
"babel-preset-react-native": "^1.0.1", | ||
"create-react-native-app": "^0.0.6", | ||
"fela": "^6.2.1", | ||
"fela-dom": "^8.0.1", | ||
"fela-native": "^5.0.24", | ||
"fela-plugin-extend": "^6.0.9", | ||
"fela-plugin-native-media-query": "^6.0.11", | ||
"fela-tools": "^5.2.1", | ||
"fela-utils": "^8.1.1", | ||
"fela": "^6.2.2", | ||
"fela-dom": "^8.0.2", | ||
"fela-native": "^5.0.25", | ||
"fela-plugin-extend": "^6.0.10", | ||
"fela-plugin-native-media-query": "^6.0.12", | ||
"fela-tools": "^5.2.2", | ||
"fela-utils": "^8.1.2", | ||
"react": "^16.0.0-alpha.6", | ||
"react-fela": "^8.0.1", | ||
"react-fela": "^8.0.2", | ||
"react-native": "0.44.0" | ||
} | ||
} |
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.