Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add focus middleware mock and tests #635

merged 1 commit into from Jan 6, 2020


Copy link

@nicknisi nicknisi commented Jan 6, 2020

Type: feature

The following has been addressed in the PR:


This adds a focus middleware mock that is capable of mocking the return value of the middleware's isFocused method.

const focusMock = createFocusMock();
const factory = create({ focus });
const App = factory(({ middleware: { focus } }) => {
	return <div key="root">{focus.isFocused('root') ? 'focus' : 'no focus'}</div>;
const h = harness(() => <App />, { middleware: [[focus, focusMock]] });

focusMock('root', false);
h.expect(() => <div key="root">no focus</div>);

focusMock('root', true);
h.expect(() => <div key="root">focus</div>);

Resolves #627

Copy link

codesandbox-ci bot commented Jan 6, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8ea5fc1:

Sandbox Source
jolly-sky-3u33q Configuration

@nicknisi nicknisi merged commit a16782d into dojo:master Jan 6, 2020
5 checks passed
@nicknisi nicknisi deleted the focus-mock branch Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

2 participants