Merge remote-tracking branch 'originGIT/master' into fix/issue-#1091

This commit is contained in:
Razvan Moraru 2018-01-30 10:23:53 +01:00
commit 162114586a
295 changed files with 11745 additions and 9622 deletions

View File

@ -3,13 +3,3 @@ node_js:
- '8' - '8'
script: script:
- npm run test-ci - npm run test-ci
# addons:
# chrome: stable
# before_install:
# - # start your web application and listen on `127.0.0.1`
# - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
# script:
# - npm run test-ci
# - eslint-gh-status-reporter
# - stylelint-gh-status-reporter
# - lighthouse-gh-status-reporter --chrome-port=9222 --chrome-hostname=localhost

View File

@ -5,6 +5,10 @@
"license": "MPL-2.0", "license": "MPL-2.0",
"scripts": { "scripts": {
"start": "NODE_ENV=development PORT=3069 REACT_APP_GQL_PORT=3069 REACT_APP_GQL_PROTOCOL=http node -r ./_env.js index.js", "start": "NODE_ENV=development PORT=3069 REACT_APP_GQL_PORT=3069 REACT_APP_GQL_PROTOCOL=http node -r ./_env.js index.js",
"lint-ci": "echo 0",
"lint": "echo 0",
"test-ci": "echo 0",
"test": "echo 0",
"prepublish": "echo 0" "prepublish": "echo 0"
}, },
"dependencies": { "dependencies": {

View File

@ -12,12 +12,12 @@
"lint-docs": "./scripts/quality-docs", "lint-docs": "./scripts/quality-docs",
"lint-ci:root": "eslint . --ext .js --ext .md", "lint-ci:root": "eslint . --ext .js --ext .md",
"lint:root": "eslint . --fix --ext .js --ext .md", "lint:root": "eslint . --fix --ext .js --ext .md",
"lint-ci:packages": "lerna run lint-ci --stream", "lint-ci:packages": "lerna run lint-ci --parallel --stream",
"lint:packages": "lerna run lint --stream", "lint:packages": "lerna run lint --parallel --stream",
"lint-ci": "redrun -s lint-ci:*", "lint-ci": "redrun -s lint-ci:*",
"lint": "redrun -s lint:*", "lint": "redrun -s lint:*",
"test-ci": "CI=1 lerna run test-ci --stream", "test-ci": "CI=1 lerna run test-ci --stream",
"test": "lerna run test", "test": "lerna run test --parallel --stream",
"clean": "lerna clean --yes", "clean": "lerna clean --yes",
"dev": "lerna run dev --parallel --stream", "dev": "lerna run dev --parallel --stream",
"commitmsg": "commitlint -e", "commitmsg": "commitlint -e",

View File

@ -468,160 +468,6 @@ Array [
] ]
`; `;
exports[`renders <Checkcircle /> without throwing 1`] = `
Array [
<svg
height="18"
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9 18A9 9 0 1 0 9 0a9 9 0 0 0 0 18z"
fill="#FFF"
fillRule="evenodd"
/>
<path
d="M9 19c5.523 0 10-4.477 10-10h-2a8 8 0 0 1-8 8v2zM19 9C19 3.477 14.523-1 9-1v2a8 8 0 0 1 8 8h2zM9-1C3.477-1-1 3.477-1 9h2a8 8 0 0 1 8-8v-2zM-1 9c0 5.523 4.477 10 10 10v-2a8 8 0 0 1-8-8h-2z"
fill="#464646"
/>
</svg>,
<svg
height="18"
light={true}
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9 18A9 9 0 1 0 9 0a9 9 0 0 0 0 18z"
fill="#FFF"
fillRule="evenodd"
/>
<path
d="M9 19c5.523 0 10-4.477 10-10h-2a8 8 0 0 1-8 8v2zM19 9C19 3.477 14.523-1 9-1v2a8 8 0 0 1 8 8h2zM9-1C3.477-1-1 3.477-1 9h2a8 8 0 0 1 8-8v-2zM-1 9c0 5.523 4.477 10 10 10v-2a8 8 0 0 1-8-8h-2z"
fill="#464646"
/>
</svg>,
<svg
disabled={true}
height="18"
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9 18A9 9 0 1 0 9 0a9 9 0 0 0 0 18z"
fill="#FFF"
fillRule="evenodd"
/>
<path
d="M9 19c5.523 0 10-4.477 10-10h-2a8 8 0 0 1-8 8v2zM19 9C19 3.477 14.523-1 9-1v2a8 8 0 0 1 8 8h2zM9-1C3.477-1-1 3.477-1 9h2a8 8 0 0 1 8-8v-2zM-1 9c0 5.523 4.477 10 10 10v-2a8 8 0 0 1-8-8h-2z"
fill="#464646"
/>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(90deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9 18A9 9 0 1 0 9 0a9 9 0 0 0 0 18z"
fill="#FFF"
fillRule="evenodd"
/>
<path
d="M9 19c5.523 0 10-4.477 10-10h-2a8 8 0 0 1-8 8v2zM19 9C19 3.477 14.523-1 9-1v2a8 8 0 0 1 8 8h2zM9-1C3.477-1-1 3.477-1 9h2a8 8 0 0 1 8-8v-2zM-1 9c0 5.523 4.477 10 10 10v-2a8 8 0 0 1-8-8h-2z"
fill="#464646"
/>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(180deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9 18A9 9 0 1 0 9 0a9 9 0 0 0 0 18z"
fill="#FFF"
fillRule="evenodd"
/>
<path
d="M9 19c5.523 0 10-4.477 10-10h-2a8 8 0 0 1-8 8v2zM19 9C19 3.477 14.523-1 9-1v2a8 8 0 0 1 8 8h2zM9-1C3.477-1-1 3.477-1 9h2a8 8 0 0 1 8-8v-2zM-1 9c0 5.523 4.477 10 10 10v-2a8 8 0 0 1-8-8h-2z"
fill="#464646"
/>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(-90deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9 18A9 9 0 1 0 9 0a9 9 0 0 0 0 18z"
fill="#FFF"
fillRule="evenodd"
/>
<path
d="M9 19c5.523 0 10-4.477 10-10h-2a8 8 0 0 1-8 8v2zM19 9C19 3.477 14.523-1 9-1v2a8 8 0 0 1 8 8h2zM9-1C3.477-1-1 3.477-1 9h2a8 8 0 0 1 8-8v-2zM-1 9c0 5.523 4.477 10 10 10v-2a8 8 0 0 1-8-8h-2z"
fill="#464646"
/>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9 18A9 9 0 1 0 9 0a9 9 0 0 0 0 18z"
fill="#FFF"
fillRule="evenodd"
/>
<path
d="M9 19c5.523 0 10-4.477 10-10h-2a8 8 0 0 1-8 8v2zM19 9C19 3.477 14.523-1 9-1v2a8 8 0 0 1 8 8h2zM9-1C3.477-1-1 3.477-1 9h2a8 8 0 0 1 8-8v-2zM-1 9c0 5.523 4.477 10 10 10v-2a8 8 0 0 1-8-8h-2z"
fill="#464646"
/>
</svg>,
]
`;
exports[`renders <Clipboard /> without throwing 1`] = ` exports[`renders <Clipboard /> without throwing 1`] = `
Array [ Array [
<svg <svg
@ -2113,195 +1959,6 @@ Array [
] ]
`; `;
exports[`renders <Health /> without throwing 1`] = `
Array [
<svg
height="18"
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill-rule="evenodd"
>
<circle
cx="9"
cy="9"
fill="#009858"
r="9"
/>
<path
d="M9.477 6.603l-.522.443-.444-.443a2.056 2.056 0 1 0-2.908 2.909l3.352 3.352 3.412-3.352c.803-.804.863-2.106.06-2.91a2.105 2.105 0 0 0-2.95 0z"
fill="#FFF"
/>
</g>
</svg>,
<svg
height="18"
light={true}
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill-rule="evenodd"
>
<circle
cx="9"
cy="9"
fill="#009858"
r="9"
/>
<path
d="M9.477 6.603l-.522.443-.444-.443a2.056 2.056 0 1 0-2.908 2.909l3.352 3.352 3.412-3.352c.803-.804.863-2.106.06-2.91a2.105 2.105 0 0 0-2.95 0z"
fill="#FFF"
/>
</g>
</svg>,
<svg
disabled={true}
height="18"
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill-rule="evenodd"
>
<circle
cx="9"
cy="9"
fill="#009858"
r="9"
/>
<path
d="M9.477 6.603l-.522.443-.444-.443a2.056 2.056 0 1 0-2.908 2.909l3.352 3.352 3.412-3.352c.803-.804.863-2.106.06-2.91a2.105 2.105 0 0 0-2.95 0z"
fill="#FFF"
/>
</g>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(90deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill-rule="evenodd"
>
<circle
cx="9"
cy="9"
fill="#009858"
r="9"
/>
<path
d="M9.477 6.603l-.522.443-.444-.443a2.056 2.056 0 1 0-2.908 2.909l3.352 3.352 3.412-3.352c.803-.804.863-2.106.06-2.91a2.105 2.105 0 0 0-2.95 0z"
fill="#FFF"
/>
</g>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(180deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill-rule="evenodd"
>
<circle
cx="9"
cy="9"
fill="#009858"
r="9"
/>
<path
d="M9.477 6.603l-.522.443-.444-.443a2.056 2.056 0 1 0-2.908 2.909l3.352 3.352 3.412-3.352c.803-.804.863-2.106.06-2.91a2.105 2.105 0 0 0-2.95 0z"
fill="#FFF"
/>
</g>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(-90deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill-rule="evenodd"
>
<circle
cx="9"
cy="9"
fill="#009858"
r="9"
/>
<path
d="M9.477 6.603l-.522.443-.444-.443a2.056 2.056 0 1 0-2.908 2.909l3.352 3.352 3.412-3.352c.803-.804.863-2.106.06-2.91a2.105 2.105 0 0 0-2.95 0z"
fill="#FFF"
/>
</g>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill-rule="evenodd"
>
<circle
cx="9"
cy="9"
fill="#009858"
r="9"
/>
<path
d="M9.477 6.603l-.522.443-.444-.443a2.056 2.056 0 1 0-2.908 2.909l3.352 3.352 3.412-3.352c.803-.804.863-2.106.06-2.91a2.105 2.105 0 0 0-2.95 0z"
fill="#FFF"
/>
</g>
</svg>,
]
`;
exports[`renders <Id /> without throwing 1`] = ` exports[`renders <Id /> without throwing 1`] = `
Array [ Array [
<svg <svg
@ -2419,123 +2076,6 @@ Array [
] ]
`; `;
exports[`renders <Import /> without throwing 1`] = `
Array [
<svg
height="18"
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 15 18"
width="15"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0,11H2v5H13V11h2v7H0Zm7.7,2.8.4-.5L12,8.76l-.6-.7L8,12V0H7V12L3.6,8.06l-.6.7L7.5,14Z"
fill="#464646"
/>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 15 18"
width="15"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0,11H2v5H13V11h2v7H0Zm7.7,2.8.4-.5L12,8.76l-.6-.7L8,12V0H7V12L3.6,8.06l-.6.7L7.5,14Z"
fill="#FFF"
/>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 15 18"
width="15"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0,11H2v5H13V11h2v7H0Zm7.7,2.8.4-.5L12,8.76l-.6-.7L8,12V0H7V12L3.6,8.06l-.6.7L7.5,14Z"
fill={undefined}
/>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(90deg)",
}
}
viewBox="0 0 15 18"
width="15"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0,11H2v5H13V11h2v7H0Zm7.7,2.8.4-.5L12,8.76l-.6-.7L8,12V0H7V12L3.6,8.06l-.6.7L7.5,14Z"
fill="#464646"
/>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(180deg)",
}
}
viewBox="0 0 15 18"
width="15"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0,11H2v5H13V11h2v7H0Zm7.7,2.8.4-.5L12,8.76l-.6-.7L8,12V0H7V12L3.6,8.06l-.6.7L7.5,14Z"
fill="#464646"
/>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(-90deg)",
}
}
viewBox="0 0 15 18"
width="15"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0,11H2v5H13V11h2v7H0Zm7.7,2.8.4-.5L12,8.76l-.6-.7L8,12V0H7V12L3.6,8.06l-.6.7L7.5,14Z"
fill="#464646"
/>
</svg>,
<svg
height="18"
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 15 18"
width="15"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0,11H2v5H13V11h2v7H0Zm7.7,2.8.4-.5L12,8.76l-.6-.7L8,12V0H7V12L3.6,8.06l-.6.7L7.5,14Z"
fill="#464646"
/>
</svg>,
]
`;
exports[`renders <InstanceCount /> without throwing 1`] = ` exports[`renders <InstanceCount /> without throwing 1`] = `
Array [ Array [
<svg <svg

View File

@ -7,7 +7,6 @@ import {
Affinity, Affinity,
Arrow, Arrow,
Bin, Bin,
Checkcircle,
Clipboard, Clipboard,
Close, Close,
Cns, Cns,
@ -21,9 +20,7 @@ import {
Fabric, Fabric,
Firewall, Firewall,
General, General,
Health,
Id, Id,
Import,
InstanceCount, InstanceCount,
InstanceType, InstanceType,
Instances, Instances,
@ -130,24 +127,6 @@ it('renders <Bin /> without throwing', () => {
).toMatchSnapshot(); ).toMatchSnapshot();
}); });
it('renders <Checkcircle /> without throwing', () => {
expect(
renderer
.create(
<Fragment>
<Checkcircle colors={colors} />
<Checkcircle colors={colors} light />
<Checkcircle colors={colors} disabled />
<Checkcircle colors={colors} direction="right" />
<Checkcircle colors={colors} direction="up" />
<Checkcircle colors={colors} direction="left" />
<Checkcircle colors={colors} direction="down" />
</Fragment>
)
.toJSON()
).toMatchSnapshot();
});
it('renders <Clipboard /> without throwing', () => { it('renders <Clipboard /> without throwing', () => {
expect( expect(
renderer renderer
@ -382,24 +361,6 @@ it('renders <General /> without throwing', () => {
).toMatchSnapshot(); ).toMatchSnapshot();
}); });
it('renders <Health /> without throwing', () => {
expect(
renderer
.create(
<Fragment>
<Health colors={colors} />
<Health colors={colors} light />
<Health colors={colors} disabled />
<Health colors={colors} direction="right" />
<Health colors={colors} direction="up" />
<Health colors={colors} direction="left" />
<Health colors={colors} direction="down" />
</Fragment>
)
.toJSON()
).toMatchSnapshot();
});
it('renders <Id /> without throwing', () => { it('renders <Id /> without throwing', () => {
expect( expect(
renderer renderer
@ -418,24 +379,6 @@ it('renders <Id /> without throwing', () => {
).toMatchSnapshot(); ).toMatchSnapshot();
}); });
it('renders <Import /> without throwing', () => {
expect(
renderer
.create(
<Fragment>
<Import colors={colors} />
<Import colors={colors} light />
<Import colors={colors} disabled />
<Import colors={colors} direction="right" />
<Import colors={colors} direction="up" />
<Import colors={colors} direction="left" />
<Import colors={colors} direction="down" />
</Fragment>
)
.toJSON()
).toMatchSnapshot();
});
it('renders <InstanceCount /> without throwing', () => { it('renders <InstanceCount /> without throwing', () => {
expect( expect(
renderer renderer

View File

@ -1,114 +0,0 @@
import React from 'react';
import remcalc from 'remcalc';
import Rotate from './rotate';
export const Tick = props => (
<svg
width="9"
height="9"
viewBox="0 0 9 9"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
fillRule="evenodd"
d="M7.316 0L3.254 5.477l-1.55-2.165L0 4.495 3.223 9 9 1.21z"
/>
</svg>
);
export const Completed = ({ colors = {}, ...props }) => (
<svg
width="18"
height="18"
viewBox="0 0 18 18"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
fill={colors.greenDark}
fill-rule="evenodd"
d="M9 18A9 9 0 1 0 9 0a9 9 0 0 0 0 18z"
/>
<path
fill-rule="evenodd"
fill={colors.white}
d="M12.017 5l-3.896 5.336-1.487-2.109L5 9.379l3.091 4.389 5.541-7.589L12.017 5z"
/>
</svg>
);
export const PartCompleted = ({ colors = {}, ...props }) => (
<svg
width="18"
height="18"
viewBox="0 0 18 18"
style={{ padding: '1px' }}
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
fill={colors.white}
fillRule="evenodd"
d="M9 18A9 9 0 1 0 9 0a9 9 0 0 0 0 18z"
/>
<path
fill={colors.greenDark}
d="M9 19c5.523 0 10-4.477 10-10h-2a8 8 0 0 1-8 8v2zM19 9C19 3.477 14.523-1 9-1v2a8 8 0 0 1 8 8h2zM9-1C3.477-1-1 3.477-1 9h2a8 8 0 0 1 8-8v-2zM-1 9c0 5.523 4.477 10 10 10v-2a8 8 0 0 1-8-8h-2z"
/>
<path
fill={colors.text}
fillRule="evenodd"
d="M12.316 5l-4.062 5.477-1.55-2.165L5 9.495 8.223 14 14 6.21 12.316 5z"
/>
</svg>
);
export const Incomplete = ({ colors = {}, ...props }) => (
<svg
width="18"
height="18"
viewBox="0 0 18 18"
xmlns="http://www.w3.org/2000/svg"
style={{ padding: remcalc(1) }}
{...props}
>
<path
fill={colors.white}
fillRule="evenodd"
d="M9 18A9 9 0 1 0 9 0a9 9 0 0 0 0 18z"
/>
<path
fill={colors.text}
d="M9 19c5.523 0 10-4.477 10-10h-2a8 8 0 0 1-8 8v2zM19 9C19 3.477 14.523-1 9-1v2a8 8 0 0 1 8 8h2zM9-1C3.477-1-1 3.477-1 9h2a8 8 0 0 1 8-8v-2zM-1 9c0 5.523 4.477 10 10 10v-2a8 8 0 0 1-8-8h-2z"
/>
</svg>
);
export default ({
fill,
checked,
border,
direction = 'down',
style = {},
...rest
}) => (
<Rotate direction={direction}>
{({ style: rotateStyle }) => {
if (fill && checked) {
return <Completed style={{ ...style, ...rotateStyle }} {...rest} />;
}
if (checked && border) {
return <PartCompleted style={{ ...style, ...rotateStyle }} {...rest} />;
}
if (checked) {
return <Tick style={{ ...style, ...rotateStyle }} {...rest} />;
}
return <Incomplete style={{ ...style, ...rotateStyle }} {...rest} />;
}}
</Rotate>
);

View File

@ -1,37 +0,0 @@
import React from 'react';
import Rotate from './rotate';
export default ({
healthy = true,
direction = 'down',
colors = {},
style = {},
...rest
}) => (
<Rotate direction={direction}>
{({ style: rotateStyle }) => (
<svg
width="18"
height="18"
viewBox="0 0 18 18"
xmlns="http://www.w3.org/2000/svg"
style={{ ...style, ...rotateStyle }}
{...rest}
>
<g fill-rule="evenodd">
<circle
fill={healthy ? colors.green : colors.orange}
cx="9"
cy="9"
r="9"
/>
<path
fill="#FFF"
d="M9.477 6.603l-.522.443-.444-.443a2.056 2.056 0 1 0-2.908 2.909l3.352 3.352 3.412-3.352c.803-.804.863-2.106.06-2.91a2.105 2.105 0 0 0-2.95 0z"
/>
</g>
</svg>
)}
</Rotate>
);

View File

@ -1,32 +0,0 @@
import React from 'react';
import Rotate from './rotate';
import calcFill from './fill';
export default ({
fill = null,
light = false,
disabled = false,
direction = 'down',
colors = {},
style = {},
...rest
}) => (
<Rotate direction={direction}>
{({ style: rotateStyle }) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width="15"
height="18"
viewBox="0 0 15 18"
style={{ ...style, ...rotateStyle }}
{...rest}
>
<path
fill={calcFill({ fill, disabled, light, colors })}
d="M0,11H2v5H13V11h2v7H0Zm7.7,2.8.4-.5L12,8.76l-.6-.7L8,12V0H7V12L3.6,8.06l-.6.7L7.5,14Z"
/>
</svg>
)}
</Rotate>
);

View File

@ -2,7 +2,6 @@ export { default as Actions } from './actions';
export { default as Affinity } from './affinity'; export { default as Affinity } from './affinity';
export { default as Arrow } from './arrow'; export { default as Arrow } from './arrow';
export { default as Bin } from './bin'; export { default as Bin } from './bin';
export { default as Checkcircle } from './checkcircle';
export { default as Clipboard } from './clipboard'; export { default as Clipboard } from './clipboard';
export { default as Close } from './close'; export { default as Close } from './close';
export { default as Cns } from './cns'; export { default as Cns } from './cns';
@ -17,9 +16,7 @@ export { default as Fabric } from './fabric';
// export { default as Filter } from './filter'; // export { default as Filter } from './filter';
export { default as Firewall } from './firewall'; export { default as Firewall } from './firewall';
export { default as General } from './general'; export { default as General } from './general';
export { default as Health } from './health';
export { default as Id } from './id'; export { default as Id } from './id';
export { default as Import } from './import';
export { default as InstanceCount } from './instance-count'; export { default as InstanceCount } from './instance-count';
export { default as InstanceType } from './instance-type'; export { default as InstanceType } from './instance-type';
export { default as Instances } from './instances'; export { default as Instances } from './instances';

View File

@ -11,8 +11,8 @@
"build": "NODE_ENV=production joyent-react-scripts build", "build": "NODE_ENV=production joyent-react-scripts build",
"lint-ci": "eslint . --ext .js --ext .md", "lint-ci": "eslint . --ext .js --ext .md",
"lint": "eslint . --fix --ext .js --ext .md", "lint": "eslint . --fix --ext .js --ext .md",
"test-ci": "NODE_ENV=test joyent-react-scripts test --env=jsdom --testPathIgnorePatterns='.ui.js'",
"test": "NODE_ENV=test joyent-react-scripts test --env=jsdom", "test": "NODE_ENV=test joyent-react-scripts test --env=jsdom",
"test-ci": "npm run test",
"prepublish": "echo 0" "prepublish": "echo 0"
}, },
"dependencies": { "dependencies": {
@ -62,8 +62,10 @@
"babel-preset-joyent-portal": "^6.0.1", "babel-preset-joyent-portal": "^6.0.1",
"eslint": "^4.13.1", "eslint": "^4.13.1",
"eslint-config-joyent-portal": "^3.2.0", "eslint-config-joyent-portal": "^3.2.0",
"jest-image-snapshot": "^2.3.0",
"jest-styled-components": "^4.9.0", "jest-styled-components": "^4.9.0",
"joyent-react-scripts": "^7.2.0", "joyent-react-scripts": "^7.2.0",
"react-screenshot-renderer": "^1.1.0",
"react-test-renderer": "^16.2.0", "react-test-renderer": "^16.2.0",
"redrun": "^5.10.0" "redrun": "^5.10.0"
} }

View File

@ -51,7 +51,8 @@ const fullTheme = {
7: remcalc(42), 7: remcalc(42),
8: remcalc(48), 8: remcalc(48),
9: remcalc(54), 9: remcalc(54),
10: remcalc(60) 10: remcalc(60),
'14px': remcalc(14)
} }
}; };

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -695,7 +695,7 @@ exports[`renders <Hostname values /> without throwing 1`] = `
background-color: rgb(250,250,250); background-color: rgb(250,250,250);
color: rgb(216,216,216); color: rgb(216,216,216);
cursor: not-allowed; cursor: not-allowed;
font-family: "Roboto Mono"; font-family: "Roboto Mono",monospace;
width: 100%; width: 100%;
font-size: 0.9375rem; font-size: 0.9375rem;
line-height: normal !important; line-height: normal !important;

View File

@ -512,7 +512,6 @@ exports[`renders <KeyValue /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
} }
.c6 { .c6 {
@ -1730,7 +1729,6 @@ exports[`renders <KeyValue input="input" /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
} }
.c6 { .c6 {
@ -2684,7 +2682,6 @@ exports[`renders <KeyValue input="textarea" /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
} }
.c6 { .c6 {
@ -2971,7 +2968,7 @@ exports[`renders <KeyValue input="textarea" /> without throwing 1`] = `
background-color: rgb(255,255,255); background-color: rgb(255,255,255);
border: 0.0625rem solid rgb(216,216,216); border: 0.0625rem solid rgb(216,216,216);
color: rgba(73,73,73,1); color: rgba(73,73,73,1);
font-family: "Roboto Mono"; font-family: "Roboto Mono",monospace;
width: 100%; width: 100%;
text-overflow: ellipsis; text-overflow: ellipsis;
resize: vertical; resize: vertical;
@ -3769,7 +3766,6 @@ exports[`renders <KeyValue method="add" /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
} }
.c6 { .c6 {
@ -4757,7 +4753,6 @@ exports[`renders <KeyValue method="edit" /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
} }
.c0 { .c0 {
@ -5831,7 +5826,6 @@ exports[`renders <KeyValue removing /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
} }
.c6 { .c6 {
@ -6925,7 +6919,6 @@ exports[`renders <KeyValue submitting /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
} }
.c6 { .c6 {
@ -7955,7 +7948,6 @@ exports[`renders <KeyValue type="tag" /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
} }
.c6 { .c6 {

View File

@ -4167,62 +4167,6 @@ exports[`renders <Network {...network} fabric /> without throwing 1`] = `
</div> </div>
</div> </div>
</div> </div>
<div
className="c23"
>
<div
className="c24"
disabled={false}
name="card"
>
<div
className="c25"
disabled={false}
name="card-header"
onClick={undefined}
>
<div
className="c26"
disabled={false}
name="card-header-meta"
>
<div
className="c27"
>
<p
className="c17"
>
Instances on network
</p>
</div>
</div>
<div
className="c5"
disabled={false}
name="card-header-box"
>
<svg
className=""
height="6"
innerRef={undefined}
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 9.6 6"
width="9.6"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9.6,1.12,8.24,0,4.8,3.5,1.36,0,0,1.12,4.8,6Z"
fill="rgba(73, 73, 73, 1)"
/>
</svg>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -5045,136 +4989,6 @@ exports[`renders <Network {...network} infoExpanded /> without throwing 1`] = `
margin-bottom: 0.4375rem; margin-bottom: 0.4375rem;
} }
.c30 {
box-sizing: content-box;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex: 1 0 auto;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
position: relative;
border-width: 0.0625rem;
border-style: solid;
-webkit-transition: all 300ms ease;
transition: all 300ms ease;
color: rgba(73,73,73,1);
background-color: rgb(255,255,255);
border-color: rgb(216,216,216);
cursor: pointer;
min-height: auto;
height: 2.875rem;
-webkit-flex: 0 0 2.875rem;
-ms-flex: 0 0 2.875rem;
flex: 0 0 2.875rem;
}
.c31 {
box-sizing: content-box;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex: 1 0 auto;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
position: relative;
border-width: 0.0625rem;
border-style: solid;
-webkit-transition: all 300ms ease;
transition: all 300ms ease;
color: rgba(73,73,73,1);
background-color: rgb(255,255,255);
border-color: rgb(216,216,216);
cursor: pointer;
min-height: auto;
height: 2.875rem;
-webkit-flex: 0 0 2.875rem;
-ms-flex: 0 0 2.875rem;
flex: 0 0 2.875rem;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
z-index: 1;
line-height: 1.5rem;
height: auto;
max-width: 100%;
margin: -0.0625rem -0.0625rem 0 -0.0625rem;
margin: -0.0625rem;
box-shadow: none;
}
.c31 button {
margin-bottom: 0;
margin-top: 0;
}
.c32 {
box-sizing: content-box;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex: 1 0 auto;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
position: relative;
border-width: 0.0625rem;
border-style: solid;
-webkit-transition: all 300ms ease;
transition: all 300ms ease;
color: rgba(73,73,73,1);
background-color: rgb(255,255,255);
border-color: rgb(216,216,216);
cursor: pointer;
min-height: auto;
height: 2.875rem;
-webkit-flex: 0 0 2.875rem;
-ms-flex: 0 0 2.875rem;
flex: 0 0 2.875rem;
box-sizing: border-box;
min-height: 2.9375rem;
max-width: 100%;
width: auto;
height: auto;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-items: stretch;
-webkit-box-align: stretch;
-ms-flex-align: stretch;
align-items: stretch;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
overflow: hidden;
background-color: transparent;
border-width: 0;
box-shadow: none;
color: inherit;
}
.c24 { .c24 {
box-sizing: content-box; box-sizing: content-box;
display: -webkit-box; display: -webkit-box;
@ -5285,7 +5099,7 @@ exports[`renders <Network {...network} infoExpanded /> without throwing 1`] = `
border: 0.0625rem solid rgb(216,216,216); border: 0.0625rem solid rgb(216,216,216);
color: rgba(73,73,73,1); color: rgba(73,73,73,1);
width: 22.1875rem; width: 22.1875rem;
font-family: "Roboto Mono"; font-family: "Roboto Mono",monospace;
max-width: 22.1875rem; max-width: 22.1875rem;
font-size: 0.9375rem; font-size: 0.9375rem;
line-height: normal !important; line-height: normal !important;
@ -5827,62 +5641,6 @@ exports[`renders <Network {...network} infoExpanded /> without throwing 1`] = `
</div> </div>
</div> </div>
</div> </div>
<div
className="c23"
>
<div
className="c30"
disabled={false}
name="card"
>
<div
className="c31"
disabled={false}
name="card-header"
onClick={undefined}
>
<div
className="c32"
disabled={false}
name="card-header-meta"
>
<div
className="c25"
>
<p
className="c17"
>
Instances on network
</p>
</div>
</div>
<div
className="c5"
disabled={false}
name="card-header-box"
>
<svg
className=""
height="6"
innerRef={undefined}
style={
Object {
"transform": "rotate(0deg)",
}
}
viewBox="0 0 9.6 6"
width="9.6"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9.6,1.12,8.24,0,4.8,3.5,1.36,0,0,1.12,4.8,6Z"
fill="rgba(73, 73, 73, 1)"
/>
</svg>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -377,7 +377,6 @@ exports[`renders <AddForm /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
} }
.c16 { .c16 {
@ -1399,7 +1398,6 @@ exports[`renders <EditForm /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
} }
.c16 { .c16 {

View File

@ -0,0 +1,71 @@
import React from 'react';
import { toMatchImageSnapshot } from 'jest-image-snapshot';
import renderer from 'react-test-renderer';
import screenshot from 'react-screenshot-renderer';
import { Header, HostnamesHeader, AddServiceForm, Hostname } from '../cns';
import Theme from '@mocks/theme';
expect.extend({
toMatchImageSnapshot
});
it('<Header/>', async () => {
expect(
await screenshot(
<Theme ss>
<Header />
</Theme>
)
).toMatchImageSnapshot();
});
it('<HostnamesHeader />', async () => {
expect(
await screenshot(
<Theme ss>
<HostnamesHeader />
</Theme>
)
).toMatchImageSnapshot();
});
it('<AddServiceForm />', async () => {
expect(
await screenshot(
<Theme ss>
<AddServiceForm />
</Theme>
)
).toMatchImageSnapshot();
});
it('<AddServiceForm pristine />', async () => {
expect(
await screenshot(
<Theme ss>
<AddServiceForm pristine />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Hostname />', async () => {
expect(
await screenshot(
<Theme ss>
<Hostname values={[]} />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Hostname values />', async () => {
expect(
await screenshot(
<Theme ss>
<Hostname values={['111', '111']} />
</Theme>
)
).toMatchImageSnapshot();
});

View File

@ -2,7 +2,14 @@ import React, { Fragment } from 'react';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
import 'jest-styled-components'; import 'jest-styled-components';
import Firewall, { Rules, TagRules, DefaultRules, ToggleFirewallForm, ToggleInactiveForm } from '../firewall'; import Firewall, {
Rules,
TagRules,
DefaultRules,
ToggleFirewallForm,
ToggleInactiveForm
} from '../firewall';
import Theme from '@mocks/theme'; import Theme from '@mocks/theme';
const rules = [ const rules = [

View File

@ -0,0 +1,257 @@
import React, { Fragment } from 'react';
import { toMatchImageSnapshot } from 'jest-image-snapshot';
import renderer from 'react-test-renderer';
import screenshot from 'react-screenshot-renderer';
import Firewall, {
Rules,
TagRules,
DefaultRules,
ToggleFirewallForm,
ToggleInactiveForm
} from '../firewall';
import Theme from '@mocks/theme';
expect.extend({
toMatchImageSnapshot
});
const rules = [
{
id: '3473327e-6d0c-4747-97c5-ced1260a7e42',
enabled: true,
rule_str: 'FROM any TO all vms ALLOW icmp TYPE 8 CODE 0',
rule_obj: {
from: [['wildcard', 'any']],
to: [['wildcard', 'vmall']],
action: 'allow',
protocol: {
name: 'icmp',
targets: ['8:0']
},
isWildcard: true,
tags: []
},
global: true,
description: null
},
{
id: '24d55d2f-12ba-4935-9de9-ac305b8a40a5',
enabled: true,
rule_str: 'FROM any TO all vms ALLOW icmp6 TYPE all',
rule_obj: {
from: [['wildcard', 'any']],
to: [['wildcard', 'vmall']],
action: 'allow',
protocol: {
name: 'icmp6',
targets: ['all']
},
isWildcard: true,
tags: []
},
global: true,
description: 'allow all ICMPv6 types'
},
{
id: '4bd8b2e2-981b-474b-9b8b-0b53fecb4b71',
enabled: false,
rule_str: 'FROM all vms TO all vms ALLOW tcp PORT all',
rule_obj: {
from: [['wildcard', 'vmall']],
to: [['wildcard', 'vmall']],
action: 'allow',
protocol: {
name: 'tcp',
targets: ['all']
},
isWildcard: true,
tags: []
},
global: null,
description: null
},
{
id: 'af549024-b3b1-43bf-8a66-49c2b2dc5640',
enabled: false,
rule_str: 'FROM all vms TO all vms ALLOW tcp PORT all',
rule_obj: {
from: [['wildcard', 'vmall']],
to: [['wildcard', 'vmall']],
action: 'allow',
protocol: {
name: 'tcp',
targets: ['all']
},
isWildcard: true,
tags: []
},
global: null,
description: null
},
{
id: '9e5a152a-582b-4525-909e-f9c55deb7f03',
enabled: false,
rule_str: 'FROM any TO tag "wat" ALLOW tcp PORT all',
rule_obj: {
from: [['wildcard', 'any']],
to: [['tag', 'wat']],
action: 'allow',
protocol: {
name: 'tcp',
targets: ['all']
},
isWildcard: false,
tags: ['wat']
},
global: null,
description: null
}
];
it('<Rules/>', async () => {
expect(
await screenshot(
<Theme ss>
<Rules />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Rules rules />', async () => {
expect(
await screenshot(
<Theme ss>
<Rules rules={rules} />
</Theme>
)
).toMatchImageSnapshot();
});
it('<DefaultRules />', async () => {
expect(
await screenshot(
<Theme ss>
<DefaultRules />
</Theme>
)
).toMatchImageSnapshot();
});
it('<DefaultRules rules />', async () => {
expect(
await screenshot(
<Theme ss>
<DefaultRules rules={rules} />
</Theme>
)
).toMatchImageSnapshot();
});
it('<TagRules />', async () => {
expect(
await screenshot(
<Theme ss>
<TagRules />
</Theme>
)
).toMatchImageSnapshot();
});
it('<TagRules rules />', async () => {
expect(
await screenshot(
<Theme ss>
<TagRules rules={rules} />
</Theme>
)
).toMatchImageSnapshot();
});
it('<ToggleFirewallForm />', async () => {
expect(
await screenshot(
<Theme ss>
<ToggleFirewallForm />
</Theme>
)
).toMatchImageSnapshot();
});
it('<ToggleFirewallForm submitting />', async () => {
expect(
await screenshot(
<Theme ss>
<ToggleFirewallForm submitting />
</Theme>
)
).toMatchImageSnapshot();
});
it('<ToggleInactiveForm />', async () => {
expect(
await screenshot(
<Theme ss>
<ToggleInactiveForm />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Firewall />', async () => {
expect(
await screenshot(
<Theme ss>
<Firewall />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Firewall defaultRules />', async () => {
expect(
await screenshot(
<Theme ss>
<Fragment>
<Firewall
defaultRules={rules.filter(({ rule_obj }) => !rule_obj.tags.length)}
enabled
/>
<Firewall
defaultRules={rules.filter(({ rule_obj }) => !rule_obj.tags.length)}
/>
</Fragment>
</Theme>
)
).toMatchImageSnapshot();
});
it('<Firewall tagRules />', async () => {
expect(
await screenshot(
<Theme ss>
<Fragment>
<Firewall
tagRules={rules.filter(({ rule_obj }) => rule_obj.tags.length)}
enabled
/>
<Firewall
tagRules={rules.filter(({ rule_obj }) => rule_obj.tags.length)}
/>
</Fragment>
</Theme>
)
).toMatchImageSnapshot();
});
it('<Firewall enabled />', async () => {
expect(
await screenshot(
<Theme ss>
<Firewall enabled />
</Theme>
)
).toMatchImageSnapshot();
});

View File

@ -0,0 +1,101 @@
import React from 'react';
import { toMatchImageSnapshot } from 'jest-image-snapshot';
import renderer from 'react-test-renderer';
import screenshot from 'react-screenshot-renderer';
import { KeyValue } from '../key-value';
import Theme from '@mocks/theme';
expect.extend({
toMatchImageSnapshot
});
it('<KeyValue />', async () => {
expect(
await screenshot(
<Theme ss>
<KeyValue />
</Theme>
)
).toMatchImageSnapshot();
});
it('<KeyValue expanded={false} />', async () => {
expect(
await screenshot(
<Theme ss>
<KeyValue expanded={false} />
</Theme>
)
).toMatchImageSnapshot();
});
it('<KeyValue input="input" />', async () => {
expect(
await screenshot(
<Theme ss>
<KeyValue input="input" />
</Theme>
)
).toMatchImageSnapshot();
});
it('<KeyValue input="textarea" />', async () => {
expect(
await screenshot(
<Theme ss>
<KeyValue input="textarea" />
</Theme>
)
).toMatchImageSnapshot();
});
it('<KeyValue type="tag" />', async () => {
expect(
await screenshot(
<Theme ss>
<KeyValue type="tag" />
</Theme>
)
).toMatchImageSnapshot();
});
it('<KeyValue method="add" />', async () => {
expect(
await screenshot(
<Theme ss>
<KeyValue method="add" />
</Theme>
)
).toMatchImageSnapshot();
});
it('<KeyValue method="edit" />', async () => {
expect(
await screenshot(
<Theme ss>
<KeyValue method="edit" />
</Theme>
)
).toMatchImageSnapshot();
});
it('<KeyValue removing />', async () => {
expect(
renderer.create(
<Theme ss>
<KeyValue removing />
</Theme>
)
).toMatchImageSnapshot();
});
it('<KeyValue submitting />', async () => {
expect(
renderer.create(
<Theme ss>
<KeyValue submitting />
</Theme>
)
).toMatchImageSnapshot();
});

View File

@ -1,5 +1,3 @@
/* eslint-disable camelcase */
import React from 'react'; import React from 'react';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
import 'jest-styled-components'; import 'jest-styled-components';

View File

@ -0,0 +1,180 @@
import React from 'react';
import { toMatchImageSnapshot } from 'jest-image-snapshot';
import renderer from 'react-test-renderer';
import screenshot from 'react-screenshot-renderer';
import { Collapsed, Expanded } from '../network';
import Theme from '@mocks/theme';
expect.extend({
toMatchImageSnapshot
});
it('<Network />', async () => {
expect(
await screenshot(
<Theme ss>
<Expanded />
</Theme>
)
).toMatchImageSnapshot();
expect(
await screenshot(
<Theme ss>
<Collapsed />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Network {...network} />', async () => {
const network = {
id: '1',
name: 'name',
description: 'description',
fabric: false,
subnet: '255.255.255.0',
provision_start_ip: '192.168.1.2',
provision_end_ip: '192.168.1.253',
selected: false,
infoExpanded: false
};
expect(
await screenshot(
<Theme ss>
<Expanded {...network} />
</Theme>
)
).toMatchImageSnapshot();
expect(
await screenshot(
<Theme ss>
<Collapsed {...network} />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Network {...network} />', async () => {
const network = {
id: '1',
name: 'name',
description: 'description',
fabric: false,
subnet: '255.255.255.0',
provision_start_ip: '192.168.1.2',
provision_end_ip: '192.168.1.253',
selected: false,
infoExpanded: false
};
expect(
await screenshot(
<Theme ss>
<Expanded {...network} />
</Theme>
)
).toMatchImageSnapshot();
expect(
await screenshot(
<Theme ss>
<Collapsed {...network} />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Network {...network} public />', async () => {
const network = {
id: '1',
name: 'name',
description: 'description',
fabric: false,
subnet: '255.255.255.0',
provision_start_ip: '192.168.1.2',
provision_end_ip: '192.168.1.253',
selected: false,
infoExpanded: false,
public: true
};
expect(
await screenshot(
<Theme ss>
<Expanded {...network} />
</Theme>
)
).toMatchImageSnapshot();
expect(
await screenshot(
<Theme ss>
<Collapsed {...network} />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Network {...network} fabric />', async () => {
const network = {
id: '1',
name: 'name',
description: 'description',
fabric: true,
subnet: '255.255.255.0',
provision_start_ip: '192.168.1.2',
provision_end_ip: '192.168.1.253',
selected: false,
infoExpanded: false
};
expect(
await screenshot(
<Theme ss>
<Expanded {...network} />
</Theme>
)
).toMatchImageSnapshot();
expect(
await screenshot(
<Theme ss>
<Collapsed {...network} />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Network {...network} infoExpanded />', async () => {
const network = {
id: '1',
name: 'name',
description: 'description',
fabric: true,
subnet: '255.255.255.0',
provision_start_ip: '192.168.1.2',
provision_end_ip: '192.168.1.253',
selected: false,
infoExpanded: true
};
expect(
await screenshot(
<Theme ss>
<Expanded {...network} />
</Theme>
)
).toMatchImageSnapshot();
expect(
await screenshot(
<Theme ss>
<Collapsed {...network} />
</Theme>
)
).toMatchImageSnapshot();
});

View File

@ -0,0 +1,51 @@
import React from 'react';
import { toMatchImageSnapshot } from 'jest-image-snapshot';
import renderer from 'react-test-renderer';
import screenshot from 'react-screenshot-renderer';
import Tag, { AddForm, EditForm } from '../tags';
import Theme from '@mocks/theme';
expect.extend({
toMatchImageSnapshot
});
it('renders <AddForm /> without throwing', async () => {
expect(
await screenshot(
<Theme ss>
<AddForm />
</Theme>
)
).toMatchImageSnapshot();
});
it('renders <EditForm /> without throwing', async () => {
expect(
await screenshot(
<Theme ss>
<EditForm />
</Theme>
)
).toMatchImageSnapshot();
});
it('renders <Tag /> without throwing', async () => {
expect(
await screenshot(
<Theme ss>
<Tag />
</Theme>
)
).toMatchImageSnapshot();
});
it('renders <Tag name value/> without throwing', async () => {
expect(
await screenshot(
<Theme ss>
<Tag name="name" value="value" />
</Theme>
)
).toMatchImageSnapshot();
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -44,7 +44,7 @@ exports[`renders <Rule/> without throwing 1`] = `
margin-bottom: 2rem; margin-bottom: 2rem;
} }
.c8 { .c12 {
margin-right: 0.25rem; margin-right: 0.25rem;
} }
@ -76,6 +76,51 @@ exports[`renders <Rule/> without throwing 1`] = `
} }
.c5 { .c5 {
width: 4.125rem;
position: relative;
padding: 0.75rem;
padding-right: 1.5625rem;
width: auto;
border: none;
border-bottom: 0.0625rem solid rgba(73,73,73,1);
border-radius: 0;
background: transparent;
padding: 0;
padding-right: 0.75rem;
display: inline;
height: 1.5rem;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
min-height: 0;
color: rgb(216,216,216);
margin: 0 0.375rem;
}
.c7 {
width: 5.625rem;
position: relative;
padding: 0.75rem;
padding-right: 1.5625rem;
width: auto;
border: none;
border-bottom: 0.0625rem solid rgba(73,73,73,1);
border-radius: 0;
background: transparent;
padding: 0;
padding-right: 0.75rem;
display: inline;
height: 1.5rem;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
min-height: 0;
color: rgb(216,216,216);
margin: 0 0.375rem;
}
.c10 {
width: 7.5rem;
position: relative; position: relative;
padding: 0.75rem; padding: 0.75rem;
padding-right: 1.5625rem; padding-right: 1.5625rem;
@ -120,7 +165,7 @@ exports[`renders <Rule/> without throwing 1`] = `
-webkit-padding-after: 0; -webkit-padding-after: 0;
} }
.c9 { .c13 {
box-sizing: border-box; box-sizing: border-box;
width: 18.75rem; width: 18.75rem;
height: 3rem; height: 3rem;
@ -156,41 +201,41 @@ exports[`renders <Rule/> without throwing 1`] = `
outline: 0; outline: 0;
} }
.c9::-webkit-input-placeholder { .c13::-webkit-input-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9::-moz-placeholder { .c13::-moz-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9:-ms-input-placeholder { .c13:-ms-input-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9:invalid { .c13:invalid {
box-shadow: none; box-shadow: none;
} }
.c9:disabled { .c13:disabled {
background-color: rgb(250,250,250); background-color: rgb(250,250,250);
color: rgb(216,216,216); color: rgb(216,216,216);
cursor: not-allowed; cursor: not-allowed;
} }
.c9:disabled::-webkit-input-placeholder { .c13:disabled::-webkit-input-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9:disabled::-moz-placeholder { .c13:disabled::-moz-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9:disabled:-ms-input-placeholder { .c13:disabled:-ms-input-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9:focus { .c13:focus {
border-color: rgb(59,70,204); border-color: rgb(59,70,204);
outline: 0; outline: 0;
} }
@ -227,7 +272,7 @@ exports[`renders <Rule/> without throwing 1`] = `
right: 0.375rem; right: 0.375rem;
} }
.c7 { .c9 {
position: relative; position: relative;
display: -webkit-inline-box; display: -webkit-inline-box;
display: -webkit-inline-flex; display: -webkit-inline-flex;
@ -242,7 +287,7 @@ exports[`renders <Rule/> without throwing 1`] = `
margin-left: 0; margin-left: 0;
} }
.c7:after { .c9:after {
content: ''; content: '';
width: 0.625rem; width: 0.625rem;
height: 0.625rem; height: 0.625rem;
@ -256,7 +301,7 @@ exports[`renders <Rule/> without throwing 1`] = `
right: 0.75rem; right: 0.75rem;
} }
.c7:after { .c9:after {
right: 0.375rem; right: 0.375rem;
} }
@ -285,6 +330,8 @@ exports[`renders <Rule/> without throwing 1`] = `
appearance: none; appearance: none;
min-height: 0; min-height: 0;
max-width: 22.1875rem; max-width: 22.1875rem;
width: 4.125rem;
max-width: 4.125rem;
text-overflow: ellipsis; text-overflow: ellipsis;
font-size: 0.9375rem; font-size: 0.9375rem;
line-height: normal !important; line-height: normal !important;
@ -335,6 +382,160 @@ exports[`renders <Rule/> without throwing 1`] = `
outline: 0; outline: 0;
} }
.c8 {
box-sizing: border-box;
width: 18.75rem;
height: 3rem;
min-height: 3rem;
margin-bottom: 0.5rem;
margin-top: 0.5rem;
padding: 0.8125rem 1.125rem;
border-radius: 0.25rem;
background-color: rgb(255,255,255);
border: 0.0625rem solid rgb(216,216,216);
color: rgba(73,73,73,1);
border: none;
border-bottom: 0.0625rem solid rgba(73,73,73,1);
border-radius: 0;
background: transparent;
padding: 0;
padding-right: 0.75rem;
display: inline;
height: 1.5rem;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
min-height: 0;
max-width: 22.1875rem;
width: 5.625rem;
max-width: 5.625rem;
text-overflow: ellipsis;
font-size: 0.9375rem;
line-height: normal !important;
font-style: normal;
font-stretch: normal;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: 0;
}
.c8::-webkit-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c8::-moz-placeholder {
color: rgba(73,73,73,0.5);
}
.c8:-ms-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c8:invalid {
box-shadow: none;
}
.c8:disabled {
background-color: rgb(250,250,250);
color: rgb(216,216,216);
cursor: not-allowed;
}
.c8:disabled::-webkit-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c8:disabled::-moz-placeholder {
color: rgba(73,73,73,0.5);
}
.c8:disabled:-ms-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c8:focus {
border-color: rgb(59,70,204);
outline: 0;
}
.c11 {
box-sizing: border-box;
width: 18.75rem;
height: 3rem;
min-height: 3rem;
margin-bottom: 0.5rem;
margin-top: 0.5rem;
padding: 0.8125rem 1.125rem;
border-radius: 0.25rem;
background-color: rgb(255,255,255);
border: 0.0625rem solid rgb(216,216,216);
color: rgba(73,73,73,1);
border: none;
border-bottom: 0.0625rem solid rgba(73,73,73,1);
border-radius: 0;
background: transparent;
padding: 0;
padding-right: 0.75rem;
display: inline;
height: 1.5rem;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
min-height: 0;
max-width: 22.1875rem;
width: 7.5rem;
max-width: 7.5rem;
text-overflow: ellipsis;
font-size: 0.9375rem;
line-height: normal !important;
font-style: normal;
font-stretch: normal;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: 0;
}
.c11::-webkit-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c11::-moz-placeholder {
color: rgba(73,73,73,0.5);
}
.c11:-ms-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c11:invalid {
box-shadow: none;
}
.c11:disabled {
background-color: rgb(250,250,250);
color: rgb(216,216,216);
cursor: not-allowed;
}
.c11:disabled::-webkit-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c11:disabled::-moz-placeholder {
color: rgba(73,73,73,0.5);
}
.c11:disabled:-ms-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c11:focus {
border-color: rgb(59,70,204);
outline: 0;
}
<div <div
className="c0" className="c0"
> >
@ -356,12 +557,14 @@ exports[`renders <Rule/> without throwing 1`] = `
<div <div
className="c4" className="c4"
disabled={false} disabled={false}
width="4.125rem"
> >
<select <select
className="c5 c6" className="c5 c6"
disabled={false} disabled={false}
id="k" id="k"
onBlur={undefined} onBlur={undefined}
width="4.125rem"
> >
<option <option
value="must" value="must"
@ -390,12 +593,14 @@ exports[`renders <Rule/> without throwing 1`] = `
<div <div
className="c4" className="c4"
disabled={false} disabled={false}
width="5.625rem"
> >
<select <select
className="c5 c6" className="c7 c8"
disabled={false} disabled={false}
id="l" id="l"
onBlur={undefined} onBlur={undefined}
width="5.625rem"
> >
<option <option
value="same" value="same"
@ -422,14 +627,16 @@ exports[`renders <Rule/> without throwing 1`] = `
style={undefined} style={undefined}
> >
<div <div
className="c7" className="c9"
disabled={false} disabled={false}
width="7.5rem"
> >
<select <select
className="c5 c6" className="c10 c11"
disabled={false} disabled={false}
id="m" id="m"
onBlur={undefined} onBlur={undefined}
width="7.5rem"
> >
<option <option
value="name" value="name"
@ -451,17 +658,19 @@ exports[`renders <Rule/> without throwing 1`] = `
style={undefined} style={undefined}
> >
<div <div
className="c8" className="c12"
> >
<div <div
className="c4" className="c4"
disabled={false} disabled={false}
width="7.5rem"
> >
<select <select
className="c5 c6" className="c10 c11"
disabled={false} disabled={false}
id="n" id="n"
onBlur={undefined} onBlur={undefined}
width="7.5rem"
> >
<option <option
value="equalling" value="equalling"
@ -499,7 +708,7 @@ exports[`renders <Rule/> without throwing 1`] = `
style={undefined} style={undefined}
> >
<input <input
className="c9" className="c13"
disabled={false} disabled={false}
id="o" id="o"
onBlur={null} onBlur={null}
@ -517,7 +726,7 @@ exports[`renders <Rule/> without throwing 2`] = `
margin-bottom: 2rem; margin-bottom: 2rem;
} }
.c8 { .c12 {
margin-right: 0.25rem; margin-right: 0.25rem;
} }
@ -549,6 +758,51 @@ exports[`renders <Rule/> without throwing 2`] = `
} }
.c5 { .c5 {
width: 4.125rem;
position: relative;
padding: 0.75rem;
padding-right: 1.5625rem;
width: auto;
border: none;
border-bottom: 0.0625rem solid rgba(73,73,73,1);
border-radius: 0;
background: transparent;
padding: 0;
padding-right: 0.75rem;
display: inline;
height: 1.5rem;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
min-height: 0;
color: rgb(216,216,216);
margin: 0 0.375rem;
}
.c7 {
width: 5.625rem;
position: relative;
padding: 0.75rem;
padding-right: 1.5625rem;
width: auto;
border: none;
border-bottom: 0.0625rem solid rgba(73,73,73,1);
border-radius: 0;
background: transparent;
padding: 0;
padding-right: 0.75rem;
display: inline;
height: 1.5rem;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
min-height: 0;
color: rgb(216,216,216);
margin: 0 0.375rem;
}
.c10 {
width: 7.5rem;
position: relative; position: relative;
padding: 0.75rem; padding: 0.75rem;
padding-right: 1.5625rem; padding-right: 1.5625rem;
@ -593,7 +847,7 @@ exports[`renders <Rule/> without throwing 2`] = `
-webkit-padding-after: 0; -webkit-padding-after: 0;
} }
.c9 { .c13 {
box-sizing: border-box; box-sizing: border-box;
width: 18.75rem; width: 18.75rem;
height: 3rem; height: 3rem;
@ -629,41 +883,41 @@ exports[`renders <Rule/> without throwing 2`] = `
outline: 0; outline: 0;
} }
.c9::-webkit-input-placeholder { .c13::-webkit-input-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9::-moz-placeholder { .c13::-moz-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9:-ms-input-placeholder { .c13:-ms-input-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9:invalid { .c13:invalid {
box-shadow: none; box-shadow: none;
} }
.c9:disabled { .c13:disabled {
background-color: rgb(250,250,250); background-color: rgb(250,250,250);
color: rgb(216,216,216); color: rgb(216,216,216);
cursor: not-allowed; cursor: not-allowed;
} }
.c9:disabled::-webkit-input-placeholder { .c13:disabled::-webkit-input-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9:disabled::-moz-placeholder { .c13:disabled::-moz-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9:disabled:-ms-input-placeholder { .c13:disabled:-ms-input-placeholder {
color: rgba(73,73,73,0.5); color: rgba(73,73,73,0.5);
} }
.c9:focus { .c13:focus {
border-color: rgb(59,70,204); border-color: rgb(59,70,204);
outline: 0; outline: 0;
} }
@ -700,7 +954,7 @@ exports[`renders <Rule/> without throwing 2`] = `
right: 0.375rem; right: 0.375rem;
} }
.c7 { .c9 {
position: relative; position: relative;
display: -webkit-inline-box; display: -webkit-inline-box;
display: -webkit-inline-flex; display: -webkit-inline-flex;
@ -715,7 +969,7 @@ exports[`renders <Rule/> without throwing 2`] = `
margin-left: 0; margin-left: 0;
} }
.c7:after { .c9:after {
content: ''; content: '';
width: 0.625rem; width: 0.625rem;
height: 0.625rem; height: 0.625rem;
@ -729,7 +983,7 @@ exports[`renders <Rule/> without throwing 2`] = `
right: 0.75rem; right: 0.75rem;
} }
.c7:after { .c9:after {
right: 0.375rem; right: 0.375rem;
} }
@ -758,6 +1012,8 @@ exports[`renders <Rule/> without throwing 2`] = `
appearance: none; appearance: none;
min-height: 0; min-height: 0;
max-width: 22.1875rem; max-width: 22.1875rem;
width: 4.125rem;
max-width: 4.125rem;
text-overflow: ellipsis; text-overflow: ellipsis;
font-size: 0.9375rem; font-size: 0.9375rem;
line-height: normal !important; line-height: normal !important;
@ -808,6 +1064,160 @@ exports[`renders <Rule/> without throwing 2`] = `
outline: 0; outline: 0;
} }
.c8 {
box-sizing: border-box;
width: 18.75rem;
height: 3rem;
min-height: 3rem;
margin-bottom: 0.5rem;
margin-top: 0.5rem;
padding: 0.8125rem 1.125rem;
border-radius: 0.25rem;
background-color: rgb(255,255,255);
border: 0.0625rem solid rgb(216,216,216);
color: rgba(73,73,73,1);
border: none;
border-bottom: 0.0625rem solid rgba(73,73,73,1);
border-radius: 0;
background: transparent;
padding: 0;
padding-right: 0.75rem;
display: inline;
height: 1.5rem;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
min-height: 0;
max-width: 22.1875rem;
width: 5.625rem;
max-width: 5.625rem;
text-overflow: ellipsis;
font-size: 0.9375rem;
line-height: normal !important;
font-style: normal;
font-stretch: normal;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: 0;
}
.c8::-webkit-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c8::-moz-placeholder {
color: rgba(73,73,73,0.5);
}
.c8:-ms-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c8:invalid {
box-shadow: none;
}
.c8:disabled {
background-color: rgb(250,250,250);
color: rgb(216,216,216);
cursor: not-allowed;
}
.c8:disabled::-webkit-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c8:disabled::-moz-placeholder {
color: rgba(73,73,73,0.5);
}
.c8:disabled:-ms-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c8:focus {
border-color: rgb(59,70,204);
outline: 0;
}
.c11 {
box-sizing: border-box;
width: 18.75rem;
height: 3rem;
min-height: 3rem;
margin-bottom: 0.5rem;
margin-top: 0.5rem;
padding: 0.8125rem 1.125rem;
border-radius: 0.25rem;
background-color: rgb(255,255,255);
border: 0.0625rem solid rgb(216,216,216);
color: rgba(73,73,73,1);
border: none;
border-bottom: 0.0625rem solid rgba(73,73,73,1);
border-radius: 0;
background: transparent;
padding: 0;
padding-right: 0.75rem;
display: inline;
height: 1.5rem;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
min-height: 0;
max-width: 22.1875rem;
width: 7.5rem;
max-width: 7.5rem;
text-overflow: ellipsis;
font-size: 0.9375rem;
line-height: normal !important;
font-style: normal;
font-stretch: normal;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: 0;
}
.c11::-webkit-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c11::-moz-placeholder {
color: rgba(73,73,73,0.5);
}
.c11:-ms-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c11:invalid {
box-shadow: none;
}
.c11:disabled {
background-color: rgb(250,250,250);
color: rgb(216,216,216);
cursor: not-allowed;
}
.c11:disabled::-webkit-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c11:disabled::-moz-placeholder {
color: rgba(73,73,73,0.5);
}
.c11:disabled:-ms-input-placeholder {
color: rgba(73,73,73,0.5);
}
.c11:focus {
border-color: rgb(59,70,204);
outline: 0;
}
<div <div
className="c0" className="c0"
> >
@ -829,12 +1239,14 @@ exports[`renders <Rule/> without throwing 2`] = `
<div <div
className="c4" className="c4"
disabled={false} disabled={false}
width="4.125rem"
> >
<select <select
className="c5 c6" className="c5 c6"
disabled={false} disabled={false}
id="p" id="p"
onBlur={undefined} onBlur={undefined}
width="4.125rem"
> >
<option <option
value="must" value="must"
@ -863,12 +1275,14 @@ exports[`renders <Rule/> without throwing 2`] = `
<div <div
className="c4" className="c4"
disabled={false} disabled={false}
width="5.625rem"
> >
<select <select
className="c5 c6" className="c7 c8"
disabled={false} disabled={false}
id="q" id="q"
onBlur={undefined} onBlur={undefined}
width="5.625rem"
> >
<option <option
value="same" value="same"
@ -895,14 +1309,16 @@ exports[`renders <Rule/> without throwing 2`] = `
style={undefined} style={undefined}
> >
<div <div
className="c7" className="c9"
disabled={false} disabled={false}
width="7.5rem"
> >
<select <select
className="c5 c6" className="c10 c11"
disabled={false} disabled={false}
id="r" id="r"
onBlur={undefined} onBlur={undefined}
width="7.5rem"
> >
<option <option
value="name" value="name"
@ -924,17 +1340,19 @@ exports[`renders <Rule/> without throwing 2`] = `
style={undefined} style={undefined}
> >
<div <div
className="c8" className="c12"
> >
<div <div
className="c4" className="c4"
disabled={false} disabled={false}
width="7.5rem"
> >
<select <select
className="c5 c6" className="c10 c11"
disabled={false} disabled={false}
id="s" id="s"
onBlur={undefined} onBlur={undefined}
width="7.5rem"
> >
<option <option
value="equalling" value="equalling"
@ -972,7 +1390,7 @@ exports[`renders <Rule/> without throwing 2`] = `
style={undefined} style={undefined}
> >
<input <input
className="c9" className="c13"
disabled={false} disabled={false}
id="t" id="t"
onBlur={null} onBlur={null}

View File

@ -2,6 +2,7 @@
exports[`renders <Name /> without throwing 1`] = ` exports[`renders <Name /> without throwing 1`] = `
.c6 { .c6 {
margin-top: undefined;
margin-left: 0.25rem; margin-left: 0.25rem;
} }
@ -278,8 +279,6 @@ exports[`renders <Name /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
margin-left: 0;
} }
.c2 { .c2 {
@ -397,12 +396,6 @@ exports[`renders <Name /> without throwing 1`] = `
<div <div
className="c1" className="c1"
> >
<label
className="c3"
htmlFor=""
>
</label>
<div <div
className="c6" className="c6"
> >
@ -457,6 +450,7 @@ exports[`renders <Name /> without throwing 1`] = `
exports[`renders <Name expanded /> without throwing 1`] = ` exports[`renders <Name expanded /> without throwing 1`] = `
.c6 { .c6 {
margin-top: undefined;
margin-left: 0.25rem; margin-left: 0.25rem;
} }
@ -733,8 +727,6 @@ exports[`renders <Name expanded /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
margin-left: 0;
} }
.c2 { .c2 {
@ -852,12 +844,6 @@ exports[`renders <Name expanded /> without throwing 1`] = `
<div <div
className="c1" className="c1"
> >
<label
className="c3"
htmlFor=""
>
</label>
<div <div
className="c6" className="c6"
> >
@ -912,6 +898,7 @@ exports[`renders <Name expanded /> without throwing 1`] = `
exports[`renders <Name name="test" /> without throwing 1`] = ` exports[`renders <Name name="test" /> without throwing 1`] = `
.c6 { .c6 {
margin-top: undefined;
margin-left: 0.25rem; margin-left: 0.25rem;
} }
@ -1188,8 +1175,6 @@ exports[`renders <Name name="test" /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
margin-left: 0;
} }
.c2 { .c2 {
@ -1307,12 +1292,6 @@ exports[`renders <Name name="test" /> without throwing 1`] = `
<div <div
className="c1" className="c1"
> >
<label
className="c3"
htmlFor=""
>
</label>
<div <div
className="c6" className="c6"
> >
@ -1367,6 +1346,7 @@ exports[`renders <Name name="test" /> without throwing 1`] = `
exports[`renders <Name pristine={false} /> without throwing 1`] = ` exports[`renders <Name pristine={false} /> without throwing 1`] = `
.c6 { .c6 {
margin-top: undefined;
margin-left: 0.25rem; margin-left: 0.25rem;
} }
@ -1643,8 +1623,6 @@ exports[`renders <Name pristine={false} /> without throwing 1`] = `
float: right; float: right;
font-size: 0.8125rem; font-size: 0.8125rem;
float: none; float: none;
margin-left: 1.75rem;
margin-left: 0;
} }
.c2 { .c2 {
@ -1762,12 +1740,6 @@ exports[`renders <Name pristine={false} /> without throwing 1`] = `
<div <div
className="c1" className="c1"
> >
<label
className="c3"
htmlFor=""
>
</label>
<div <div
className="c6" className="c6"
> >

View File

@ -0,0 +1,84 @@
import React from 'react';
import { toMatchImageSnapshot } from 'jest-image-snapshot';
import renderer from 'react-test-renderer';
import screenshot from 'react-screenshot-renderer';
import { Rule, Header } from '../affinity';
import Theme from '@mocks/theme';
expect.extend({
toMatchImageSnapshot
});
it('<Rule/>', async () => {
expect(
await screenshot(
<Theme ss>
<Rule />
</Theme>
)
).toMatchImageSnapshot();
});
it('<Rule/>', async () => {
expect(
await screenshot(
<Theme ss>
<Rule
rule={{
'rule-instance-name': 'test',
'rule-instance-conditional': 'must',
'rule-instance-placement': 'same',
'rule-instance-tag-value-pattern': 'equalling',
'rule-instance-name-pattern': 'equalling',
'rule-instance-tag-value': '',
'rule-instance-tag-key': '',
'rule-type': 'name'
}}
/>
</Theme>
)
).toMatchImageSnapshot();
});
it('<Header />', async () => {
expect(
await screenshot(
<Theme ss>
<Header
rule={{
'rule-instance-name': 'test',
'rule-instance-conditional': 'must',
'rule-instance-placement': 'same',
'rule-instance-tag-value-pattern': 'equalling',
'rule-instance-name-pattern': 'equalling',
'rule-instance-tag-value': '',
'rule-instance-tag-key': '',
'rule-type': 'name'
}}
/>
</Theme>
)
).toMatchImageSnapshot();
});
it('<Header tag/>', async () => {
expect(
await screenshot(
<Theme ss>
<Header
rule={{
'rule-instance-name': 'test',
'rule-instance-conditional': 'must',
'rule-instance-placement': 'same',
'rule-instance-tag-value-pattern': 'equalling',
'rule-instance-name-pattern': 'equalling',
'rule-instance-tag-value': 'one',
'rule-instance-tag-key': 'two',
'rule-type': 'tag'
}}
/>
</Theme>
)
).toMatchImageSnapshot();
});

Some files were not shown because too many files have changed in this diff Show More