Skip to content

Commit

Permalink
Added tests for facetCount support in CheckBox and RadioButton compon…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
Carlo Bernardini committed Nov 22, 2018
1 parent a7c56ed commit 5ac7747
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 0 deletions.
13 changes: 13 additions & 0 deletions __tests__/CheckBox.spec.js
Expand Up @@ -49,4 +49,17 @@ describe('<CheckBox />', () => {

expect(wrapper).toMatchSnapshot();
});

it('should render a checkbox with facet count', () => {
const wrapper = shallow(
<CheckBox
id="testCheckbox"
label="Test checkbox"
value="test"
facetCount={ 123 }
/>
);

expect(wrapper).toMatchSnapshot();
});
});
14 changes: 14 additions & 0 deletions __tests__/RadioButton.spec.js
Expand Up @@ -48,4 +48,18 @@ describe('<RadioButton />', () => {

expect(wrapper).toMatchSnapshot();
});

it('should render a radio button with facet count', () => {
const wrapper = shallow(
<RadioButton
id="testRadio1"
name="testRadioGroup"
label="Test radio"
value="test"
facetCount={ 123 }
/>
);

expect(wrapper).toMatchSnapshot();
});
});
52 changes: 52 additions & 0 deletions __tests__/__snapshots__/CheckBox.spec.js.snap
Expand Up @@ -47,6 +47,58 @@ exports[`<CheckBox /> should render a checkbox 1`] = `
</div>
`;

exports[`<CheckBox /> should render a checkbox with facet count 1`] = `
<div
className="orizzonte__checkbox"
>
<input
checked={false}
className="orizzonte__checkbox-input"
disabled={false}
id="testCheckbox"
onChange={[Function]}
type="checkbox"
value="test"
/>
<label
className="orizzonte__checkbox-label"
htmlFor="testCheckbox"
>
<span
className="orizzonte__checkbox-span orizzonte__checkbox-span--first"
>
<svg
className="orizzonte__checkbox-svg"
height="10px"
viewBox={
Array [
0,
0,
10,
10,
]
}
width="12px"
>
<polyline
points="1.5 6 3.5 9 8 3"
/>
</svg>
</span>
<span
className="orizzonte__checkbox-span orizzonte__checkbox-span--last"
>
Test checkbox
</span>
<span
className="orizzonte__checkbox-span orizzonte__checkbox-span--count"
>
123
</span>
</label>
</div>
`;

exports[`<CheckBox /> should render a disabled checkbox 1`] = `
<div
className="orizzonte__checkbox orizzonte__checkbox--disabled"
Expand Down
55 changes: 55 additions & 0 deletions __tests__/__snapshots__/RadioButton.spec.js.snap
Expand Up @@ -100,6 +100,61 @@ exports[`<RadioButton /> should render a radio button 1`] = `
</div>
`;

exports[`<RadioButton /> should render a radio button with facet count 1`] = `
<div
className="orizzonte__radio"
>
<input
checked={false}
className="orizzonte__radio-input"
disabled={false}
id="testRadio1"
name="testRadioGroup"
onChange={[Function]}
type="radio"
value="test"
/>
<label
className="orizzonte__radio-label"
htmlFor="testRadio1"
>
<span
className="orizzonte__radio-span orizzonte__radio-span--first"
>
<svg
className="orizzonte__radio-svg"
height="10px"
viewBox={
Array [
0,
0,
10,
10,
]
}
width="12px"
>
<circle
cx="5"
cy="6"
r="3"
/>
</svg>
</span>
<span
className="orizzonte__radio-span orizzonte__radio-span--last"
>
Test radio
</span>
<span
className="orizzonte__radio-span orizzonte__radio-span--count"
>
123
</span>
</label>
</div>
`;

exports[`<RadioButton /> should render a selected radio button 1`] = `
<div
className="orizzonte__radio"
Expand Down

0 comments on commit 5ac7747

Please sign in to comment.