mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-20 22:52:46 -05:00
refactor: removes old package detail component
This commit is contained in:
parent
fed9711f48
commit
711f8153a5
4 changed files with 0 additions and 84 deletions
|
@ -1,31 +0,0 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import isNil from 'lodash/isNil';
|
||||
|
||||
import Readme from '../Readme';
|
||||
|
||||
import classes from './packageDetail.scss';
|
||||
|
||||
const displayState = (description) => {
|
||||
return !isNil(description) ? <Readme description={description} /> : '';
|
||||
};
|
||||
|
||||
const PackageDetail = ({packageName, readMe}) => {
|
||||
return (
|
||||
<div className={classes.pkgDetail}>
|
||||
<h1 className={classes.title}>
|
||||
{packageName}
|
||||
</h1>
|
||||
<div className={classes.readme}>
|
||||
{displayState(readMe)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
PackageDetail.propTypes = {
|
||||
readMe: PropTypes.string,
|
||||
packageName: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default PackageDetail;
|
|
@ -1,16 +0,0 @@
|
|||
@import '../../styles/variables';
|
||||
@import '../../styles/mixins';
|
||||
|
||||
.pkgDetail {
|
||||
.title {
|
||||
font-size: $font-size-xxl;
|
||||
font-weight: $font-weight-semibold;
|
||||
margin: 0 0 40px;
|
||||
padding-bottom: 5px;
|
||||
@include border-bottom-default($greyGainsboro);
|
||||
}
|
||||
|
||||
.readme {
|
||||
margin-bottom: 5em;
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<PackageDetail /> component should load the component 1`] = `"<div class=\\"pkgDetail\\"><h1 class=\\"title\\">Verdaccio</h1><div class=\\"readme\\"><div class=\\"markdown-body\\">Test readme</div></div></div>"`;
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* PackageDetail component
|
||||
*/
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import PackageDetail from '../../../../src/webui/components/PackageDetail/index';
|
||||
import Readme from '../../../../src/webui/components/Readme/index';
|
||||
import {WEB_TITLE} from '../../../../src/lib/constants';
|
||||
|
||||
console.error = jest.fn();
|
||||
|
||||
describe('<PackageDetail /> component', () => {
|
||||
test('should give error for required props', () => {
|
||||
shallow(<PackageDetail />);
|
||||
expect(console.error).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('should load the component', () => {
|
||||
const props = {
|
||||
readMe: 'Test readme',
|
||||
packageName: WEB_TITLE
|
||||
};
|
||||
const wrapper = shallow(<PackageDetail {...props} />);
|
||||
|
||||
expect(wrapper.find('h1').text()).toEqual(WEB_TITLE);
|
||||
expect(
|
||||
wrapper
|
||||
.find(Readme)
|
||||
.dive()
|
||||
.html()
|
||||
).toEqual('<div class="markdown-body">Test readme</div>');
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue