1.2.0 • Published 6 months ago

dom-objects v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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

1.2.0

6 months ago

1.1.0

6 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago