Skip to content

Commit

Permalink
Add test for a custom function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pattie Reaves committed Oct 18, 2020
1 parent eaa340d commit a2fd9e5
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 1 deletion.
143 changes: 143 additions & 0 deletions __tests__/__snapshots__/index.spec.js.snap
Expand Up @@ -453,6 +453,149 @@ exports[`<Select/> component <Select/> renders with clearable 1`] = `
</div>
`;

exports[`<Select/> component <Select/> renders with custom search function 1`] = `
.emotion-6 {
box-sizing: border-box;
position: relative;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
border: 1px solid #ccc;
width: 100%;
border-radius: 2px;
padding: 2px 5px;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
direction: ltr;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
cursor: pointer;
min-height: 36px;
pointer-events: all;
}
.emotion-6:hover,
.emotion-6:focus-within {
border-color: #0074D9;
}
.emotion-6:focus,
.emotion-6:focus-within {
outline: 0;
box-shadow: 0 0 0 3px rgba(0,116,217,0.2);
}
.emotion-6 * {
box-sizing: border-box;
}
.emotion-2 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
.emotion-0 {
line-height: inherit;
border: none;
margin-left: 5px;
background: transparent;
font-size: smaller;
}
.emotion-0:focus {
outline: none;
}
.emotion-4 {
text-align: center;
pointer-events: none;
margin: 0 0 0 5px;
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
cursor: pointer;
}
.emotion-4 svg {
width: 16px;
height: 16px;
}
.emotion-4:hover path {
stroke: #0074D9;
}
.emotion-4:focus {
outline: none;
}
.emotion-4:focus path {
stroke: #0074D9;
}
<div>
<div
className="react-dropdown-select undefined emotion-6 emotion-7"
color="#0074D9"
direction="ltr"
disabled={false}
onClick={[Function]}
onKeyDown={[Function]}
tabIndex="0"
>
<div
className="react-dropdown-select-content react-dropdown-select-type-single emotion-2 emotion-3"
onClick={[Function]}
>
<input
className="react-dropdown-select-input emotion-0 emotion-1"
disabled={false}
onBlur={[Function]}
onChange={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyPress={[Function]}
placeholder="Select..."
readOnly={false}
size={9}
tabIndex="-1"
value=""
/>
</div>
<div
className="react-dropdown-select-dropdown-handle emotion-4 emotion-5"
color="#0074D9"
onClick={[Function]}
onKeyDown={[Function]}
onKeyPress={[Function]}
rotate={1}
tabIndex="-1"
>
<svg
fill="currentColor"
viewBox="0 0 40 40"
>
<path
d="M31 26.4q0 .3-.2.5l-1.1 1.2q-.3.2-.6.2t-.5-.2l-8.7-8.8-8.8 8.8q-.2.2-.5.2t-.5-.2l-1.2-1.2q-.2-.2-.2-.5t.2-.5l10.4-10.4q.3-.2.6-.2t.5.2l10.4 10.4q.2.2.2.5z"
/>
</svg>
</div>
</div>
</div>
`;

exports[`<Select/> component <Select/> renders with loading 1`] = `
.emotion-8 {
box-sizing: border-box;
Expand Down
8 changes: 7 additions & 1 deletion __tests__/index.spec.js
Expand Up @@ -59,9 +59,15 @@ describe('<Select/> component', () => {
expect(tree).toMatchSnapshot();
});

it('<Select/> renders with custom search function', () => {
const tree = selectWithProps(<Select {...props({ searchFn: () => {} })} />).toJSON();

expect(tree).toMatchSnapshot();
});

it('<Select/> is disabled', () => {
const tree = selectWithProps(<Select {...props({ disabled: true })} />).toJSON();

expect(tree).toMatchSnapshot();
})
});
});

0 comments on commit a2fd9e5

Please sign in to comment.