Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/design ui useable #38

Merged
merged 37 commits into from
Jun 20, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4d12fd3
feat: ui improvement start
jinwoo-kim-nhn Jun 8, 2018
6bede58
feat: shape, draw menu Improved usability.
jinwoo-kim-nhn Jun 11, 2018
2e070e8
middle commit
jinwoo-kim-nhn Jun 11, 2018
a65c61b
add icon add with resize
Jun 11, 2018
9c9f738
icon useable resize icon
Jun 11, 2018
3cff2e4
complete icon menu useable
jinwoo-kim-nhn Jun 12, 2018
694ba62
middle commit
jinwoo-kim-nhn Jun 12, 2018
322a05b
middle commit2
Jun 12, 2018
d8d25f5
fixed middlecommit 3
Jun 12, 2018
59f5b5d
fixed bug all
Jun 13, 2018
504fe05
refactoring icon action
Jun 13, 2018
80b3045
feat: group selction style & action for ui usable
jinwoo-kim-nhn Jun 14, 2018
9aa3f67
fixed: shape stroke limit maxsize
jinwoo-kim-nhn Jun 14, 2018
959258c
fixed: submenu transition and mask apply hidden
Jun 14, 2018
d46b595
fixed crop zone bug
Jun 14, 2018
58be310
fixed action test
Jun 14, 2018
5cd6b06
added big menu tooltip
jinwoo-kim-nhn Jun 15, 2018
ebc9292
crop zone Flicker removal.
jinwoo-kim-nhn Jun 15, 2018
cf932dd
fixed shape standard mode
jinwoo-kim-nhn Jun 15, 2018
e5792cd
fixed shpae change stanbymode bug and filter partition height
jinwoo-kim-nhn Jun 15, 2018
3a41377
added iconsize theme
jinwoo-kim-nhn Jun 15, 2018
6d0cc9b
add jsdoc
jinwoo-kim-nhn Jun 15, 2018
f7a650d
add jsdoc & editor-wrap style
jinwoo-kim-nhn Jun 15, 2018
0527890
add test code job - 1
jinwoo-kim-nhn Jun 15, 2018
f065c12
feat: design - ui useable - add test all
Jun 17, 2018
8f3ae35
fixed undo stack bug
Jun 17, 2018
866158c
broken test fixed
jinwoo-kim-nhn Jun 18, 2018
ba1e4f4
fixed broken test2
jinwoo-kim-nhn Jun 18, 2018
4ed8c4b
fixed broken test 3
jinwoo-kim-nhn Jun 18, 2018
040766a
fixed broken test - 4
jinwoo-kim-nhn Jun 18, 2018
140530c
apply ui review
Jun 18, 2018
e05f58f
fixed: added file cleanup and theme properties.
jinwoo-kim-nhn Jun 19, 2018
c9e429b
fixed typpo
jinwoo-kim-nhn Jun 19, 2018
5368e6e
apply codereview
jinwoo-kim-nhn Jun 19, 2018
80bad1f
add sample bg file
jinwoo-kim-nhn Jun 19, 2018
9b51ae1
fixed broken test
jinwoo-kim-nhn Jun 19, 2018
60d64da
apply codereview
jinwoo-kim-nhn Jun 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test code job - 1
  • Loading branch information
jinwoo-kim-nhn committed Jun 15, 2018
commit 05278903151cf49f0c1b53de6261a56c426febea
10 changes: 6 additions & 4 deletions src/js/imageEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,19 @@ class ImageEditor {
/**
* RemoveObject Sequential processing for prevent invoke lock
* @param {Array.<Object>} targetObjects - target Objects for remove
* @returns {object} targetObjects
* @private
*/
_removeObjectStream(targetObjects) {
if (targetObjects.length === 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!targetObjects.length) { ... }

return;
return true;
}

const targetObject = targetObjects.pop();
this.removeObject(this._graphics.getObjectId(targetObject)).then(() => {
this._removeObjectStream(targetObjects);
});

return this.removeObject(this._graphics.getObjectId(targetObject)).then(() => (
this._removeObjectStream(targetObjects)
));
}

/**
Expand Down
68 changes: 44 additions & 24 deletions test/action.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,30 +112,6 @@ describe('Ui', () => {
});
});

describe('modeChange()', () => {
it('_changeActivateMode("TEXT") API should be executed When the modeChange("text") action occurs', () => {
spyOn(imageEditorMock, '_changeActivateMode');

mainAction.modeChange('text');
expect(imageEditorMock._changeActivateMode).toHaveBeenCalled();
});

it('startDrawingMode() API should be executed When the modeChange("crop") action occurs', () => {
spyOn(imageEditorMock, 'startDrawingMode');

mainAction.modeChange('crop');
expect(imageEditorMock.startDrawingMode).toHaveBeenCalled();
});

it('stopDrawingMode(), setDrawingShape(), _changeActivateMode() API should be executed When the modeChange("shape") action occurs', () => {
spyOn(imageEditorMock, 'setDrawingShape');
spyOn(imageEditorMock, '_changeActivateMode');

mainAction.modeChange('shape');
expect(imageEditorMock.setDrawingShape).toHaveBeenCalled();
expect(imageEditorMock._changeActivateMode).toHaveBeenCalled();
});
});
});

describe('shapeAction', () => {
Expand Down Expand Up @@ -341,4 +317,48 @@ describe('Ui', () => {
expect(imageEditorMock.applyFilter).toHaveBeenCalled();
});
});

describe('commonAction', () => {
it('getActions 메소드에 리턴되는 각각의 액션은 commonAction을 포함하고 있어야 한다.', () => {
});

/*
describe('modeChange()', () => {
it('_changeActivateMode("TEXT") API should be executed When the modeChange("text") action occurs', () => {
spyOn(imageEditorMock, '_changeActivateMode');

mainAction.modeChange('text');
expect(imageEditorMock._changeActivateMode).toHaveBeenCalled();
});

it('startDrawingMode() API should be executed When the modeChange("crop") action occurs', () => {
spyOn(imageEditorMock, 'startDrawingMode');

mainAction.modeChange('crop');
expect(imageEditorMock.startDrawingMode).toHaveBeenCalled();
});

it('stopDrawingMode(), setDrawingShape(), _changeActivateMode() API should be executed When the modeChange("shape") action occurs', () => {
spyOn(imageEditorMock, 'setDrawingShape');
spyOn(imageEditorMock, '_changeActivateMode');

mainAction.modeChange('shape');
expect(imageEditorMock.setDrawingShape).toHaveBeenCalled();
expect(imageEditorMock._changeActivateMode).toHaveBeenCalled();
});
});
*/
});

describe('reAction', () => {
/*
undoStackChanged
redoStackChanged
objectActivated
addText
addObjectAfter
objectScaled
selectionCleared
*/
});
});
52 changes: 52 additions & 0 deletions test/imageEditor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,57 @@ describe('ImageEditor', () => {

expect(snippet.imagePing).not.toHaveBeenCalled();
});

it('그룹이 존재할때 removeActiveObject()', () => {
spyOn(imageEditor._graphics, 'getActiveGroupObject').and.returnValue({
activeObjectGroup: () => [1, 2, 3]
});
spyOn(imageEditor, '_removeObjectStream');
spyOn(imageEditor, 'discardSelection');

imageEditor = new ImageEditor(el, {
usageStatistics: false
});
imageEditor._reomveActiveObject();

expect(imageEditor._removeObjectStream).toHaveHeenCalled();
});
/*
it('그룹이 존재하지 않을때 removeActiveObject()', () => {
spyOn(imageEditor._graphics, 'getActiveGroupObject').and.returnValue(null);
spyOn(imageEditor, '_removeObjectStream');
spyOn(imageEditor, 'getActiveObject');
//spyOn(imageEditor, 'getActiveObject');

imageEditor = new ImageEditor(el, {
usageStatistics: false
});
imageEditor._reomveActiveObject();

expect(imageEditor._removeObjectStream).toHaveHeenCalled();
});
*/

it('_removeObjectStream()', done => {
const promise = new Promise(resolve => {
resolve();
});

imageEditor = new ImageEditor(el, {
usageStatistics: false
});

spyOn(imageEditor, '_removeObjectStream').and.callThrough();
spyOn(imageEditor, 'removeObject').and.returnValue(promise);

const removeJobsSequens = [1, 2, 3, 4];
const removeObjectStremPromise = imageEditor._removeObjectStream(removeJobsSequens);
const expected = removeJobsSequens.length + 1;

removeObjectStremPromise.then(() => {
expect(imageEditor._removeObjectStream.calls.count()).toBe(expected);
done();
});
});
});
});
7 changes: 7 additions & 0 deletions test/ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ describe('UI', () => {
};
ui = new UI(document.createElement('div'), uiOptions, {});
});
describe('_changeMenu()', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

내용이 없습니다.

it('메뉴가 변경되면 변경되는 메뉴 인스턴스의 changeStartMode()가 실행 되어야 한다.', () => {
});

it('메뉴가 변경되면 기존 메뉴 인스턴스의 changeStandbyMode()가 실행 되어야 한다.', () => {
});
});

describe('_makeSubMenu()', () => {
it('MakeMenuElement should be executed for the number of menus specified in the option.', () => {
Expand Down