diff --git a/tests/Aside.test.js b/tests/Aside.test.js
index 17ae37ef..15e32696 100644
--- a/tests/Aside.test.js
+++ b/tests/Aside.test.js
@@ -2,7 +2,7 @@ import expect from 'expect'
import React from 'react'
import {renderToStaticMarkup as render} from 'react-dom/server'
-import { configure, mount } from 'enzyme'
+import { configure, mount, shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import { spy } from 'sinon'
@@ -12,7 +12,7 @@ configure({ adapter: new Adapter() });
describe('AppAside', () => {
it('renders aside with class="aside-menu"', () => {
- expect(render(aside))
+ expect(render(aside))
.toContain('')
});
it('calls componentDidMount', () => {
@@ -21,4 +21,14 @@ describe('AppAside', () => {
const wrapper = mount();
expect(AppAside.prototype.componentDidMount.calledOnce).toEqual(true);
});
-})
\ No newline at end of file
+ it('should call isHidden()', () => {
+ const isHidden = spy(AppAside.prototype, 'isHidden');
+ shallow();
+ expect(isHidden.called).toBe(true);
+ });
+ it('should call isOffCanvas()', () => {
+ const isOffCanvas = spy(AppAside.prototype, 'isOffCanvas');
+ shallow();
+ expect(isOffCanvas.called).toBe(true);
+ });
+})
diff --git a/tests/Footer.test.js b/tests/Footer.test.js
index e874ec4a..62d8c1ee 100644
--- a/tests/Footer.test.js
+++ b/tests/Footer.test.js
@@ -2,7 +2,7 @@ import expect from 'expect'
import React from 'react'
import {renderToStaticMarkup as render} from 'react-dom/server'
-import { configure, mount } from 'enzyme'
+import { configure, mount, shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import { spy } from 'sinon'
@@ -21,4 +21,10 @@ describe('AppFooter', () => {
const wrapper = mount();
expect(AppFooter.prototype.componentDidMount.calledOnce).toEqual(true);
});
-})
\ No newline at end of file
+ it('should call isFixed()', () => {
+ const isFixed = spy(AppFooter.prototype, 'isFixed');
+ shallow();
+ expect(isFixed.called).toBe(true);
+ });
+
+})
diff --git a/tests/Header.test.js b/tests/Header.test.js
index 12d0a863..63e5a041 100644
--- a/tests/Header.test.js
+++ b/tests/Header.test.js
@@ -2,11 +2,12 @@ import expect from 'expect'
import React from 'react'
import {renderToStaticMarkup as render} from 'react-dom/server'
-import { configure, mount } from 'enzyme'
+import { configure, mount, shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import { spy } from 'sinon'
import AppHeader from 'src/Header'
+import AppFooter from '../src/Footer';
configure({ adapter: new Adapter() });
@@ -21,4 +22,9 @@ describe('AppHeader', () => {
const wrapper = mount();
expect(AppHeader.prototype.componentDidMount.calledOnce).toEqual(true);
});
-})
\ No newline at end of file
+ it('should call isFixed()', () => {
+ const isFixed = spy(AppHeader.prototype, 'isFixed');
+ shallow();
+ expect(isFixed.called).toBe(true);
+ });
+})
diff --git a/tests/NavbarBrand.test.js b/tests/NavbarBrand.test.js
index d10d8739..738f1021 100644
--- a/tests/NavbarBrand.test.js
+++ b/tests/NavbarBrand.test.js
@@ -15,4 +15,13 @@ describe('AppNavbarBrand', () => {
minimized={{ src: sygnet, width: 30, height: 30, alt: 'CoreUI Minimized' }}
/>)).toContain('class="navbar-brand"');
});
+ it('renders anchor with class="navbar-brand"', () => {
+ expect(render()).toContain('class="navbar-brand"');
+ });
+ it('renders anchor with class="navbar-brand"', () => {
+ expect(render()).toContain('class="navbar-brand"');
+ });
+
});
diff --git a/tests/Sidebar.test.js b/tests/Sidebar.test.js
index 4f635ad7..082d1b01 100644
--- a/tests/Sidebar.test.js
+++ b/tests/Sidebar.test.js
@@ -2,7 +2,7 @@ import expect from 'expect'
import React from 'react'
import {renderToStaticMarkup as render} from 'react-dom/server'
-import { configure, mount } from 'enzyme'
+import { configure, mount, shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import { spy } from 'sinon'
@@ -21,4 +21,9 @@ describe('AppSidebar', () => {
const wrapper = mount();
expect(AppSidebar.prototype.componentDidMount.calledOnce).toBe(true);
});
+ it('should call isFixed()', () => {
+ const isFixed = spy(AppSidebar.prototype, 'isFixed');
+ shallow();
+ expect(isFixed.called).toBe(true);
+ });
})
diff --git a/tests/SidebarFooter.test.js b/tests/SidebarFooter.test.js
index c9ec3393..95805f6c 100644
--- a/tests/SidebarFooter.test.js
+++ b/tests/SidebarFooter.test.js
@@ -9,4 +9,8 @@ describe('SidebarFooter', () => {
expect(render(test))
.toContain('')
})
-})
\ No newline at end of file
+ it('renders no div with class="sidebar-footer"', () => {
+ expect(render())
+ .toNotContain('')
+ })
+})
diff --git a/tests/SidebarForm.test.js b/tests/SidebarForm.test.js
index 3d58d803..08f88115 100644
--- a/tests/SidebarForm.test.js
+++ b/tests/SidebarForm.test.js
@@ -9,4 +9,8 @@ describe('AppSidebarForm', () => {
expect(render(test))
.toContain('')
})
-})
\ No newline at end of file
+ it('renders no div with class="sidebar-form"', () => {
+ expect(render())
+ .toNotContain('')
+ })
+})
diff --git a/tests/SidebarHeader.test.js b/tests/SidebarHeader.test.js
index fdb8c59c..42843b60 100644
--- a/tests/SidebarHeader.test.js
+++ b/tests/SidebarHeader.test.js
@@ -9,4 +9,8 @@ describe('AppSidebarHeader', () => {
expect(render(test))
.toContain('')
})
-})
\ No newline at end of file
+ it('renders no div with class="sidebar-header"', () => {
+ expect(render())
+ .toNotContain('')
+ })
+})
diff --git a/tests/Switch.test.js b/tests/Switch.test.js
index 54025719..48dea343 100644
--- a/tests/Switch.test.js
+++ b/tests/Switch.test.js
@@ -2,9 +2,9 @@ import expect from 'expect'
import React from 'react'
import {renderToStaticMarkup as render} from 'react-dom/server'
-import { configure, mount } from 'enzyme'
+import { configure, mount, shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
-import { spy } from 'sinon'
+import { spy, mock } from 'sinon'
import AppSwitch from 'src/Switch'
@@ -15,14 +15,60 @@ describe('AppSwitch', () => {
expect(render())
.toContain(');
- expect(wrapper.find('input').props().checked).toBe(false);
- wrapper.find('input').simulate('change', event)
- expect(onChange.called).toBe(true);
- expect(wrapper.find('input').props().checked).toBe(true);
+ it('should render with switch class', () => {
+ const wrapper = shallow();
+ expect(wrapper.hasClass('switch')).toBe(true);
+ });
+ it('should render with outline class', () => {
+ const wrapper = shallow();
+ expect(wrapper.hasClass('switch-outline-secondary')).toBe(true);
+ });
+ it('should render with outline alt class', () => {
+ const wrapper = shallow();
+ expect(wrapper.hasClass('switch-outline-secondary-alt')).toBe(true);
+ });
+ it('should render with outline alt class', () => {
+ const wrapper = shallow();
+ expect(wrapper.hasClass('switch-outline-primary-alt')).toBe(true);
+ });
+ it('should render with info class', () => {
+ const wrapper = shallow();
+ expect(wrapper.hasClass('switch-info')).toBe(true);
+ });
+ it('should render with pill class', () => {
+ const wrapper = shallow();
+ expect(wrapper.hasClass('switch-pill')).toBe(true);
+ });
+ it('should render with 3d class', () => {
+ const wrapper = shallow();
+ expect(wrapper.hasClass('switch-3d')).toBe(true);
+ });
+ it('should render with lg class', () => {
+ const wrapper = shallow();
+ expect(wrapper.hasClass('switch-lg')).toBe(true);
+ });
+ it('should render with label class', () => {
+ const wrapper = shallow();
+ expect(wrapper.hasClass('switch-label')).toBe(true);
+ });
+
+ describe('onChange', () => {
+ it('calls props.onChange if it exists', () => {
+ const onChangeMock = mock()
+ const wrapper = mount();
+ wrapper.find('input').hostNodes().simulate('change');
+ expect(onChangeMock.called).toBe(true);
+ });
- })
+ it('should call onChange()', () => {
+ const onChange = spy(AppSwitch.prototype, 'onChange');
+ const event = { target: { checked: true } };
+ const wrapper = shallow();
+ expect(wrapper.find('input').props().checked).toBe(false);
+ wrapper.find('input').simulate('change', event)
+ expect(onChange.called).toBe(true);
+ expect(wrapper.find('input').props().checked).toBe(true);
+ })
+ }
+ )
})