-
-
Notifications
You must be signed in to change notification settings - Fork 629
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
Showing
7 changed files
with
140 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
"roots": [ | ||
"<rootDir>", | ||
], | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest", | ||
}, | ||
"testMatch": ["<rootDir>/test/**/*.spec.ts"], | ||
// "testRegex": "spec\\.ts$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx", | ||
"json", | ||
"node", | ||
], | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { createElements } from "./utils"; | ||
import { GroupManager } from "../../src/"; | ||
|
||
describe("test GroupManager", () => { | ||
describe("test groups [[0, 1], 2], 3", () => { | ||
const elements = createElements(4); | ||
const manager = new GroupManager([ | ||
[[elements[0], elements[1]], elements[2]], | ||
], elements); | ||
|
||
it("selectCompletedChilds [0, 1]", () => { | ||
const list = manager.selectCompletedChilds([], [elements[1]], []); | ||
|
||
expect(list.flatten()).toStrictEqual([elements[0], elements[1], elements[2]]); | ||
}); | ||
it("selectCompletedChilds 2 => [0, 1]", () => { | ||
// element[2]가 선택된 상태에서 elements[0]을 선택 | ||
const list = manager.selectCompletedChilds([elements[2]], [elements[0]], [elements[2]]); | ||
|
||
expect(list.flatten()).toStrictEqual([elements[0], elements[1]]); | ||
}); | ||
}); | ||
|
||
}); |
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,13 @@ | ||
export function createElements(count: number) { | ||
const elements: HTMLElement[] = []; | ||
|
||
for (let i = 0; i < count; ++i) { | ||
const div = document.createElement("div"); | ||
div.innerHTML = `${i}`; | ||
|
||
(div as any).eid = i; | ||
elements.push(div); | ||
} | ||
|
||
return elements; | ||
} |
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