diff --git a/ui/src/tests/selector.ts b/ui/src/tests/selector.ts new file mode 100644 index 0000000..bca2ffc --- /dev/null +++ b/ui/src/tests/selector.ts @@ -0,0 +1,24 @@ +export const heading = () => { + return `main h1`; +}; + +export const table = (tableSelector: string) => { + return { + selector: () => tableSelector, + rows: () => `${tableSelector} tbody tr`, + row: (index: number) => `${tableSelector} tbody tr:nth-child(${index})`, + cell: (index: number, col: number, suffix = '') => + `${tableSelector} tbody tr:nth-child(${index}) td:nth-child(${col}) ${suffix}`, + }; +}; + +export const form = (dialogSelector: string) => { + return { + selector: () => dialogSelector, + input: (selector: string) => `${dialogSelector} ${selector} input`, + textarea: (selector: string) => `${dialogSelector} ${selector} textarea[type=text]`, + button: (selector: string) => `${dialogSelector} button${selector}`, + }; +}; + +export const $confirmDialog = form('.confirm-dialog');