-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/3.2' into 151-story-hierarchy
- Loading branch information
Showing
5 changed files
with
221 additions
and
63 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
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,59 @@ | ||
/* global document */ | ||
|
||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import AddonInfo, { withInfo, setDefaults, addInfo } from './'; | ||
|
||
/* eslint-disable */ | ||
const TestComponent = ({ func, obj, array, number, string, bool, empty }) => | ||
<div> | ||
<h1>{func}</h1> | ||
<h2>{obj.toString()}</h2> | ||
<h3>{array}</h3> | ||
<h4>{number}</h4> | ||
<h5>{string}</h5> | ||
<h6>{bool}</h6> | ||
<p>{empty}</p> | ||
<a href="#">test</a> | ||
<code>storiesOf</code> | ||
<ui> | ||
<li>1</li> | ||
<li>2</li> | ||
</ui> | ||
</div>; | ||
/* eslint-enable */ | ||
|
||
const testContext = { kind: 'addon_info', story: 'jest_test' }; | ||
const testOptions = { propTables: false }; | ||
|
||
describe('addon Info', () => { | ||
const story = context => | ||
<div> | ||
It's a {context.story} story: | ||
<TestComponent | ||
func={x => x + 1} | ||
obj={{ a: 'a', b: 'b' }} | ||
array={[1, 2, 3]} | ||
number={7} | ||
string={'seven'} | ||
bool | ||
/> | ||
</div>; | ||
const api = { | ||
add: (name, fn) => fn(testContext), | ||
}; | ||
it('should render <Info /> and markdown', () => { | ||
const Info = withInfo( | ||
'# Test story \n## with markdown info \ncontaing **bold**, *cursive* text and `code`' | ||
)(story); | ||
ReactDOM.render(<Info />, document.createElement('div')); | ||
}); | ||
it('should render with missed info', () => { | ||
setDefaults(testOptions); | ||
addInfo(null, testContext, story, testOptions); | ||
}); | ||
it('should show deprecation warning', () => { | ||
const addWithInfo = AddonInfo.addWithInfo.bind(api); | ||
addWithInfo('jest', story); | ||
}); | ||
}); |
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