-
Notifications
You must be signed in to change notification settings - Fork 715
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(annotation): add tests for new annotation components
- Loading branch information
1 parent
ea1fc3e
commit 91893fd
Showing
7 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { CircleSubject } from '../src'; | ||
|
||
describe('<CircleSubject />', () => { | ||
it('should be defined', () => { | ||
expect(CircleSubject).toBeDefined(); | ||
}); | ||
it('should render a cirlce', () => { | ||
expect(shallow(<CircleSubject />).find('circle')).toHaveLength(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { Connector } from '../src'; | ||
|
||
describe('<Connector />', () => { | ||
it('should be defined', () => { | ||
expect(Connector).toBeDefined(); | ||
}); | ||
it('should render a path', () => { | ||
expect(shallow(<Connector />).find('path')).toHaveLength(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
import { EditableAnnotation } from '../src'; | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { Annotation, EditableAnnotation } from '../src'; | ||
|
||
describe('<EditableAnnotation />', () => { | ||
function setup() { | ||
return shallow( | ||
<EditableAnnotation width={100} height={100}> | ||
<div /> | ||
</EditableAnnotation>, | ||
); | ||
} | ||
it('should be defined', () => { | ||
expect(EditableAnnotation).toBeDefined(); | ||
}); | ||
it('should render two resize handles', () => { | ||
expect(setup().find('circle')).toHaveLength(2); | ||
}); | ||
it('should render an Annotation', () => { | ||
expect(setup().find(Annotation)).toHaveLength(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,48 @@ | ||
import React from 'react'; | ||
import ResizeObserver from 'resize-observer-polyfill'; | ||
import Text from '@visx/text/lib/Text'; | ||
import { shallow } from 'enzyme'; | ||
import { Label } from '../src'; | ||
|
||
describe('<Label />', () => { | ||
it('should be defined', () => { | ||
expect(Label).toBeDefined(); | ||
}); | ||
it('should render title Text', () => { | ||
expect( | ||
shallow(<Label title="title test" resizeObserverPolyfill={ResizeObserver} />) | ||
.find(Text) | ||
.dive() | ||
.text(), | ||
).toBe('title test'); | ||
}); | ||
it('should render subtitle Text', () => { | ||
expect( | ||
shallow( | ||
<Label | ||
title="title test" | ||
subtitle="subtitle test" | ||
resizeObserverPolyfill={ResizeObserver} | ||
/>, | ||
) | ||
.find(Text) | ||
.at(1) | ||
.dive() | ||
.text(), | ||
).toBe('subtitle test'); | ||
}); | ||
it('should render a background', () => { | ||
expect( | ||
shallow( | ||
<Label title="title test" showBackground resizeObserverPolyfill={ResizeObserver} />, | ||
).find('rect'), | ||
).toHaveLength(1); | ||
}); | ||
it('should render an anchor line', () => { | ||
expect( | ||
shallow( | ||
<Label title="title test" showAnchorLine resizeObserverPolyfill={ResizeObserver} />, | ||
).find('line'), | ||
).toHaveLength(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { LineSubject } from '../src'; | ||
|
||
describe('<LineSubject />', () => { | ||
it('should be defined', () => { | ||
expect(LineSubject).toBeDefined(); | ||
}); | ||
it('should a line', () => { | ||
expect(shallow(<LineSubject min={0} max={100} />).find('line')).toHaveLength(1); | ||
}); | ||
}); |