-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ULMS-1203 Fixed bug with textbox on page zooming
- Loading branch information
Showing
12 changed files
with
132 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export const toolEnum = { | ||
ERASER: 'eraser', | ||
PAN: 'pan', | ||
PEN: 'pen', | ||
SELECT: 'select', | ||
SHAPE: 'shape', | ||
TEXT: 'textbox', | ||
} | ||
|
||
export const penToolModeEnum = { | ||
PENCIL: 'pencil', | ||
MARKER: 'marker', | ||
LINE: 'line', | ||
} | ||
|
||
export const shapeToolModeEnum = { | ||
CIRCLE: 'circle', | ||
CIRCLE_SOLID: 'circle-solid', | ||
RECT: 'rect', | ||
RECT_SOLID: 'rect-solid', | ||
TRIANGLE: 'triangle', | ||
TRIANGLE_SOLID: 'triangle-solid', | ||
} | ||
|
||
export const enhancedFields = [ | ||
'_id', | ||
'_lockedbyuser', | ||
'_lockedselection', | ||
'noScaleCache', | ||
'strokeUniform', | ||
] |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* globals expect, describe, it, beforeEach, afterEach, jest */ | ||
import React from 'react' | ||
import Enzyme from 'enzyme' // eslint-disable-line import/no-extraneous-dependencies | ||
import Adapter from 'enzyme-adapter-react-16' // eslint-disable-line import/no-extraneous-dependencies | ||
|
||
import { Drawing, toolEnum } from '../index' | ||
|
||
import { TextboxTool } from './tools/textbox' | ||
|
||
Enzyme.configure({ adapter: new Adapter() }) | ||
|
||
const { shallow } = Enzyme | ||
|
||
const tokenProvider = () => Promise.resolve('access_token') | ||
|
||
describe('TextboxTool tool', () => { | ||
beforeEach(() => { | ||
jest | ||
.spyOn(window, 'requestAnimationFrame') | ||
.mockImplementationOnce(cb => cb()) | ||
}) | ||
|
||
afterEach(() => {}) | ||
|
||
it('`handleTextEditStartEvent` sets style for hiddenTextarea', () => { | ||
const wrap = shallow(( | ||
<Drawing | ||
tokenProvider={tokenProvider} | ||
objects={[]} | ||
tool={toolEnum.TEXT} | ||
/> | ||
)) | ||
|
||
const instance = wrap.instance() | ||
const tt = new TextboxTool(instance.canvas, undefined, {}) | ||
|
||
tt.__object = tt.__objectFn() | ||
|
||
tt.__object.hiddenTextarea = { style: {} } | ||
|
||
tt.handleTextEditStartEvent() | ||
|
||
expect(tt.__object.hiddenTextarea.style).toEqual({ | ||
width: '10px', height: '10px', fontSize: '10px', | ||
}) | ||
}) | ||
}) |
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