Skip to content

Commit

Permalink
ran lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kparkerson committed Nov 3, 2018
1 parent d2f3fac commit ae7d0e6
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Example extends React.Component {

this.state = {
counter2value: 10,
counter3value: 10
counter3value: 10,
};
}

Expand Down Expand Up @@ -65,34 +65,19 @@ class Example extends React.Component {
<h1 className="slds-text-title_caps slds-p-vertical_medium">
5. Disabled counter input
</h1>
<Input
disabled
label="My Label"
variant="counter"
value="10"
/>
<Input disabled label="My Label" variant="counter" value="10" />
</div>
<div>
<h1 className="slds-text-title_caps slds-p-vertical_medium">
6. Static counter input
</h1>
<Input
isStatic
label="My Label"
variant="counter"
value="10"
/>
<Input isStatic label="My Label" variant="counter" value="10" />
</div>
<div>
<h1 className="slds-text-title_caps slds-p-vertical_medium">
7. Readonly counter input
</h1>
<Input
label="My Label"
readOnly
variant="counter"
value="10"
/>
<Input label="My Label" readOnly variant="counter" value="10" />
</div>
</IconSettings>
);
Expand Down
82 changes: 61 additions & 21 deletions components/input/__tests__/input.browser-test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {
findRenderedDOMComponentWithClass,
} = TestUtils;

describe.only('SLDSInput', () => {
describe('SLDSInput', () => {
const defaultProps = {
placeholder: 'Placeholder Text',
};
Expand Down Expand Up @@ -509,7 +509,7 @@ describe.only('SLDSInput', () => {
});
});

describe.only('Counter Input', () => {
describe('Counter Input', () => {
let changeOccurred;
let component;
let decrement;
Expand All @@ -527,30 +527,56 @@ describe.only('SLDSInput', () => {
onChangeData = data;
},
value: 1,
variant: 'counter'
variant: 'counter',
});
decrement = findRenderedDOMComponentWithClass(component, 'slds-input__button_decrement');
increment = findRenderedDOMComponentWithClass(component, 'slds-input__button_increment');
decrement = findRenderedDOMComponentWithClass(
component,
'slds-input__button_decrement'
);
increment = findRenderedDOMComponentWithClass(
component,
'slds-input__button_increment'
);
input = findRenderedDOMComponentWithTag(component, 'input');

onChangeData = {};
TestUtils.Simulate.mouseDown(increment);
TestUtils.Simulate.mouseUp(increment);
expect(onChangeData.number === 2 && onChangeData.value === '2').to.be.true;
expect(onChangeData.number === 2 && onChangeData.value === '2').to.be
.true;

onChangeData = {};
TestUtils.Simulate.keyDown(increment, { key: 'Enter', keyCode: 13, which: 13 });
TestUtils.Simulate.keyUp(increment, { key: 'Enter', keyCode: 13, which: 13 });
expect(onChangeData.number === 2 && onChangeData.value === '2').to.be.true;
TestUtils.Simulate.keyDown(increment, {
key: 'Enter',
keyCode: 13,
which: 13,
});
TestUtils.Simulate.keyUp(increment, {
key: 'Enter',
keyCode: 13,
which: 13,
});
expect(onChangeData.number === 2 && onChangeData.value === '2').to.be
.true;

TestUtils.Simulate.mouseDown(decrement);
TestUtils.Simulate.mouseUp(decrement);
expect(onChangeData.number === 0 && onChangeData.value === '0').to.be.true;
expect(onChangeData.number === 0 && onChangeData.value === '0').to.be
.true;

onChangeData = {};
TestUtils.Simulate.keyDown(decrement, { key: 'Enter', keyCode: 13, which: 13 });
TestUtils.Simulate.keyUp(decrement, { key: 'Enter', keyCode: 13, which: 13 });
expect(onChangeData.number === 0 && onChangeData.value === '0').to.be.true;
TestUtils.Simulate.keyDown(decrement, {
key: 'Enter',
keyCode: 13,
which: 13,
});
TestUtils.Simulate.keyUp(decrement, {
key: 'Enter',
keyCode: 13,
which: 13,
});
expect(onChangeData.number === 0 && onChangeData.value === '0').to.be
.true;
});

it('respects min and max values', () => {
Expand All @@ -561,10 +587,16 @@ describe.only('SLDSInput', () => {
changeOccurred = true;
},
value: 1,
variant: 'counter'
variant: 'counter',
});
decrement = findRenderedDOMComponentWithClass(component, 'slds-input__button_decrement');
increment = findRenderedDOMComponentWithClass(component, 'slds-input__button_increment');
decrement = findRenderedDOMComponentWithClass(
component,
'slds-input__button_decrement'
);
increment = findRenderedDOMComponentWithClass(
component,
'slds-input__button_increment'
);
input = findRenderedDOMComponentWithTag(component, 'input');

changeOccurred = false;
Expand All @@ -585,20 +617,28 @@ describe.only('SLDSInput', () => {
},
step: 0.1,
value: 1,
variant: 'counter'
variant: 'counter',
});
decrement = findRenderedDOMComponentWithClass(component, 'slds-input__button_decrement');
increment = findRenderedDOMComponentWithClass(component, 'slds-input__button_increment');
decrement = findRenderedDOMComponentWithClass(
component,
'slds-input__button_decrement'
);
increment = findRenderedDOMComponentWithClass(
component,
'slds-input__button_increment'
);
input = findRenderedDOMComponentWithTag(component, 'input');

onChangeData = {};
TestUtils.Simulate.mouseDown(increment);
TestUtils.Simulate.mouseUp(increment);
expect(onChangeData.number === 1.1 && onChangeData.value === '1.1').to.be.true;
expect(onChangeData.number === 1.1 && onChangeData.value === '1.1').to.be
.true;

TestUtils.Simulate.mouseDown(decrement);
TestUtils.Simulate.mouseUp(decrement);
expect(onChangeData.number === 0.9 && onChangeData.value === '0.9').to.be.true;
expect(onChangeData.number === 0.9 && onChangeData.value === '0.9').to.be
.true;
});
});
});
Loading

0 comments on commit ae7d0e6

Please sign in to comment.