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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.063latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.063
1.1.00
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

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