This package has been deprecated

Author message:

This package has been deprecated. Please find this package under its new name @cloudflare/test-focus.

cf-test-focus

2.2.5 • 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 cf-test-focus

Weekly Downloads

1

Version

2.2.5

License

BSD-3-Clause

Unpacked Size

3.04 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