-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cho
committed
Oct 8, 2019
1 parent
e54cc54
commit 98b64a8
Showing
39 changed files
with
820 additions
and
495 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
13 changes: 7 additions & 6 deletions
13
src/components/connector.test.ts → src/components/connection-icon.test.ts
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,30 +1,31 @@ | ||
import { ConnectorComponent } from './connector'; | ||
import { ConnectionIconComponent } from './connection-icon'; | ||
import { VAPP_BACKGROUND_COLOR, CANVAS_BACKGROUND_COLOR } from '../constants/colors'; | ||
import * as paper from 'paper'; | ||
|
||
describe('connector component', () => { | ||
describe('icon component', () => { | ||
|
||
beforeAll(() => { | ||
const canvasEl = document.createElement('canvas'); | ||
paper.setup(canvasEl); | ||
paper.settings.applyMatrix = false; | ||
}); | ||
|
||
test('basic properties', () => { | ||
const position = new paper.Point(0, 0); | ||
const defaultColor = new paper.Color(VAPP_BACKGROUND_COLOR); | ||
const connector = new ConnectorComponent(); | ||
const connector = new ConnectionIconComponent(); | ||
expect(connector.position.x).toBe(position.x); | ||
expect(connector.position.y).toBe(position.y); | ||
expect((connector.connector.fillColor as paper.Color).equals(defaultColor)).toBe(true); | ||
expect((connector.icon.fillColor as paper.Color).equals(defaultColor)).toBe(true); | ||
}); | ||
|
||
test('custom position and fill color', () => { | ||
const position = new paper.Point(-20, 30); | ||
const color = new paper.Color(CANVAS_BACKGROUND_COLOR); | ||
const connector = new ConnectorComponent(position, color); | ||
const connector = new ConnectionIconComponent(position, color); | ||
expect(connector.position.x).toBe(position.x); | ||
expect(connector.position.y).toBe(position.y); | ||
expect((connector.connector.fillColor as paper.Color).equals(color)).toBe(true); | ||
expect((connector.icon.fillColor as paper.Color).equals(color)).toBe(true); | ||
}); | ||
|
||
}); |
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
Oops, something went wrong.