-
Notifications
You must be signed in to change notification settings - Fork 8
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
1 parent
6da1762
commit bc5b391
Showing
32 changed files
with
586 additions
and
99 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
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,5 +1,11 @@ | ||
import { config } from 'docz-rollup'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
|
||
export default config({ | ||
input: ['./src/index.ts'], | ||
plugins: [ | ||
resolve({ | ||
preferBuiltins: false, | ||
}), | ||
], | ||
}); |
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
82 changes: 82 additions & 0 deletions
82
core/instrument/test/__snapshots__/csf-toggle.test.js.snap
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,82 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`csf-toggle Toggle story 1`] = ` | ||
Object { | ||
"properties": Array [ | ||
Object { | ||
"loc": SourceLocation { | ||
"end": Position { | ||
"column": 32, | ||
"line": 6, | ||
}, | ||
"start": Position { | ||
"column": 6, | ||
"line": 6, | ||
}, | ||
}, | ||
"name": "title", | ||
"value": "Components/Toggle", | ||
}, | ||
Object { | ||
"loc": SourceLocation { | ||
"end": Position { | ||
"column": 23, | ||
"line": 7, | ||
}, | ||
"start": Position { | ||
"column": 6, | ||
"line": 7, | ||
}, | ||
}, | ||
"name": "component", | ||
"value": "Toggle", | ||
}, | ||
], | ||
"stories": Object { | ||
"allToggles": Object { | ||
"arguments": Array [ | ||
Object { | ||
"loc": Object { | ||
"end": Object { | ||
"column": 51, | ||
"line": 15, | ||
}, | ||
"start": Object { | ||
"column": 46, | ||
"line": 15, | ||
}, | ||
}, | ||
"name": "check", | ||
"value": "check", | ||
}, | ||
Object { | ||
"loc": Object { | ||
"end": Object { | ||
"column": 27, | ||
"line": 24, | ||
}, | ||
"start": Object { | ||
"column": 22, | ||
"line": 24, | ||
}, | ||
}, | ||
"name": "check", | ||
"value": "check", | ||
}, | ||
], | ||
"name": "allToggles", | ||
"source": Object { | ||
"end": Object { | ||
"column": 5, | ||
"line": 29, | ||
}, | ||
"start": Object { | ||
"column": 36, | ||
"line": 10, | ||
}, | ||
}, | ||
}, | ||
}, | ||
"title": "Components/Toggle", | ||
} | ||
`; |
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,37 @@ | ||
import { parseCSF } from '../src/index'; | ||
|
||
describe('csf-toggle', () => { | ||
it('Toggle story', async () => { | ||
const stories = await parseCSF(` | ||
import React from 'react'; | ||
import { Toggle } from './Toggle'; | ||
export default { | ||
title: 'Components/Toggle', | ||
component: Toggle, | ||
}; | ||
export const allToggles = () => { | ||
const [checked, setChecked] = React.useState(false); | ||
return ( | ||
<div> | ||
<p>Default toggle</p> | ||
<Toggle checked={checked} onChange={check => setChecked(check)} /> | ||
<br /> | ||
<p>Custom labels</p> | ||
<Toggle | ||
checked={checked} | ||
labels={{ | ||
true: 'YES', | ||
false: 'NO!', | ||
}} | ||
onChange={check => setChecked(check)} | ||
/> | ||
<br /> | ||
</div> | ||
); | ||
}; | ||
`); | ||
expect(stories).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.