From 333c6631caa980275e5d8e0a965d3e23b75c6977 Mon Sep 17 00:00:00 2001 From: AlexKVal Date: Tue, 28 Apr 2015 17:39:44 +0300 Subject: [PATCH] Move and refactor CollapsableNavSpec --- src/CollapsibleNav.js | 2 +- ...psableNavSpec.js => CollapsibleNavSpec.js} | 42 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) rename test/{CollapsableNavSpec.js => CollapsibleNavSpec.js} (77%) diff --git a/src/CollapsibleNav.js b/src/CollapsibleNav.js index 962757a05d..e8af629387 100644 --- a/src/CollapsibleNav.js +++ b/src/CollapsibleNav.js @@ -110,7 +110,7 @@ const CollapsibleNav = React.createClass({ activeKey: this.props.activeKey, activeHref: this.props.activeHref, onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect), - ref: 'collapsable_' + key, + ref: 'collapsible_' + key, key: key, navItem: true } diff --git a/test/CollapsableNavSpec.js b/test/CollapsibleNavSpec.js similarity index 77% rename from test/CollapsableNavSpec.js rename to test/CollapsibleNavSpec.js index ee4a3c206f..c7e2c46610 100644 --- a/test/CollapsableNavSpec.js +++ b/test/CollapsibleNavSpec.js @@ -1,22 +1,22 @@ import React from 'react'; import ReactTestUtils from 'react/lib/ReactTestUtils'; import Navbar from '../src/Navbar'; -import CollapsableNav from '../src/CollapsableNav'; +import CollapsibleNav from '../src/CollapsibleNav'; import Nav from '../src/Nav'; import NavItem from '../src/NavItem'; -describe('CollapsableNav', function () { +describe('CollapsibleNav', function () { it('Should create div and add collapse class', function () { let Parent = React.createClass({ render: function() { return ( - + - + ); } @@ -30,7 +30,7 @@ describe('CollapsableNav', function () { render: function() { return ( - + - + ); } }); let instance = ReactTestUtils.renderIntoDocument(); - assert.ok(ReactTestUtils.findRenderedComponentWithType(instance.refs.collapsable_object.refs.collapsable_0, Nav)); - assert.ok(ReactTestUtils.findRenderedComponentWithType(instance.refs.collapsable_object.refs.collapsable_1, Nav)); + assert.ok(ReactTestUtils.findRenderedComponentWithType(instance.refs.collapsible_object.refs.collapsible_0, Nav)); + assert.ok(ReactTestUtils.findRenderedComponentWithType(instance.refs.collapsible_object.refs.collapsible_1, Nav)); }); it('Should just render children and move along if not in ', function () { let Parent = React.createClass({ render: function() { return ( - + - + ); } }); let instance = ReactTestUtils.renderIntoDocument(); - let collapsableNav = ReactTestUtils.findRenderedComponentWithType(instance, CollapsableNav); - assert.notOk(collapsableNav.getDOMNode().className.match(/\navbar-collapse\b/)); - let nav = ReactTestUtils.findRenderedComponentWithType(collapsableNav.refs.nocollapse_0, Nav); + let collapsibleNav = ReactTestUtils.findRenderedComponentWithType(instance, CollapsibleNav); + assert.notOk(collapsibleNav.getDOMNode().className.match(/\navbar-collapse\b/)); + let nav = ReactTestUtils.findRenderedComponentWithType(collapsibleNav.refs.nocollapse_0, Nav); assert.ok(nav); }); @@ -74,20 +74,20 @@ describe('CollapsableNav', function () { render: function() { return ( - + - + ); } }); let instance = ReactTestUtils.renderIntoDocument(); - assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance.refs.collapsable_object.refs.collapsable_0, 'foo')); - assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance.refs.collapsable_object.refs.collapsable_0, 'bar')); - assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance.refs.collapsable_object.refs.collapsable_0, 'baz')); + assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance.refs.collapsible_object.refs.collapsible_0, 'foo')); + assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance.refs.collapsible_object.refs.collapsible_0, 'bar')); + assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance.refs.collapsible_object.refs.collapsible_0, 'baz')); }); it('Should should not duplicate classes', function () { @@ -95,18 +95,18 @@ describe('CollapsableNav', function () { render: function() { return ( - + - + ); } }); let instance = ReactTestUtils.renderIntoDocument(); - let classDOM = ReactTestUtils.findRenderedDOMComponentWithTag(instance.refs.collapsable_object, 'DIV').props.className + let classDOM = ReactTestUtils.findRenderedDOMComponentWithTag(instance.refs.collapsible_object, 'DIV').props.className , classArray = classDOM.split(' ') , idx = classArray.indexOf('navbar-collapse'); assert.equal(classArray.indexOf('navbar-collapse', idx+1), -1);