Skip to content

Commit

Permalink
Merge pull request #206 from sofarsounds/develop
Browse files Browse the repository at this point in the history
Develop -> Master (Release 5.0.2)
  • Loading branch information
David Floegel authored Jan 2, 2020
2 parents 3d929d2 + d52c0c2 commit 78fb096
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sofarsounds/maestro",
"version": "5.0.1",
"version": "5.0.2",
"description": "The official sofar sounds react uikit library",
"main": "dist/index.js",
"scripts": {
Expand Down
14 changes: 10 additions & 4 deletions src/molecules/Select/Input.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const setup = (

describe('Select <Input />', () => {
it('it renders correctly', () => {
expect(setup()).toMatchSnapshot();
expect(
setup(false, 'I am a placeholder', false, 'testDataId')
).toMatchSnapshot();
});

it('it has the correct style properties when isOpen is false', () => {
Expand Down Expand Up @@ -56,10 +58,14 @@ describe('Select <Input />', () => {
expect(placeholder).toBe('I am a placeholder');
});

it('it adds a data-qaid', () => {
it('it adds a data-qaid on the InputWrapper, InputStyle, and Button', () => {
let wrapper = setup(true, 'cat', true, 'testDataId');
let qaid = wrapper.find('Input').props()['data-qaid'];
expect(qaid).toBe('testDataId');
let wrapperQaid = wrapper.find('Input').props()['data-qaid'];
expect(wrapperQaid).toBe('testDataId');
let inputQaid = wrapper.find('input').props()['data-qaid'];
expect(inputQaid).toBe('testDataId-input');
let buttonQaid = wrapper.find('button').props()['data-qaid'];
expect(buttonQaid).toBe('testDataId-toggle');
});

it('it handles no data-qaid', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/molecules/Select/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ const Input: React.SFC<Props> = ({
isOpen={isOpen}
placeholder={placeholder}
name={name}
data-qaid={`${qaId}-input`}
/>
<Button isOpen={isOpen}>
<Button isOpen={isOpen} type="button" data-qaid={`${qaId}-toggle`}>
<Icon name={isOpen ? 'caretUp' : 'caretDown'} />
</Button>
</InputWrapper>
Expand Down
6 changes: 5 additions & 1 deletion src/molecules/Select/Select.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ const setup = () =>
<div onClick={outsideClick} id="outside_idiot">
I am a idiot
</div>
<Select handleOptionClick={mockClick} placeholder={'I am placeholder'}>
<Select
handleOptionClick={mockClick}
placeholder="I am placeholder"
data-qaid="testQaId"
>
{({ optionClick }: any) =>
citiesData.map((cityData, index) => (
<Option key={index} value={cityData.value} onClick={optionClick} />
Expand Down
13 changes: 13 additions & 0 deletions src/molecules/Select/__snapshots__/Input.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -445,16 +445,19 @@ exports[`Select <Input /> it renders correctly 1`] = `
}
>
<Input
data-qaid="testDataId"
isOpen={false}
placeholder="I am a placeholder"
readonly={false}
toggleSelect={[MockFunction]}
>
<styled.div
data-qaid="testDataId"
isOpen={false}
onClick={[MockFunction]}
>
<StyledComponent
data-qaid="testDataId"
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down Expand Up @@ -487,14 +490,17 @@ exports[`Select <Input /> it renders correctly 1`] = `
>
<div
className="c0"
data-qaid="testDataId"
onClick={[MockFunction]}
>
<styled.input
data-qaid="testDataId-input"
isOpen={false}
placeholder="I am a placeholder"
readOnly={false}
>
<StyledComponent
data-qaid="testDataId-input"
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down Expand Up @@ -528,15 +534,19 @@ exports[`Select <Input /> it renders correctly 1`] = `
>
<input
className="c1"
data-qaid="testDataId-input"
placeholder="I am a placeholder"
readOnly={false}
/>
</StyledComponent>
</styled.input>
<styled.button
data-qaid="testDataId-toggle"
isOpen={false}
type="button"
>
<StyledComponent
data-qaid="testDataId-toggle"
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down Expand Up @@ -566,9 +576,12 @@ exports[`Select <Input /> it renders correctly 1`] = `
}
forwardedRef={null}
isOpen={false}
type="button"
>
<button
className="c2"
data-qaid="testDataId-toggle"
type="button"
>
<Icon
name="caretDown"
Expand Down
22 changes: 22 additions & 0 deletions src/molecules/Select/__snapshots__/Select.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,12 @@ exports[`Select renders correctly 1`] = `
I am a idiot
</div>
<Select
data-qaid="testQaId"
handleOptionClick={[MockFunction]}
placeholder="I am placeholder"
>
<Input
data-qaid="testQaId"
innerRef={
Object {
"current": .c3 {
Expand Down Expand Up @@ -759,14 +761,18 @@ exports[`Select renders correctly 1`] = `
<div
class="c0"
data-qaid="testQaId"
>
<input
class="c1"
data-qaid="testQaId-input"
placeholder="I am placeholder"
value=""
/>
<button
class="c2"
data-qaid="testQaId-toggle"
type="button"
>
<i
class="c3 icon-caretDown "
Expand All @@ -781,10 +787,12 @@ exports[`Select renders correctly 1`] = `
value=""
>
<styled.div
data-qaid="testQaId"
isOpen={false}
onClick={[Function]}
>
<StyledComponent
data-qaid="testQaId"
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down Expand Up @@ -815,14 +823,18 @@ exports[`Select renders correctly 1`] = `
Object {
"current": <div
class="c0"
data-qaid="testQaId"
>
<input
class="c1"
data-qaid="testQaId-input"
placeholder="I am placeholder"
value=""
/>
<button
class="c2"
data-qaid="testQaId-toggle"
type="button"
>
<i
class="c3 icon-caretDown "
Expand All @@ -836,14 +848,17 @@ exports[`Select renders correctly 1`] = `
>
<div
className="c0"
data-qaid="testQaId"
onClick={[Function]}
>
<styled.input
data-qaid="testQaId-input"
isOpen={false}
placeholder="I am placeholder"
value=""
>
<StyledComponent
data-qaid="testQaId-input"
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down Expand Up @@ -877,15 +892,19 @@ exports[`Select renders correctly 1`] = `
>
<input
className="c1"
data-qaid="testQaId-input"
placeholder="I am placeholder"
value=""
/>
</StyledComponent>
</styled.input>
<styled.button
data-qaid="testQaId-toggle"
isOpen={false}
type="button"
>
<StyledComponent
data-qaid="testQaId-toggle"
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down Expand Up @@ -915,9 +934,12 @@ exports[`Select renders correctly 1`] = `
}
forwardedRef={null}
isOpen={false}
type="button"
>
<button
className="c2"
data-qaid="testQaId-toggle"
type="button"
>
<Icon
name="caretDown"
Expand Down

0 comments on commit 78fb096

Please sign in to comment.