dom-objects
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

DOM Objects

DOM Objects declarations for tests, e2e, cypress and etc.

npm i -D dom-objects

Usage

// utils/objects.ts
import { configureDomObjects } from 'dom-objects';


const DO = configureDomObjects({
  attributeName: 'cy',
});

export const header = DO('header');
export const createMenu = header.add('createMenu');
export const createButton = createMenu.add('createButton');
// src/components/button.tsx
import { createButton } from '../../utils/objects';

export const Page = () => (
  <main>
    <form>
      <button {...createButton.attrs}>Submit</button>
    </form>
  </main>
)
// cypress/e2e/test.cy.ts
import { createButton } from '../../utils/objects';

describe('Test', () => {
  it('must be', () => {
    //...
    cy.get(createButton.query).click();
    //...
  });
});

License MIT

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i dom-objects

    Weekly Downloads

    63

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    21.9 kB

    Total Files

    6

    Last publish

    Collaborators

    • awinogradov