Skip to content

Commit

Permalink
Merge pull request react-bootstrap#832 from AlexKVal/commaStyle
Browse files Browse the repository at this point in the history
Impose comma and one-var styles.
  • Loading branch information
AlexKVal committed Jun 15, 2015
2 parents d49ce21 + 55802fd commit 9352546
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
],
"rules": {
"comma-spacing": 2,
"comma-style": [2, "last"],
"one-var": [2, { "initialized": "never" }],
"key-spacing": 0,
"no-underscore-dangle": 0,
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
Expand Down
10 changes: 5 additions & 5 deletions docs/src/ComponentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const ComponentsPage = React.createClass({
},

componentDidMount() {
let elem = React.findDOMNode(this.refs.sideNav),
domUtils = Affix.domUtils,
sideNavOffsetTop = domUtils.getOffset(elem).top,
sideNavMarginTop = parseInt(domUtils.getComputedStyles(elem.firstChild).marginTop, 10),
topNavHeight = React.findDOMNode(this.refs.topNav).offsetHeight;
let elem = React.findDOMNode(this.refs.sideNav);
let domUtils = Affix.domUtils;
let sideNavOffsetTop = domUtils.getOffset(elem).top;
let sideNavMarginTop = parseInt(domUtils.getComputedStyles(elem.firstChild).marginTop, 10);
let topNavHeight = React.findDOMNode(this.refs.topNav).offsetHeight;

this.setState({
navOffsetTop: sideNavOffsetTop - topNavHeight - sideNavMarginTop,
Expand Down
6 changes: 3 additions & 3 deletions src/CollapsibleNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const CollapsibleNav = React.createClass({
for (let key in nodes) {
if (nodes.hasOwnProperty(key)) {

let n = React.findDOMNode(nodes[key])
, h = n.offsetHeight
, computedStyles = domUtils.getComputedStyles(n);
let n = React.findDOMNode(nodes[key]);
let h = n.offsetHeight;
let computedStyles = domUtils.getComputedStyles(n);

height += (h +
parseInt(computedStyles.marginTop, 10) +
Expand Down
4 changes: 2 additions & 2 deletions src/FadeMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export default {
},

componentWillUnmount() {
let els = getElementsAndSelf(React.findDOMNode(this), ['fade']),
container = (this.props.container && React.findDOMNode(this.props.container)) ||
let els = getElementsAndSelf(React.findDOMNode(this), ['fade']);
let container = (this.props.container && React.findDOMNode(this.props.container)) ||
domUtils.ownerDocument(this).body;

if (els.length) {
Expand Down
6 changes: 3 additions & 3 deletions src/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ const Nav = React.createClass({
},

getCollapsibleDimensionValue() {
let node = React.findDOMNode(this.refs.ul),
height = node.offsetHeight,
computedStyles = domUtils.getComputedStyles(node);
let node = React.findDOMNode(this.refs.ul);
let height = node.offsetHeight;
let computedStyles = domUtils.getComputedStyles(node);

return height + parseInt(computedStyles.marginTop, 10) + parseInt(computedStyles.marginBottom, 10);
},
Expand Down
24 changes: 12 additions & 12 deletions test/PanelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ describe('Panel', function () {
});

it('Should have custom component header', function () {
let header = <h3>Heading</h3>,
instance = ReactTestUtils.renderIntoDocument(
<Panel header={header}>Panel content</Panel>
);
let header = <h3>Heading</h3>;
let instance = ReactTestUtils.renderIntoDocument(
<Panel header={header}>Panel content</Panel>
);
header = React.findDOMNode(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'panel-heading'));
assert.equal(header.firstChild.nodeName, 'H3');
assert.ok(header.firstChild.className.match(/\bpanel-title\b/));
assert.equal(header.firstChild.innerHTML, 'Heading');
});

it('Should have custom component header with anchor', function () {
let header = <h3>Heading</h3>,
instance = ReactTestUtils.renderIntoDocument(
<Panel header={header} collapsible={true}>Panel content</Panel>
);
let header = <h3>Heading</h3>;
let instance = ReactTestUtils.renderIntoDocument(
<Panel header={header} collapsible={true}>Panel content</Panel>
);
header = React.findDOMNode(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'panel-heading'));
assert.equal(header.firstChild.nodeName, 'H3');
assert.ok(header.firstChild.className.match(/\bpanel-title\b/));
Expand All @@ -59,10 +59,10 @@ describe('Panel', function () {
});

it('Should have custom component header with custom class', function () {
let header = <h3 className="custom-class">Heading</h3>,
instance = ReactTestUtils.renderIntoDocument(
<Panel header={header}>Panel content</Panel>
);
let header = <h3 className="custom-class">Heading</h3>;
let instance = ReactTestUtils.renderIntoDocument(
<Panel header={header}>Panel content</Panel>
);
header = React.findDOMNode(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'panel-heading'));
assert.equal(header.firstChild.nodeName, 'H3');
assert.ok(header.firstChild.className.match(/\bpanel-title\b/));
Expand Down

0 comments on commit 9352546

Please sign in to comment.