[refactor,#59][s]: move packages/portal => examples/catalog as per plan in #59.

What is currently packages/portal is example of a running portal and should move to examples (it will get replaced by an actual portal lib soon).
This commit is contained in:
Rufus Pollock
2021-03-06 17:55:32 +01:00
parent 14e6f1d597
commit 337d4a8186
77 changed files with 8 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
import React from 'react';
import { render } from '@testing-library/react';
import Form from '../../../components/search/Form';
const useRouter = jest.spyOn(require('next/router'), 'useRouter');
test('📸 of Form component with empty', () => {
useRouter.mockImplementationOnce(() => ({
query: { search: '', sort: '' },
}));
const { container } = render(<Form />);
expect(container).toMatchSnapshot();
});
test('📸 of Form component with query', () => {
useRouter.mockImplementationOnce(() => ({
query: { search: 'gdp', sort: '' },
}));
const { container } = render(<Form />);
expect(container).toMatchSnapshot();
});

View File

@@ -0,0 +1,16 @@
import React from 'react';
import renderer from 'react-test-renderer';
import Item from '../../../components/search/Item';
test('📸 of Input component with empty', () => {
const fixture = {
name: 'qw',
title: '12',
organization: null,
__typename: 'Package',
};
const tree = renderer
.create(<Item datapackage={fixture} key={0} />)
.toJSON();
expect(tree).toMatchSnapshot();
});

View File

@@ -0,0 +1,133 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`📸 of Form component with empty 1`] = `
<div>
<form
class="items-center"
>
<div
class="flex"
>
<input
aria-label="Search"
class="bg-white focus:outline-none focus:shadow-outline border border-gray-300 w-1/2 rounded-lg py-2 px-4 block appearance-none leading-normal"
name="q"
placeholder="Search"
type="text"
value=""
/>
<button
class="inline-block text-sm px-4 py-3 mx-3 leading-none border rounded text-white bg-black border-black lg:mt-0"
>
Search
</button>
</div>
<div
class="inline-block my-6 float-right"
>
<label
for="field-order-by"
>
Order by:
</label>
<select
class="bg-white"
id="field-order-by"
name="sort"
>
<option
value="score:desc"
>
Relevance
</option>
<option
value="title_string:asc"
>
Name Ascending
</option>
<option
value="title_string:desc"
>
Name Descending
</option>
<option
value="metadata_modified:desc"
>
Last Modified
</option>
<option
value="views_recent:desc"
>
Popular
</option>
</select>
</div>
</form>
</div>
`;
exports[`📸 of Form component with query 1`] = `
<div>
<form
class="items-center"
>
<div
class="flex"
>
<input
aria-label="Search"
class="bg-white focus:outline-none focus:shadow-outline border border-gray-300 w-1/2 rounded-lg py-2 px-4 block appearance-none leading-normal"
name="q"
placeholder="Search"
type="text"
value=""
/>
<button
class="inline-block text-sm px-4 py-3 mx-3 leading-none border rounded text-white bg-black border-black lg:mt-0"
>
Search
</button>
</div>
<div
class="inline-block my-6 float-right"
>
<label
for="field-order-by"
>
Order by:
</label>
<select
class="bg-white"
id="field-order-by"
name="sort"
>
<option
value="score:desc"
>
Relevance
</option>
<option
value="title_string:asc"
>
Name Ascending
</option>
<option
value="title_string:desc"
>
Name Descending
</option>
<option
value="metadata_modified:desc"
>
Last Modified
</option>
<option
value="views_recent:desc"
>
Popular
</option>
</select>
</div>
</form>
</div>
`;

View File

@@ -0,0 +1,46 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`📸 of Input component with empty 1`] = `
<form
className="flex items-center"
onSubmit={[Function]}
>
<input
aria-label="Search"
className="bg-white focus:outline-none focus:shadow-outline border border-gray-300 w-1/2 rounded-lg py-2 px-4 block appearance-none leading-normal"
name="q"
onChange={[Function]}
placeholder="Search"
type="text"
/>
<button
className="inline-block text-sm px-4 py-3 mx-3 leading-none border rounded text-white bg-black border-black lg:mt-0"
onClick={[Function]}
>
Search
</button>
</form>
`;
exports[`📸 of Input component with query 1`] = `
<form
className="flex items-center"
onSubmit={[Function]}
>
<input
aria-label="Search"
className="bg-white focus:outline-none focus:shadow-outline border border-gray-300 w-1/2 rounded-lg py-2 px-4 block appearance-none leading-normal"
name="q"
onChange={[Function]}
placeholder="Search"
type="text"
value="gdp"
/>
<button
className="inline-block text-sm px-4 py-3 mx-3 leading-none border rounded text-white bg-black border-black lg:mt-0"
onClick={[Function]}
>
Search
</button>
</form>
`;

View File

@@ -0,0 +1,31 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`📸 of Input component with empty 1`] = `
<div
className="mb-6"
>
<h3
className="text-xl font-semibold"
>
<a
className="text-primary"
href="/@dataset/qw"
onClick={[Function]}
onMouseEnter={[Function]}
>
12
</a>
</h3>
<a
className="text-gray-500 block mt-1"
href="/@dataset"
onClick={[Function]}
onMouseEnter={[Function]}
>
dataset
</a>
<div
className="leading-relaxed mt-2"
/>
</div>
`;

View File

@@ -0,0 +1,35 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`📸 of Input component with empty 1`] = `
<ul>
<div
className="mb-6"
>
<h3
className="text-xl font-semibold"
>
<a
className="text-primary"
href="/@test-org/test"
onClick={[Function]}
onMouseEnter={[Function]}
>
Title
</a>
</h3>
<a
className="text-gray-500 block mt-1"
href="/@test-org"
onClick={[Function]}
onMouseEnter={[Function]}
>
test org
</a>
<div
className="leading-relaxed mt-2"
>
A description.
</div>
</div>
</ul>
`;

View File

@@ -0,0 +1,44 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`📸 of Input component with empty 1`] = `
<div
className="inline-block my-6 float-right"
>
<label
htmlFor="field-order-by"
>
Order by:
</label>
<select
className="bg-white"
id="field-order-by"
name="sort"
>
<option
value="score:desc"
>
Relevance
</option>
<option
value="title_string:asc"
>
Name Ascending
</option>
<option
value="title_string:desc"
>
Name Descending
</option>
<option
value="metadata_modified:desc"
>
Last Modified
</option>
<option
value="views_recent:desc"
>
Popular
</option>
</select>
</div>
`;

View File

@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`📸 of Total component 1`] = `
<h1
className="text-3xl font-semibold text-primary my-6 inline-block"
>
2
results found
</h1>
`;