Skip to content

Commit

Permalink
Merge pull request #71 from NicoLaval/master
Browse files Browse the repository at this point in the history
Fix test issue
  • Loading branch information
NicoLaval authored Aug 27, 2019
2 parents bb5ec86 + f84ef89 commit 56af64b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
14 changes: 2 additions & 12 deletions packages/bauhaus-library/src/flag/flag.spec.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import React from 'react';
import { shallow } from 'enzyme';
import Flag, { isFlag } from './';

describe('isFlag', () => {
it('missing img returns false', () => {
expect(isFlag('de')).toBe(false);
});

it('existing img returns true', () => {
expect(isFlag('fr')).toBe(true);
});
});
import Flag from './';

describe('flag', () => {
it('renders without crashing', () => {
shallow(<Flag lang="fr" />);
shallow(<Flag flag={null} />);
});
});
5 changes: 3 additions & 2 deletions packages/bauhaus-library/src/panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import Flag from '../flag';
import './panel.scss';

function Panel({ title, children, context = 'concepts', flag }) {
const flagComponent = <Flag flag={flag} />;
const flagComponent = flag ? ` ( ${<Flag flag={flag} />} )` : '';
return (
<div className={`panel panel-${context}`}>
<div className="panel-heading">
<h3 className="panel-title">
{title} {flag ? '( ' : null} {flagComponent} {flag ? ' )' : null}
{title}
{flagComponent}
</h3>
</div>
<div className="panel-body">{children}</div>
Expand Down
10 changes: 6 additions & 4 deletions packages/bauhaus-library/src/search-rmes/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import React, { useState } from 'react';
import React, { useState, useContext } from 'react';
import I18NContext from '../i18n-provider';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import D from 'js/i18n';
import Pagination from '../pagination';
import { filterKeyDeburr, nbResults } from 'js/utils/array-utils';

function SearchRmes({
items = [],
advancedSearch = false,
searchUrl,
placeholder = D.searchLabelPlaceholder,
placeholder,
childPath,
col,
colOff,
context,
label,
}) {
const [search, handleSearch] = useState('');
const D = useContext(I18NContext).backToTop || label;

const filter = filterKeyDeburr(
Object.keys(items[0] || {}).filter(k => k !== 'id')
);
Expand All @@ -40,7 +42,7 @@ function SearchRmes({
value={search}
onChange={e => handleSearch(e.target.value)}
type="text"
placeholder={placeholder}
placeholder={D.searchLabelPlaceholder}
className="form-control"
aria-label={D.search}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { shallow } from 'enzyme';
import Search from './search-rmes';
import Search from '.';

const items = Array.apply(null, Array(50)).map((a, i) => ({
id: `${i + 1}`,
Expand Down

0 comments on commit 56af64b

Please sign in to comment.