@cloudflare/test-focus

1.0.30 • Public • Published

cf-test-focus

Cloudflare Focus Test Util

Installation

$ npm install cf-test-focus

Usage

import assert from 'assert';
import {trackFocus, getCurrentFocus} from 'cf-test-focus';

describe('exampleModule', () => {
  it('should do something with focus', () => {
    const stub = trackFocus();
    exampleModule.doSomething();
    assert.ok(stub.called);
    assert.equal(getCurrentFocus(), document.getElementById('#expected-focused-element'));
    // This will happen automatically in between tests.
    stub.restore();
  });
});

Readme

Keywords

none

Package Sidebar

Install

npm i @cloudflare/test-focus

Weekly Downloads

965

Version

1.0.30

License

BSD-3-Clause

Unpacked Size

8.15 kB

Total Files

7

Last publish

Collaborators

  • lerwincf
  • lbarthonet
  • cf-media-manager
  • jacobbednarz
  • celso
  • cf-radar
  • dash_service_account
  • g4brym
  • snigdha34
  • wrangler-publisher
  • marksteyn
  • chiminator
  • sgoodhew_cf
  • terinjokes
  • third774
  • jsteinberger
  • jasnell
  • asapzacy
  • pcostanzo
  • gregbrimble
  • geelen
  • rexscaria
  • dcruz_cf
  • xuranwang
  • jculvey
  • sejoker
  • vasturiano
  • cf-ci-write
  • segments-write
  • thibmeu
  • xortive
  • gurjinder
  • cf-ci2
  • lvalenta
  • worenga