Compare commits
3 Commits
features/v
...
feature/to
Author | SHA1 | Date | |
---|---|---|---|
5f92144e0b | |||
4e5bced49a | |||
0dcee9190e |
@ -96,6 +96,7 @@ fieldset {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
border: none;
|
border: none;
|
||||||
|
min-width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
import { displayTokenListItem } from "./TokenListItem";
|
||||||
|
import { tokens } from "./tokens";
|
||||||
|
|
||||||
export function tokenList() {
|
export function tokenList() {
|
||||||
return `<form id="tokens"></form>`
|
const element = document.createElement("div");
|
||||||
|
element.classList.add("test");
|
||||||
|
return `<form id="tokens">${tokens.map((token) =>
|
||||||
|
displayTokenListItem(token.account, token.secret, element)
|
||||||
|
)}</form>`;
|
||||||
}
|
}
|
@ -1,12 +1,24 @@
|
|||||||
// @vitest-environment jsdom
|
// @vitest-environment jsdom
|
||||||
|
|
||||||
import { expect, test } from 'vitest'
|
import { expect, test } from "vitest";
|
||||||
import { tokenListitem } from './tokenListItem'
|
import { displayTokenListItem } from "./tokenListItem";
|
||||||
|
|
||||||
|
test("displays correct account name", () => {
|
||||||
|
const div: HTMLDivElement = document.createElement("div");
|
||||||
|
displayTokenListItem("Github", "ABCDEFGHIJKLMNOP", div);
|
||||||
|
expect(div.innerHTML).toContain("Github");
|
||||||
|
});
|
||||||
|
|
||||||
test('displays correct account name', () => {
|
test("displays multiple list items", () => {
|
||||||
const div: HTMLDivElement = document.createElement('div')
|
const div: HTMLDivElement = document.createElement("div");
|
||||||
tokenListitem('Github', 'ABCDEFGHIJKLMNOP', div);
|
displayTokenListItem("Github", "ABCDEFGHIJKLMNOP", div);
|
||||||
expect(div.innerHTML).toContain('Github')
|
displayTokenListItem("Gmail", "ABCDEFGHIJKLMNOP", div);
|
||||||
})
|
const tokens = [
|
||||||
|
{ account: "Github", secret: "blahblahblah" },
|
||||||
|
{ account: "Gmail", secret: "blahblahblah" },
|
||||||
|
];
|
||||||
|
tokens.map((token) => displayTokenListItem(token.account, token.secret, div));
|
||||||
|
console.log("dv", div.innerHTML);
|
||||||
|
expect(div.innerHTML).toContain("Github");
|
||||||
|
expect(div.innerHTML).toContain("Gmail");
|
||||||
|
});
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
|
import {displayToken} from './token'
|
||||||
|
export function displayTokenListItem(account: string, secret: string, element: HTMLDivElement){
|
||||||
|
|
||||||
export function tokenListitem(account: string, secret: string, element: HTMLDivElement){
|
return element.innerHTML = `<div class="fieldset-wrapper">
|
||||||
|
|
||||||
element.innerHTML += `<div class="fieldset-wrapper">
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label>Account</label>
|
<label>Account</label>
|
||||||
<p data-test-id="account">${account}</p>
|
<p data-test-id="account">${account}</p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label>Code</label>
|
<label>Code</label>
|
||||||
<p data-test-id="secret">${token}</p>
|
<p data-test-id="secret">${displayToken(secret)}</p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
Reference in New Issue
Block a user