forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[changed] collapsable => collapsible property
Discussion is here react-bootstrap#425. Components are involved: - Nav - Panel - CollapsibleNav Current property type checking for `collapsable` in `PanelGroup` is needless and has been removed. Tests for deprecated `collapsable` property for all three components has been placed into one file `CollapsableNavSpec.js`
- Loading branch information
Showing
10 changed files
with
141 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import deprecationWarning from './deprecationWarning'; | ||
|
||
export default function collapsable(props, propName, componentName) { | ||
if (props[propName] !== undefined) { | ||
deprecationWarning( | ||
`${propName} in ${componentName}`, | ||
'collapsible', | ||
'https://github.com/react-bootstrap/react-bootstrap/issues/425' | ||
); | ||
} | ||
return React.PropTypes.bool.call(null, props, propName, componentName); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import React from 'react'; | ||
import ReactTestUtils from 'react/lib/ReactTestUtils'; | ||
import CollapsibleNav from '../src/CollapsibleNav'; | ||
import Nav from '../src/Nav'; | ||
import Panel from '../src/Panel'; | ||
import {shouldWarn} from './helpers'; | ||
|
||
describe('Deprecations for collapsable property in CollapsibleNav', function () { | ||
it('Should not warn about deprecation when collaps_i_ble property is used', function () { | ||
let Component = React.createClass({ | ||
render: function() { | ||
return ( | ||
<CollapsibleNav collapsible /> | ||
); | ||
} | ||
}); | ||
ReactTestUtils.renderIntoDocument(<Component />); | ||
|
||
console.warn.called.should.be.false; | ||
}); | ||
|
||
it('Should warn about deprecation when collaps_a_ble property is used', function () { | ||
let Component = React.createClass({ | ||
render: function() { | ||
return ( | ||
<CollapsibleNav collapsable /> | ||
); | ||
} | ||
}); | ||
ReactTestUtils.renderIntoDocument(<Component />); | ||
|
||
shouldWarn('deprecated'); | ||
}); | ||
}); | ||
|
||
describe('Deprecations for collapsable property in Panel', function () { | ||
it('Should not warn about deprecation when collaps_i_ble property is used', function () { | ||
let Component = React.createClass({ | ||
render: function() { | ||
return ( | ||
<Panel collapsible /> | ||
); | ||
} | ||
}); | ||
ReactTestUtils.renderIntoDocument(<Component />); | ||
|
||
console.warn.called.should.be.false; | ||
}); | ||
|
||
it('Should warn about deprecation when collaps_a_ble property is used', function () { | ||
let Component = React.createClass({ | ||
render: function() { | ||
return ( | ||
<Panel collapsable /> | ||
); | ||
} | ||
}); | ||
ReactTestUtils.renderIntoDocument(<Component />); | ||
|
||
shouldWarn('deprecated'); | ||
}); | ||
}); | ||
|
||
describe('Deprecations for collapsable property in Nav', function () { | ||
it('Should not warn about deprecation when collaps_i_ble property is used', function () { | ||
let Component = React.createClass({ | ||
render: function() { | ||
return ( | ||
<Nav collapsible /> | ||
); | ||
} | ||
}); | ||
ReactTestUtils.renderIntoDocument(<Component />); | ||
|
||
console.warn.called.should.be.false; | ||
}); | ||
|
||
it('Should warn about deprecation when collaps_a_ble property is used', function () { | ||
let Component = React.createClass({ | ||
render: function() { | ||
return ( | ||
<Nav collapsable /> | ||
); | ||
} | ||
}); | ||
ReactTestUtils.renderIntoDocument(<Component />); | ||
|
||
shouldWarn('deprecated'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters