-
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.
- Loading branch information
1 parent
f9cde7e
commit 6de31d1
Showing
4 changed files
with
76 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
import { afterEach, beforeEach, describe, expect, test } from "vitest"; | ||
import { renderClusterTable, renderStructureTable } from "./report.js"; | ||
import { page } from "@vitest/browser/context"; | ||
|
||
let root: HTMLElement; | ||
|
||
beforeEach(() => { | ||
document.body.innerHTML = '<div id="root"></div>'; | ||
const nroot = document.getElementById('root'); | ||
if (!nroot) { | ||
throw new Error('Root element not found'); | ||
} | ||
root = nroot; | ||
}) | ||
|
||
afterEach(() => { | ||
document.body.innerHTML = ''; | ||
}) | ||
|
||
describe("renderClusterTable()", () => { | ||
test('should render a ClusterTable component inside the specified container', () => { | ||
renderClusterTable(root, [{ | ||
key: "id", | ||
label: "ID", | ||
}, | ||
{ | ||
key: "rank", | ||
label: "Rank", | ||
sorted: "asc", | ||
}, | ||
{ | ||
key: "size", | ||
label: "Size", | ||
}, | ||
], [ | ||
{ | ||
id: 1, | ||
rank: 1, | ||
size: 2 | ||
}, | ||
{ | ||
id: 2, | ||
rank: 2, | ||
size: 3 | ||
} | ||
]); | ||
// TODO wait for the component to render | ||
// TODO check if the component is rendered | ||
// expect(document.body.innerText.includes('Rank')).toBeTruthy(); | ||
}) | ||
}) | ||
|
||
describe('renderStructureTable()', () => { | ||
test('should render a StructureTable component inside the specified container', () => { | ||
renderStructureTable(root, [{ | ||
key: "rank", | ||
label: "Rank" | ||
}, { | ||
key: "model", | ||
label: "Model" | ||
}], [ | ||
{ | ||
rank: 1, | ||
model: 'model1', | ||
}, | ||
{ | ||
rank: 2, | ||
model: 'model2', | ||
} | ||
]); | ||
}) | ||
}) |
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