mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-05 06:01:22 +08:00
Run prettier
This commit is contained in:
parent
c2dc5bfa08
commit
a0b6eea992
@ -184,12 +184,10 @@ describe('Viewport/Panel', () => {
|
||||
});
|
||||
|
||||
it('sets the state with the new information', () => {
|
||||
expect(subject.instance().setState.mock.calls[0][0]).toEqual(
|
||||
{
|
||||
expect(subject.instance().setState.mock.calls[0][0]).toEqual({
|
||||
viewport: initialViewportAt(1),
|
||||
isLandscape: false,
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -213,19 +211,15 @@ describe('Viewport/Panel', () => {
|
||||
});
|
||||
|
||||
it('sets the state with the new information', () => {
|
||||
expect(subject.instance().setState.mock.calls.length).toBe(2);
|
||||
expect(subject.instance().setState.mock.calls[0][0]).toEqual(
|
||||
{
|
||||
storyDefaultViewport: 'iphone5'
|
||||
}
|
||||
);
|
||||
expect(subject.instance().setState.mock.calls).toHaveLength(2);
|
||||
expect(subject.instance().setState.mock.calls[0][0]).toEqual({
|
||||
storyDefaultViewport: 'iphone5',
|
||||
});
|
||||
|
||||
expect(subject.instance().setState.mock.calls[1][0]).toEqual(
|
||||
{
|
||||
expect(subject.instance().setState.mock.calls[1][0]).toEqual({
|
||||
viewport: initialViewportAt(1),
|
||||
isLandscape: false
|
||||
}
|
||||
);
|
||||
isLandscape: false,
|
||||
});
|
||||
expect(typeof subject.instance().setState.mock.calls[1][1]).toEqual('function');
|
||||
|
||||
const updaterFunction = subject.instance().setState.mock.calls[1][1];
|
||||
@ -246,7 +240,7 @@ describe('Viewport/Panel', () => {
|
||||
beforeEach(() => {
|
||||
subject.instance().state = {
|
||||
...subject.instance().state,
|
||||
viewport: initialViewportAt(1)
|
||||
viewport: initialViewportAt(1),
|
||||
};
|
||||
subject.instance().emitViewportChanged();
|
||||
});
|
||||
@ -254,10 +248,9 @@ describe('Viewport/Panel', () => {
|
||||
it('emits viewport changed event', () => {
|
||||
const viewport = transformedInitialViewports[initialViewportAt(1)];
|
||||
|
||||
expect(props.channel.emit).toHaveBeenCalledWith(
|
||||
'addon:viewport:viewportChanged',
|
||||
{ viewport }
|
||||
);
|
||||
expect(props.channel.emit).toHaveBeenCalledWith('addon:viewport:viewportChanged', {
|
||||
viewport,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -18,7 +18,7 @@ export default class Viewport extends React.Component {
|
||||
|
||||
static defaultProps = {
|
||||
name: DEFAULT_VIEWPORT,
|
||||
onViewportChange: noop
|
||||
onViewportChange: noop,
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
|
@ -49,10 +49,7 @@ describe('Viewport', () => {
|
||||
subject = shallow(<Viewport {...props} onViewportChange={noop} />);
|
||||
|
||||
expect(channel.on).toHaveBeenCalledTimes(1);
|
||||
expect(channel.on).toHaveBeenCalledWith(
|
||||
'addon:viewport:viewportChanged',
|
||||
noop
|
||||
);
|
||||
expect(channel.on).toHaveBeenCalledWith('addon:viewport:viewportChanged', noop);
|
||||
});
|
||||
});
|
||||
|
||||
@ -62,10 +59,7 @@ describe('Viewport', () => {
|
||||
subject.unmount();
|
||||
|
||||
expect(channel.removeListener).toHaveBeenCalledTimes(1);
|
||||
expect(channel.removeListener).toHaveBeenCalledWith(
|
||||
'addon:viewport:viewportChanged',
|
||||
noop
|
||||
);
|
||||
expect(channel.removeListener).toHaveBeenCalledWith('addon:viewport:viewportChanged', noop);
|
||||
});
|
||||
});
|
||||
|
||||
@ -74,7 +68,7 @@ describe('Viewport', () => {
|
||||
const propsWithCallback = {
|
||||
name: 'unknown',
|
||||
children: 'do not exist',
|
||||
onViewportChange: jest.fn()
|
||||
onViewportChange: jest.fn(),
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
@ -87,15 +81,13 @@ describe('Viewport', () => {
|
||||
|
||||
it('calls onViewportChange with the newly selected viewport', () => {
|
||||
emitter.emit(VIEWPORT_CHANGED_EVENT_ID, {
|
||||
viewport: INITIAL_VIEWPORTS.iphone5
|
||||
viewport: INITIAL_VIEWPORTS.iphone5,
|
||||
});
|
||||
|
||||
expect(propsWithCallback.onViewportChange).toHaveBeenCalled();
|
||||
expect(propsWithCallback.onViewportChange).toHaveBeenCalledWith(
|
||||
{
|
||||
viewport: INITIAL_VIEWPORTS.iphone5
|
||||
}
|
||||
);
|
||||
expect(propsWithCallback.onViewportChange).toHaveBeenCalledWith({
|
||||
viewport: INITIAL_VIEWPORTS.iphone5,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
19
app/react-native/src/bin/storybook-start.js
vendored
19
app/react-native/src/bin/storybook-start.js
vendored
@ -58,27 +58,24 @@ if (!program.skipPackager) {
|
||||
roots = roots.concat(program.root.split(',').map(root => path.resolve(root)));
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line global-require
|
||||
require("babel-register")({
|
||||
"presets": ["flow"],
|
||||
require('babel-register')({
|
||||
presets: ['flow'],
|
||||
ignore: false,
|
||||
babelrc: false});
|
||||
babelrc: false,
|
||||
});
|
||||
|
||||
// eslint-disable-next-line global-require
|
||||
const findSymlinkedModules = require('react-native/local-cli/util/findSymlinkedModules');
|
||||
symlinks = roots.reduce(
|
||||
(arr, rootPath) => arr.concat(findSymlinkedModules(rootPath, roots)),
|
||||
[...roots]
|
||||
);
|
||||
symlinks = roots.reduce((arr, rootPath) => arr.concat(findSymlinkedModules(rootPath, roots)), [
|
||||
...roots,
|
||||
]);
|
||||
} catch (e) {
|
||||
console.warn(`Unable to load findSymlinksPaths: ${e.message}`, e);
|
||||
}
|
||||
|
||||
let projectRoots = (configDir === projectDir ? [] : [configDir]).concat(
|
||||
symlinks
|
||||
);
|
||||
let projectRoots = (configDir === projectDir ? [] : [configDir]).concat(symlinks);
|
||||
|
||||
if (program.projectRoots) {
|
||||
projectRoots = projectRoots.concat(
|
||||
|
Loading…
x
Reference in New Issue
Block a user