From 397e623a2a42653669e232138591051ec7b993c4 Mon Sep 17 00:00:00 2001 From: Kevin Qi Date: Sat, 11 May 2019 14:49:45 -0700 Subject: [PATCH] fix tests by replace props.percentage with value --- test/CircularProgressbar.test.tsx | 32 +++++++++---------- test/CircularProgressbarWithChildren.test.tsx | 10 +++--- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/CircularProgressbar.test.tsx b/test/CircularProgressbar.test.tsx index 718d45b..889e598 100644 --- a/test/CircularProgressbar.test.tsx +++ b/test/CircularProgressbar.test.tsx @@ -18,31 +18,29 @@ function getExpectedStrokeDashoffset({ describe('', () => { test('SVG rendered to DOM', () => { - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper.find('svg').exists()).toBe(true); }); describe('props.strokeWidth', () => { test('Applies to path', () => { - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper.find('.CircularProgressbar-path').prop('strokeWidth')).toEqual(2); }); }); describe('props.className', () => { test('Applies to SVG', () => { - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper.find('svg').prop('className')).toContain('my-custom-class'); }); }); describe('props.text', () => { test('Does not render when blank', () => { - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper.find('.CircularProgressbar-text').exists()).toEqual(false); }); test('Renders the correct string', () => { const percentage = 50; - const wrapper = shallow( - , - ); + const wrapper = shallow(); expect(wrapper.find('.CircularProgressbar-text').text()).toEqual('50%'); }); }); @@ -50,7 +48,7 @@ describe('', () => { test('Renders correct path', () => { const percentage = 30; const wrapper = mount( - , + , ); expect( @@ -72,8 +70,8 @@ describe('', () => { }); describe('props.counterClockwise', () => { test('Reverses dashoffset', () => { - const clockwise = mount(); - const counterClockwise = mount(); + const clockwise = mount(); + const counterClockwise = mount(); // Counterclockwise should have the negative dashoffset of clockwise expect( @@ -96,7 +94,7 @@ describe('', () => { const percentage = 25; const strokeWidth = 5; const wrapper = mount( - , + , ); expect( @@ -113,7 +111,7 @@ describe('', () => { const circleRatio = 0.8; const wrapper = mount( , @@ -141,7 +139,7 @@ describe('', () => { const percentage = 50; const wrapper = shallow( ', () => { }); describe('props.background', () => { test('Background does not render when prop is false', () => { - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper.find('.CircularProgressbar-background').exists()).toEqual(false); }); test('Renders a with correct radius', () => { - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper.find('.CircularProgressbar-background').exists()).toBe(true); expect(wrapper.find('.CircularProgressbar-background').type()).toEqual('circle'); expect(wrapper.find('.CircularProgressbar-background').prop('r')).toEqual(50); @@ -176,7 +174,7 @@ describe('', () => { }); describe('props.classes', () => { test('Has default values', () => { - const wrapper = mount(); + const wrapper = mount(); expect( wrapper .find('.CircularProgressbar') @@ -205,7 +203,7 @@ describe('', () => { test('Prop overrides work', () => { const wrapper = mount( ', () => { test('SVG rendered to DOM', () => { - const wrapper = mount(); + const wrapper = mount(); expect(wrapper.find('svg').exists()).toEqual(true); expect(wrapper.find('[data-test-id="CircularProgressbar"]').exists()).toEqual(true); @@ -26,7 +26,9 @@ describe('', () => { }, className: 'johnny', counterClockwise: false, - percentage: 50, + minValue: 0, + maxValue: 100, + value: 50, strokeWidth: 2, styles: {}, text: '50%', @@ -42,7 +44,7 @@ describe('', () => { describe('props.children', () => { test('No children', () => { - const wrapper = mount(); + const wrapper = mount(); expect( wrapper.find('[data-test-id="CircularProgressbarWithChildren__children"]').exists(), @@ -51,7 +53,7 @@ describe('', () => { test('Renders child content', () => { const wrapper = mount( - +
Hello
, );