Add selector utils
provides easy access to forms and tables
This commit is contained in:
parent
8165534bb6
commit
e0d8596e1c
|
|
@ -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');
|
||||
Loading…
Reference in New Issue