-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from antvis/fix-issue-216
fix: add typescript definitions for shape type
- Loading branch information
Showing
13 changed files
with
79 additions
and
97 deletions.
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
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,8 @@ | ||
import * as Shape from './shape'; | ||
const pkg = require('../package.json'); | ||
|
||
export const version = pkg.version; | ||
export { Event } from '@antv/g-base'; | ||
export { default as Canvas } from './canvas'; | ||
export { default as Group } from './group'; | ||
export { default as Shape } from './shape'; | ||
export { Shape }; |
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,24 +1,10 @@ | ||
import Shape from './base'; | ||
import Circle from './circle'; | ||
import Ellipse from './ellipse'; | ||
import Image from './image'; | ||
import Line from './line'; | ||
import Marker from './marker'; | ||
import Path from './path'; | ||
import Polygon from './polygon'; | ||
import Polyline from './polyline'; | ||
import Rect from './rect'; | ||
import Text from './text'; | ||
|
||
Shape['Circle'] = Circle; | ||
Shape['Ellipse'] = Ellipse; | ||
Shape['Image'] = Image; | ||
Shape['Line'] = Line; | ||
Shape['Marker'] = Marker; | ||
Shape['Path'] = Path; | ||
Shape['Polygon'] = Polygon; | ||
Shape['Polyline'] = Polyline; | ||
Shape['Rect'] = Rect; | ||
Shape['Text'] = Text; | ||
|
||
export default Shape; | ||
export { default as Circle } from './circle'; | ||
export { default as Ellipse } from './ellipse'; | ||
export { default as Image } from './image'; | ||
export { default as Line } from './line'; | ||
export { default as Marker } from './marker'; | ||
export { default as Path } from './path'; | ||
export { default as Polygon } from './polygon'; | ||
export { default as Polyline } from './polyline'; | ||
export { default as Rect } from './rect'; | ||
export { default as Text } from './text'; |
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,22 +1,17 @@ | ||
import { expect } from 'chai'; | ||
import Shape from '../../../src/shape'; | ||
import { Circle, Ellipse, Image, Line, Marker, Path, Polygon, Polyline, Rect, Text } from '../../../src/shape'; | ||
|
||
describe('Canvas Shape index', () => { | ||
it('not undefined', () => { | ||
const shapeTypeList = [ | ||
'Circle', | ||
'Ellipse', | ||
'Image', | ||
'Line', | ||
'Marker', | ||
'Path', | ||
'Polygon', | ||
'Polyline', | ||
'Rect', | ||
'Text', | ||
]; | ||
shapeTypeList.forEach((shapeType) => { | ||
expect(Shape[shapeType]).not.eql(undefined); | ||
}); | ||
it('Every shape is not undefined', () => { | ||
expect(Circle).not.eqls(undefined); | ||
expect(Ellipse).not.eqls(undefined); | ||
expect(Image).not.eqls(undefined); | ||
expect(Line).not.eqls(undefined); | ||
expect(Marker).not.eqls(undefined); | ||
expect(Path).not.eqls(undefined); | ||
expect(Polygon).not.eqls(undefined); | ||
expect(Polyline).not.eqls(undefined); | ||
expect(Rect).not.eqls(undefined); | ||
expect(Text).not.eqls(undefined); | ||
}); | ||
}); |
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,9 @@ | ||
import * as Shape from './shape'; | ||
|
||
const pkg = require('../package.json'); | ||
|
||
export const version = pkg.version; | ||
export { Event } from '@antv/g-base'; | ||
export { default as Canvas } from './canvas'; | ||
export { default as Group } from './group'; | ||
export { default as Shape } from './shape'; | ||
export { Shape }; |
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,26 +1,11 @@ | ||
import Shape from './base'; | ||
import Circle from './circle'; | ||
import Dom from './dom'; | ||
import Ellipse from './ellipse'; | ||
import Image from './image'; | ||
import Line from './line'; | ||
import Marker from './marker'; | ||
import Path from './path'; | ||
import Polygon from './polygon'; | ||
import Polyline from './polyline'; | ||
import Rect from './rect'; | ||
import Text from './text'; | ||
|
||
Shape['Circle'] = Circle; | ||
Shape['Dom'] = Dom; | ||
Shape['Ellipse'] = Ellipse; | ||
Shape['Image'] = Image; | ||
Shape['Line'] = Line; | ||
Shape['Marker'] = Marker; | ||
Shape['Path'] = Path; | ||
Shape['Polygon'] = Polygon; | ||
Shape['Polyline'] = Polyline; | ||
Shape['Rect'] = Rect; | ||
Shape['Text'] = Text; | ||
|
||
export default Shape; | ||
export { default as Circle } from './circle'; | ||
export { default as Dom } from './dom'; | ||
export { default as Ellipse } from './ellipse'; | ||
export { default as Image } from './image'; | ||
export { default as Line } from './line'; | ||
export { default as Marker } from './marker'; | ||
export { default as Path } from './path'; | ||
export { default as Polygon } from './polygon'; | ||
export { default as Polyline } from './polyline'; | ||
export { default as Rect } from './rect'; | ||
export { default as Text } from './text'; |
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,23 +1,18 @@ | ||
import { expect } from 'chai'; | ||
import Shape from '../../../src/shape'; | ||
import { Circle, Dom, Ellipse, Image, Line, Marker, Path, Polygon, Polyline, Rect, Text } from '../../../src/shape'; | ||
|
||
describe('SVG Shape index', () => { | ||
it('not undefined', () => { | ||
const shapeTypeList = [ | ||
'Circle', | ||
'Dom', | ||
'Ellipse', | ||
'Image', | ||
'Line', | ||
'Marker', | ||
'Path', | ||
'Polygon', | ||
'Polyline', | ||
'Rect', | ||
'Text', | ||
]; | ||
shapeTypeList.forEach((shapeType) => { | ||
expect(Shape[shapeType]).not.eql(undefined); | ||
}); | ||
it('Every shape is not undefined', () => { | ||
expect(Circle).not.eqls(undefined); | ||
expect(Dom).not.eqls(undefined); | ||
expect(Ellipse).not.eqls(undefined); | ||
expect(Image).not.eqls(undefined); | ||
expect(Line).not.eqls(undefined); | ||
expect(Marker).not.eqls(undefined); | ||
expect(Path).not.eqls(undefined); | ||
expect(Polygon).not.eqls(undefined); | ||
expect(Polyline).not.eqls(undefined); | ||
expect(Rect).not.eqls(undefined); | ||
expect(Text).not.eqls(undefined); | ||
}); | ||
}); |