diff --git a/test/CircularProgressbar.test.tsx b/test/CircularProgressbar.test.tsx
index dd2aee3..a025a73 100644
--- a/test/CircularProgressbar.test.tsx
+++ b/test/CircularProgressbar.test.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { mount, shallow } from 'enzyme';
import CircularProgressbar from '../src/index';
@@ -36,29 +36,47 @@ describe('', () => {
describe('props.percentage', () => {
test('Renders correct path', () => {
const percentage = 30;
- const wrapper = shallow(
+ const wrapper = mount(
,
);
- const dashoffset = wrapper.find('.CircularProgressbar-path').prop('style')!.strokeDashoffset;
+ const dashoffset = wrapper
+ .find('.CircularProgressbar-path')
+ .hostNodes()
+ .prop('style')!.strokeDashoffset;
const expectedRadius = 50;
const expectedDiameter = 2 * expectedRadius * Math.PI;
const expectedOffset = ((100 - percentage) / 100) * expectedDiameter;
expect(dashoffset).toEqual(`${expectedOffset}px`);
const expectedArcto = `a ${expectedRadius},${expectedRadius}`;
- expect(wrapper.find('.CircularProgressbar-path').prop('d')).toContain(expectedArcto);
+ expect(
+ wrapper
+ .find('.CircularProgressbar-path')
+ .hostNodes()
+ .prop('d'),
+ ).toContain(expectedArcto);
});
});
describe('props.counterClockwise', () => {
test('Reverses dashoffset', () => {
- const clockwise = shallow();
- const counterClockwise = shallow();
+ const clockwise = mount();
+ const counterClockwise = mount();
// Counterclockwise should have the negative dashoffset of clockwise
expect(
- `-${clockwise.find('.CircularProgressbar-path').prop('style')!.strokeDashoffset}`,
- ).toEqual(counterClockwise.find('.CircularProgressbar-path').prop('style')!.strokeDashoffset);
+ `-${
+ clockwise
+ .find('.CircularProgressbar-path')
+ .hostNodes()
+ .prop('style')!.strokeDashoffset
+ }`,
+ ).toEqual(
+ counterClockwise
+ .find('.CircularProgressbar-path')
+ .hostNodes()
+ .prop('style')!.strokeDashoffset,
+ );
});
});
describe('props.styles', () => {
@@ -101,14 +119,34 @@ describe('', () => {
});
describe('props.classes', () => {
test('Has default values', () => {
- const wrapper = shallow();
- expect(wrapper.find('.CircularProgressbar').type()).toEqual('svg');
- expect(wrapper.find('.CircularProgressbar-path').type()).toEqual('path');
- expect(wrapper.find('.CircularProgressbar-trail').type()).toEqual('path');
- expect(wrapper.find('.CircularProgressbar-text').type()).toEqual('text');
+ const wrapper = mount();
+ expect(
+ wrapper
+ .find('.CircularProgressbar')
+ .hostNodes()
+ .type(),
+ ).toEqual('svg');
+ expect(
+ wrapper
+ .find('.CircularProgressbar-path')
+ .hostNodes()
+ .type(),
+ ).toEqual('path');
+ expect(
+ wrapper
+ .find('.CircularProgressbar-trail')
+ .hostNodes()
+ .type(),
+ ).toEqual('path');
+ expect(
+ wrapper
+ .find('.CircularProgressbar-text')
+ .hostNodes()
+ .type(),
+ ).toEqual('text');
});
test('Prop overrides work', () => {
- const wrapper = shallow(
+ const wrapper = mount(
', () => {
expect(wrapper.find('.CircularProgressbar-background').exists()).toBe(false);
// Assert override classes do exist
- expect(wrapper.find('.someRootClass').type()).toEqual('svg');
- expect(wrapper.find('.somePathClass').type()).toEqual('path');
- expect(wrapper.find('.someTrailClass').type()).toEqual('path');
- expect(wrapper.find('.someTextClass').type()).toEqual('text');
- expect(wrapper.find('.someBackgroundClass').type()).toEqual('circle');
+ expect(
+ wrapper
+ .find('.someRootClass')
+ .hostNodes()
+ .type(),
+ ).toEqual('svg');
+ expect(
+ wrapper
+ .find('.somePathClass')
+ .hostNodes()
+ .type(),
+ ).toEqual('path');
+ expect(
+ wrapper
+ .find('.someTrailClass')
+ .hostNodes()
+ .type(),
+ ).toEqual('path');
+ expect(
+ wrapper
+ .find('.someTextClass')
+ .hostNodes()
+ .type(),
+ ).toEqual('text');
+ expect(
+ wrapper
+ .find('.someBackgroundClass')
+ .hostNodes()
+ .type(),
+ ).toEqual('circle');
});
});
});