mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-20 22:52:46 -05:00
parent
76482ec8d7
commit
f18e749e93
6 changed files with 39 additions and 22 deletions
|
@ -1,18 +1,16 @@
|
||||||
|
/**
|
||||||
|
* @prettier
|
||||||
|
* @flow
|
||||||
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import { IProps } from './types';
|
||||||
|
import { Wrapper } from './styles';
|
||||||
|
|
||||||
import classes from './noItems.scss';
|
const NoItems = ({ text }: IProps) => (
|
||||||
|
<Wrapper>
|
||||||
const NoItems = (props) => {
|
<h2>{text}</h2>
|
||||||
return (
|
</Wrapper>
|
||||||
<div className={classes.noItems}>
|
);
|
||||||
<h2>{props.text}</h2>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
NoItems.propTypes = {
|
|
||||||
text: PropTypes.string.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default NoItems;
|
export default NoItems;
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
.noItems {
|
|
||||||
margin: 5em 0;
|
|
||||||
}
|
|
12
src/webui/components/NoItems/styles.js
Normal file
12
src/webui/components/NoItems/styles.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/**
|
||||||
|
* @prettier
|
||||||
|
* @flow
|
||||||
|
*/
|
||||||
|
|
||||||
|
import styled from 'react-emotion';
|
||||||
|
|
||||||
|
export const Wrapper = styled.div`
|
||||||
|
&& {
|
||||||
|
margin: 5em 0;
|
||||||
|
}
|
||||||
|
`;
|
8
src/webui/components/NoItems/types.js
Normal file
8
src/webui/components/NoItems/types.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
/**
|
||||||
|
* @prettier
|
||||||
|
* @flow
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface IProps {
|
||||||
|
text: string;
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<NoItem /> component should set html from props 1`] = `"<div class=\\"noItems\\"><h2>This is a test string</h2></div>"`;
|
exports[`<NoItem /> component should load the component in default state 1`] = `"<div class=\\"css-6ghnff e1ggl3im0\\"><h2></h2></div>"`;
|
||||||
|
|
||||||
|
exports[`<NoItem /> component should set html from props 1`] = `"<div class=\\"css-6ghnff e1ggl3im0\\"><h2>This is a test string</h2></div>"`;
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow, mount } from 'enzyme';
|
||||||
import NoItems from '../../../../src/webui/components/NoItems/index';
|
import NoItems from '../../../../src/webui/components/NoItems/index';
|
||||||
|
|
||||||
console.error = jest.fn();
|
console.error = jest.fn();
|
||||||
|
|
||||||
describe('<NoItem /> component', () => {
|
describe('<NoItem /> component', () => {
|
||||||
it('should give error for the required fields', () => {
|
it('should load the component in default state', () => {
|
||||||
shallow(<NoItems />);
|
const wrapper = mount(<NoItems />);
|
||||||
expect(console.error).toBeCalled();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set html from props', () => {
|
it('should set html from props', () => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue