Commit 971df23e authored by Robert Knight's avatar Robert Knight

Move component test utilities to src/test-util/

Improve organizational clarity by separating tests from utility modules
used in tests, and also pave the way for re-using these utilities for UI
outside the sidebar app in future (eg. src/annotator/).
parent 94621615
......@@ -6,9 +6,9 @@ import AnnotationActionBar from '../annotation-action-bar';
import { $imports } from '../annotation-action-bar';
import * as fixtures from '../../test/annotation-fixtures';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { waitFor } from './util';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
import { waitFor } from '../../../test-util/wait';
describe('AnnotationActionBar', () => {
let fakeAnnotation;
......
......@@ -7,8 +7,8 @@ import * as fixtures from '../../test/annotation-fixtures';
import AnnotationBody from '../annotation-body';
import { $imports } from '../annotation-body';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('AnnotationBody', () => {
function createBody(props = {}) {
......
......@@ -5,8 +5,8 @@ import * as fixtures from '../../test/annotation-fixtures';
import AnnotationDocumentInfo from '../annotation-document-info';
import { $imports } from '../annotation-document-info';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('AnnotationDocumentInfo', () => {
let fakeDomainAndTitle;
......
......@@ -5,8 +5,8 @@ import * as fixtures from '../../test/annotation-fixtures';
import AnnotationHeader from '../annotation-header';
import { $imports } from '../annotation-header';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('AnnotationHeader', () => {
let fakeIsHighlight;
......
......@@ -4,7 +4,7 @@ import { act } from 'preact/test-utils';
import * as fixtures from '../../test/annotation-fixtures';
import mockImportedComponents from './mock-imported-components';
import mockImportedComponents from '../../../test-util/mock-imported-components';
// @TODO Note this import as `Annotation` for easier updating later
......
......@@ -5,8 +5,8 @@ import * as fixtures from '../../test/annotation-fixtures';
import AnnotationPublishControl from '../annotation-publish-control';
import { $imports } from '../annotation-publish-control';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('AnnotationPublishControl', () => {
let fakeGroup;
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import AnnotationQuote from '../annotation-quote';
import { $imports } from '../annotation-quote';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('AnnotationQuote', () => {
let fakeAnnotation;
......
......@@ -5,8 +5,8 @@ import { act } from 'preact/test-utils';
import AnnotationShareControl from '../annotation-share-control';
import { $imports } from '../annotation-share-control';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('AnnotationShareControl', () => {
let fakeAnnotation;
......
......@@ -5,8 +5,8 @@ import * as fixtures from '../../test/annotation-fixtures';
import AnnotationShareInfo from '../annotation-share-info';
import { $imports } from '../annotation-share-info';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('AnnotationShareInfo', () => {
let fakeGroup;
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import AnnotationUser from '../annotation-user';
import { $imports } from '../annotation-user';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('AnnotationUser', () => {
let fakeAnnotation;
......
......@@ -4,7 +4,7 @@ import { createElement } from 'preact';
import AutocompleteList from '../autocomplete-list';
import { $imports } from '../autocomplete-list';
import mockImportedComponents from './mock-imported-components';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('AutocompleteList', function() {
let fakeList;
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import Button from '../button';
import { $imports } from '../button';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('Button', () => {
let fakeOnClick;
......
......@@ -5,7 +5,7 @@ import { act } from 'preact/test-utils';
import Excerpt from '../excerpt';
import { $imports } from '../excerpt';
import { checkAccessibility } from './accessibility';
import { checkAccessibility } from '../../../test-util/accessibility';
describe('Excerpt', () => {
const SHORT_DIV = <div id="foo" style="height: 5px;" />;
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import FocusedModeHeader from '../focused-mode-header';
import { $imports } from '../focused-mode-header';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('FocusedModeHeader', function() {
let fakeStore;
......
......@@ -4,7 +4,7 @@ import { createElement } from 'preact';
import GroupListSection from '../group-list-section';
import { $imports } from '../group-list-section';
import mockImportedComponents from './mock-imported-components';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('GroupListSection', () => {
const testGroups = [
......
......@@ -5,7 +5,7 @@ import { act } from 'preact/test-utils';
import GroupList from '../group-list';
import { $imports } from '../group-list';
import mockImportedComponents from './mock-imported-components';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('GroupList', () => {
let fakeServiceConfig;
......
......@@ -5,8 +5,8 @@ import { act } from 'preact/test-utils';
import HelpPanel from '../help-panel';
import { $imports } from '../help-panel';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('HelpPanel', function() {
let fakeAuth;
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import LoggedOutMessage from '../logged-out-message';
import { $imports } from '../logged-out-message';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('LoggedOutMessage', () => {
const createLoggedOutMessage = props => {
......
......@@ -6,7 +6,7 @@ import { LinkType } from '../../markdown-commands';
import MarkdownEditor from '../markdown-editor';
import { $imports } from '../markdown-editor';
import { checkAccessibility } from './accessibility';
import { checkAccessibility } from '../../../test-util/accessibility';
describe('MarkdownEditor', () => {
const formatResult = {
......
......@@ -4,7 +4,7 @@ import { createElement } from 'preact';
import MarkdownView from '../markdown-view';
import { $imports } from '../markdown-view';
import { checkAccessibility } from './accessibility';
import { checkAccessibility } from '../../../test-util/accessibility';
describe('MarkdownView', () => {
let fakeMediaEmbedder;
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import MenuItem from '../menu-item';
import { $imports } from '../menu-item';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('MenuItem', () => {
const createMenuItem = props =>
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import MenuSection from '../menu-section';
import { $imports } from '../menu-section';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('MenuSection', () => {
const createMenuSection = props =>
......
......@@ -5,7 +5,7 @@ import { act } from 'preact/test-utils';
import Menu from '../menu';
import { $imports } from '../menu';
import { checkAccessibility } from './accessibility';
import { checkAccessibility } from '../../../test-util/accessibility';
describe('Menu', () => {
let container;
......
......@@ -5,8 +5,8 @@ import * as fixtures from '../../test/annotation-fixtures';
import ModerationBanner from '../moderation-banner';
import { $imports } from '../moderation-banner';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
const moderatedAnnotation = fixtures.moderatedAnnotation;
......
......@@ -6,8 +6,8 @@ import events from '../../events';
import NewNoteButton from '../new-note-btn';
import { $imports } from '../new-note-btn';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('NewNoteButton', function() {
let fakeStore;
......
......@@ -4,7 +4,7 @@ import { createElement } from 'preact';
import SearchInput from '../search-input';
import { $imports } from '../search-input';
import { checkAccessibility } from './accessibility';
import { checkAccessibility } from '../../../test-util/accessibility';
describe('SearchInput', () => {
let fakeStore;
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import SearchStatusBar from '../search-status-bar';
import { $imports } from '../search-status-bar';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('SearchStatusBar', () => {
let fakeRootThread;
......
......@@ -5,8 +5,8 @@ import uiConstants from '../../ui-constants';
import SelectionTabs from '../selection-tabs';
import { $imports } from '../selection-tabs';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('SelectionTabs', function() {
// mock services
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import ShareAnnotationsPanel from '../share-annotations-panel';
import { $imports } from '../share-annotations-panel';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('ShareAnnotationsPanel', () => {
let fakeStore;
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import ShareLinks from '../share-links';
import { $imports } from '../share-links';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('ShareLinks', () => {
let fakeAnalytics;
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import SidebarContentError from '../sidebar-content-error';
import { $imports } from '../sidebar-content-error';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('SidebarContentError', () => {
const createSidebarContentError = (
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import SidebarPanel from '../sidebar-panel';
import { $imports } from '../sidebar-panel';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('SidebarPanel', () => {
let fakeStore;
......
......@@ -3,7 +3,7 @@ import { createElement } from 'preact';
import Slider from '../slider';
import { checkAccessibility } from './accessibility';
import { checkAccessibility } from '../../../test-util/accessibility';
describe('Slider', () => {
let container;
......
......@@ -4,7 +4,7 @@ import { createElement } from 'preact';
import SortMenu from '../sort-menu';
import { $imports } from '../sort-menu';
import mockImportedComponents from './mock-imported-components';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('SortMenu', () => {
let fakeState;
......
......@@ -3,7 +3,7 @@ import { createElement } from 'preact';
import Spinner from '../spinner';
import { checkAccessibility } from './accessibility';
import { checkAccessibility } from '../../../test-util/accessibility';
describe('Spinner', function() {
const createSpinner = (props = {}) => mount(<Spinner {...props} />);
......
......@@ -5,7 +5,7 @@ import { act } from 'preact/test-utils';
import StreamSearchInput from '../stream-search-input';
import { $imports } from '../stream-search-input';
import mockImportedComponents from './mock-imported-components';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('StreamSearchInput', () => {
let fakeLocation;
......
......@@ -5,8 +5,8 @@ import { act } from 'preact/test-utils';
import TagEditor from '../tag-editor';
import { $imports } from '../tag-editor';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('TagEditor', function() {
let containers = [];
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import TagList from '../tag-list';
import { $imports } from '../tag-list';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('TagList', function() {
let fakeServiceUrl;
......
......@@ -5,7 +5,7 @@ import { act } from 'preact/test-utils';
import Timestamp from '../timestamp';
import { $imports } from '../timestamp';
import { checkAccessibility } from './accessibility';
import { checkAccessibility } from '../../../test-util/accessibility';
describe('Timestamp', () => {
let clock;
......
......@@ -6,8 +6,8 @@ import uiConstants from '../../ui-constants';
import TopBar from '../top-bar';
import { $imports } from '../top-bar';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('TopBar', () => {
const fakeSettings = {};
......
......@@ -4,8 +4,8 @@ import { createElement } from 'preact';
import Tutorial from '../tutorial';
import { $imports } from '../tutorial';
import { checkAccessibility } from './accessibility';
import mockImportedComponents from './mock-imported-components';
import { checkAccessibility } from '../../../test-util/accessibility';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('Tutorial', function() {
let fakeIsThirdPartyService;
......
......@@ -5,7 +5,7 @@ import bridgeEvents from '../../../shared/bridge-events';
import UserMenu from '../user-menu';
import { $imports } from '../user-menu';
import mockImportedComponents from './mock-imported-components';
import mockImportedComponents from '../../../test-util/mock-imported-components';
describe('UserMenu', () => {
let fakeAuth;
......
......@@ -4,7 +4,7 @@ import { createElement } from 'preact';
import VersionInfo from '../version-info';
import { $imports } from '../version-info';
import { checkAccessibility } from './accessibility';
import { checkAccessibility } from '../../../test-util/accessibility';
describe('VersionInfo', function() {
let fakeVersionData;
......
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