Unverified Commit 911112cd authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #1852 from hypothesis/move-last-directive-test-module

Move last remaining module out of src/sidebar/directive/test
parents 3a07e068 4084f932
......@@ -146,9 +146,3 @@ export function createDirective(
return linkDirective(initialScope);
}
/** Helper to dispatch a native event to a DOM element. */
export function sendEvent(element, eventType) {
const event = new Event(eventType, { bubbles: true, cancelable: true });
element.dispatchEvent(event);
}
import angular from 'angular';
import * as util from '../../directive/test/util';
import * as util from './angular-util';
import events from '../../events';
import * as fixtures from '../../test/annotation-fixtures';
import annotationComponent from '../annotation';
......
import angular from 'angular';
import * as util from '../../directive/test/util';
import * as util from './angular-util';
import * as fixtures from '../../test/annotation-fixtures';
import annotationThread from '../annotation-thread';
import moderationBanner from '../moderation-banner';
......
......@@ -2,7 +2,7 @@ import angular from 'angular';
import immutable from 'seamless-immutable';
import EventEmitter from 'tiny-emitter';
import * as util from '../../directive/test/util';
import * as util from './angular-util';
import events from '../../events';
import threadList, { $imports } from '../thread-list';
......@@ -227,8 +227,10 @@ describe('threadList', function() {
const element = createThreadList(inputs);
fakeVirtualThread.notify();
element.scope.$digest();
const annotation = element[0].querySelector('.thread-list__card');
util.sendEvent(annotation, 'mouseover');
const cardElement = element[0].querySelector('.thread-list__card');
cardElement.dispatchEvent(new Event('mouseover'));
assert.calledWithMatch(
inputs.onFocus.callback,
sinon.match(annotFixtures.annotation)
......@@ -245,8 +247,10 @@ describe('threadList', function() {
const element = createThreadList(inputs);
fakeVirtualThread.notify();
element.scope.$digest();
const annotation = element[0].querySelector('.thread-list__card');
util.sendEvent(annotation, 'click');
const cardElement = element[0].querySelector('.thread-list__card');
cardElement.dispatchEvent(new Event('click'));
assert.calledWithMatch(
inputs.onSelect.callback,
sinon.match(annotFixtures.annotation)
......
......@@ -4,7 +4,7 @@ import { useContext } from 'preact/hooks';
import propTypes from 'prop-types';
import { Injector } from '../../../shared/injector';
import { createDirective } from '../../directive/test/util';
import { createDirective } from '../../components/test/angular-util';
import { ServiceContext } from '../service-context';
import wrapReactComponent from '../wrap-react-component';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment