react-tabs-component
Advanced tools
Comparing version 1.0.9 to 1.1.0
@@ -154,2 +154,28 @@ | ||
it('Returning false from within willChange prevents tabs from changing',function(){ | ||
var willChange=function(){ | ||
return false; | ||
}; | ||
var didChange=jest.genMockFunction(); | ||
var main=TestUtils.renderIntoDocument( | ||
<Tabs | ||
defaultTabNum={1} | ||
tabNames={['Tab A','Tab B','Tab C']} | ||
willChange={willChange} | ||
didChange={didChange} | ||
> | ||
<section>Tab A Content</section> | ||
<section>Tab B Content</section> | ||
<section>Tab C Content</section> | ||
</Tabs> | ||
); | ||
var tabB=TestUtils.scryRenderedDOMComponentsWithTag(main,'span')[1]; | ||
Simulate.click(tabB); | ||
//var section=TestUtils.findRenderedDOMComponentWithTag(main,'section'); | ||
//expect(section.getDOMNode().textContent).toEqual('Tab C Content'); | ||
expect(didChange).not.toBeCalled(); | ||
}); | ||
it('Exposes `setActiveTabNum(num,callback)` and `getActiveTabNum()` public methods',function(){ | ||
@@ -156,0 +182,0 @@ |
{ | ||
"name": "react-tabs-component", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "Tabs Component for React with the simplest API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -90,3 +90,3 @@ # react-tabs-component # | ||
- `willChange`—fires before the tab changes. | ||
- `willChange`—fires before the tab changes. Return `false` from `willChange` to prevent the active tab from changing. | ||
- `didChange`—fires after the tab changes. | ||
@@ -93,0 +93,0 @@ |
@@ -42,4 +42,6 @@ var React=require('react/addons'); | ||
this.props.willChange(newActiveTabNum,oldActiveTabNum); | ||
var allowChange=this.props.willChange(newActiveTabNum,oldActiveTabNum); | ||
if (typeof allowChange !== 'undefined' && !allowChange){ | ||
return; | ||
} | ||
var callback=function(){ | ||
@@ -46,0 +48,0 @@ this.props.didChange(newActiveTabNum,oldActiveTabNum); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12000
225