-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement Move * Rmemove dependency on query string * fix: sort action ids correctly (#2217) * sort actionIds by tree path order * filter invalid ids and update test cases * fix: make MoveSelection work (not target master) (#2234) * make MoveSelection work * add comments * initialDialogShape as a function * feat: visual/move with lgapi (#2258) * dump real lg content before paste them * implement lg resources walker * update lg walker api * split insertNodes from pasteNodes * fix tslint * change copyUtils ExtarnelAPI interface * migrate to new api format * create real lg template when pasting * renaming * update walkLgResources * create lgTemplates for moved actions * hack the debounce issue #2247 * Fix build * Fix lint Co-authored-by: Ze Ye <zeye@microsoft.com> Co-authored-by: zeye <2295905420@qq.com> Co-authored-by: zeye <2295905420@qq.com> Co-authored-by: Ze Ye <zeye@microsoft.com>
- Loading branch information
1 parent
d91eaa4
commit a9f7e66
Showing
25 changed files
with
252 additions
and
50 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
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
52 changes: 52 additions & 0 deletions
52
Composer/packages/extensions/visual-designer/__tests__/utils/normalizeSelection.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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { normalizeSelection, sortActionIds } from '../../src/utils/normalizeSelection'; | ||
|
||
describe('normalizeSelection', () => { | ||
it('should filter out child ids', () => { | ||
const selectedIds1 = ['actions[0]', 'actions[0].actions[0]', 'actions[0].actions[1]']; | ||
expect(normalizeSelection(selectedIds1)).toEqual(['actions[0]']); | ||
|
||
const selectedIds2 = ['actions[0]', 'actions[0].actions[0]', 'actions[0].actions[1]', 'actions[1]', 'actions[1].a']; | ||
expect(normalizeSelection(selectedIds2)).toEqual(['actions[0]', 'actions[1]']); | ||
}); | ||
|
||
it('should keep orphan child ids', () => { | ||
const selectedIds = ['actions[0]', 'actions[0].actions[0]', 'actions[1].actions[0]']; | ||
expect(normalizeSelection(selectedIds)).toEqual(['actions[0]', 'actions[1].actions[0]']); | ||
}); | ||
|
||
it('should throw invalid ids', () => { | ||
const selectedIds = ['action[0].a', 'actions[0].diamond', 'actions', 'actions[0].ifelse']; | ||
expect(normalizeSelection(selectedIds)).toEqual([]); | ||
}); | ||
}); | ||
|
||
describe('sortActionIds', () => { | ||
it('can sort input ids at same level', () => { | ||
const actionIds = ['actions[10]', 'actions[1]', 'actions[3]', 'actions[2]']; | ||
expect(sortActionIds(actionIds)).toEqual(['actions[1]', 'actions[2]', 'actions[3]', 'actions[10]']); | ||
}); | ||
|
||
it('can sort input ids with children', () => { | ||
const actionIds = ['actions[3]', 'actions[2]', 'actions[1].actions[0]', 'actions[1].elseActions[0]', 'actions[1]']; | ||
expect(sortActionIds(actionIds)).toEqual([ | ||
'actions[1]', | ||
'actions[1].actions[0]', | ||
'actions[1].elseActions[0]', | ||
'actions[2]', | ||
'actions[3]', | ||
]); | ||
}); | ||
|
||
it('can sort ids with orphan children', () => { | ||
const actionIds = ['actions[3]', 'actions[2]', 'actions[1].actions[0]', 'actions[1].elseActions[0]']; | ||
expect(sortActionIds(actionIds)).toEqual([ | ||
'actions[1].actions[0]', | ||
'actions[1].elseActions[0]', | ||
'actions[2]', | ||
'actions[3]', | ||
]); | ||
}); | ||
}); |
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
Oops, something went wrong.