Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

1234567891011
  1. import fs from 'fs'
  2. import path from 'path'
  3. import {DOMWindow, JSDOM} from 'jsdom'
  4. export type Window = DOMWindow
  5. export const loadTemplate = async (templateName: string): Promise<Window> => {
  6. const templatePath = path.join('test', 'fixtures', 'templates', `${templateName}.html`)
  7. const templateRaw = await fs.promises.readFile(templatePath)
  8. return new JSDOM(templateRaw.toString('utf-8')).window
  9. }