2.2.5 • Published 6 years ago

cf-test-focus v2.2.5

Weekly downloads
73
License
BSD-3-Clause
Repository
-
Last release
6 years ago

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();
  });
});
2.2.5

6 years ago

2.2.4

6 years ago

2.2.3

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago