Commit 4153041f authored by Robert Knight's avatar Robert Knight

Convert modules in src/sidebar/components to ES modules

Use the convert-to-es-modules package from the frontend-toolkit repo to
convert CommonJS/Node require syntax to ES modules.

As well as the module syntax conversion, this script also has the effect
of normalizing the sorting and grouping of imports according to the
following convention:

 - Imports are grouped into 3 categories: Vendor, same package but other
   directory (as calling module), same directory as calling module
 - Imports are sorted by module path

Import specifiers are untouched.
parent 65d34fbd
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import propTypes from 'prop-types';
const { withServices } = require('../util/service-context'); import useStore from '../store/use-store';
const useStore = require('../store/use-store'); import { isShareable, shareURI } from '../util/annotation-sharing';
const { isShareable, shareURI } = require('../util/annotation-sharing'); import { withServices } from '../util/service-context';
const AnnotationShareControl = require('./annotation-share-control'); import AnnotationShareControl from './annotation-share-control';
const Button = require('./button'); import Button from './button';
/** /**
* A collection of `Button`s in the footer area of an annotation that take * A collection of `Button`s in the footer area of an annotation that take
...@@ -121,4 +121,4 @@ AnnotationActionBar.injectedProps = [ ...@@ -121,4 +121,4 @@ AnnotationActionBar.injectedProps = [
'settings', 'settings',
]; ];
module.exports = withServices(AnnotationActionBar); export default withServices(AnnotationActionBar);
const { createElement } = require('preact'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const Excerpt = require('./excerpt'); import Excerpt from './excerpt';
const MarkdownEditor = require('./markdown-editor'); import MarkdownEditor from './markdown-editor';
const MarkdownView = require('./markdown-view'); import MarkdownView from './markdown-view';
/** /**
* Display the rendered content of an annotation. * Display the rendered content of an annotation.
*/ */
function AnnotationBody({ export default function AnnotationBody({
collapse, collapse,
isEditing, isEditing,
isHiddenByModerator, isHiddenByModerator,
...@@ -91,5 +91,3 @@ AnnotationBody.propTypes = { ...@@ -91,5 +91,3 @@ AnnotationBody.propTypes = {
*/ */
text: propTypes.string, text: propTypes.string,
}; };
module.exports = AnnotationBody;
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import propTypes from 'prop-types';
const annotationMetadata = require('../util/annotation-metadata'); import * as annotationMetadata from '../util/annotation-metadata';
/** /**
* Render some metadata about an annotation's document and link to it * Render some metadata about an annotation's document and link to it
* if a link is available. * if a link is available.
*/ */
function AnnotationDocumentInfo({ annotation }) { export default function AnnotationDocumentInfo({ annotation }) {
const documentInfo = annotationMetadata.domainAndTitle(annotation); const documentInfo = annotationMetadata.domainAndTitle(annotation);
// If there's no document title, nothing to do here // If there's no document title, nothing to do here
if (!documentInfo.titleText) { if (!documentInfo.titleText) {
...@@ -38,5 +38,3 @@ AnnotationDocumentInfo.propTypes = { ...@@ -38,5 +38,3 @@ AnnotationDocumentInfo.propTypes = {
/* Annotation for which the document metadata will be rendered */ /* Annotation for which the document metadata will be rendered */
annotation: propTypes.object.isRequired, annotation: propTypes.object.isRequired,
}; };
module.exports = AnnotationDocumentInfo;
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import propTypes from 'prop-types';
const { isHighlight } = require('../util/annotation-metadata'); import { isHighlight } from '../util/annotation-metadata';
const AnnotationDocumentInfo = require('./annotation-document-info'); import AnnotationDocumentInfo from './annotation-document-info';
const AnnotationShareInfo = require('./annotation-share-info'); import AnnotationShareInfo from './annotation-share-info';
const AnnotationUser = require('./annotation-user'); import AnnotationUser from './annotation-user';
const SvgIcon = require('./svg-icon'); import SvgIcon from './svg-icon';
const Timestamp = require('./timestamp'); import Timestamp from './timestamp';
/** /**
* Render an annotation's header summary, including metadata about its user, * Render an annotation's header summary, including metadata about its user,
* sharing status, document and timestamp. It also allows the user to * sharing status, document and timestamp. It also allows the user to
* toggle sub-threads/replies in certain cases. * toggle sub-threads/replies in certain cases.
*/ */
function AnnotationHeader({ export default function AnnotationHeader({
annotation, annotation,
isEditing, isEditing,
onReplyCountClick, onReplyCountClick,
...@@ -92,5 +92,3 @@ AnnotationHeader.propTypes = { ...@@ -92,5 +92,3 @@ AnnotationHeader.propTypes = {
*/ */
showDocumentInfo: propTypes.bool, showDocumentInfo: propTypes.bool,
}; };
module.exports = AnnotationHeader;
const { createElement } = require('preact'); import { createElement } from 'preact';
const SvgIcon = require('./svg-icon'); import SvgIcon from './svg-icon';
/** /**
* Render information about CC licensing * Render information about CC licensing
*/ */
function AnnotationLicense() { export default function AnnotationLicense() {
return ( return (
<div className="annotation-license"> <div className="annotation-license">
<a <a
...@@ -34,5 +34,3 @@ function AnnotationLicense() { ...@@ -34,5 +34,3 @@ function AnnotationLicense() {
} }
AnnotationLicense.propTypes = {}; AnnotationLicense.propTypes = {};
module.exports = AnnotationLicense;
const { createElement } = require('preact'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const useStore = require('../store/use-store'); import useStore from '../store/use-store';
const { quote } = require('../util/annotation-metadata'); import { quote } from '../util/annotation-metadata';
const { withServices } = require('../util/service-context'); import { withServices } from '../util/service-context';
const AnnotationHeader = require('./annotation-header'); import AnnotationHeader from './annotation-header';
const AnnotationQuote = require('./annotation-quote'); import AnnotationQuote from './annotation-quote';
/** /**
* The "new", migrated-to-preact annotation component. * The "new", migrated-to-preact annotation component.
...@@ -67,4 +67,4 @@ AnnotationOmega.propTypes = { ...@@ -67,4 +67,4 @@ AnnotationOmega.propTypes = {
AnnotationOmega.injectedProps = ['permissions']; AnnotationOmega.injectedProps = ['permissions'];
module.exports = withServices(AnnotationOmega); export default withServices(AnnotationOmega);
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import propTypes from 'prop-types';
const { applyTheme } = require('../util/theme'); import { withServices } from '../util/service-context';
const { withServices } = require('../util/service-context'); import { applyTheme } from '../util/theme';
const Button = require('./button'); import Button from './button';
const Menu = require('./menu'); import Menu from './menu';
const MenuItem = require('./menu-item'); import MenuItem from './menu-item';
/** /**
* Render a compound control button for publishing (saving) an annotation: * Render a compound control button for publishing (saving) an annotation:
...@@ -111,4 +111,4 @@ AnnotationPublishControl.propTypes = { ...@@ -111,4 +111,4 @@ AnnotationPublishControl.propTypes = {
AnnotationPublishControl.injectedProps = ['settings']; AnnotationPublishControl.injectedProps = ['settings'];
module.exports = withServices(AnnotationPublishControl); export default withServices(AnnotationPublishControl);
const classnames = require('classnames'); import classnames from 'classnames';
const { createElement } = require('preact'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const { isOrphan, quote } = require('../util/annotation-metadata'); import { isOrphan, quote } from '../util/annotation-metadata';
const { withServices } = require('../util/service-context'); import { withServices } from '../util/service-context';
const { applyTheme } = require('../util/theme'); import { applyTheme } from '../util/theme';
const Excerpt = require('./excerpt'); import Excerpt from './excerpt';
/** /**
* Display the selected text from the document associated with an annotation. * Display the selected text from the document associated with an annotation.
...@@ -44,4 +44,4 @@ AnnotationQuote.propTypes = { ...@@ -44,4 +44,4 @@ AnnotationQuote.propTypes = {
AnnotationQuote.injectedProps = ['settings']; AnnotationQuote.injectedProps = ['settings'];
module.exports = withServices(AnnotationQuote); export default withServices(AnnotationQuote);
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import { useEffect, useRef, useState } from 'preact/hooks';
const { useEffect, useRef, useState } = require('preact/hooks'); import propTypes from 'prop-types';
const useElementShouldClose = require('./hooks/use-element-should-close'); import { copyText } from '../util/copy-to-clipboard';
const { copyText } = require('../util/copy-to-clipboard'); import { withServices } from '../util/service-context';
const { withServices } = require('../util/service-context');
const Button = require('./button'); import Button from './button';
const ShareLinks = require('./share-links'); import useElementShouldClose from './hooks/use-element-should-close';
const SvgIcon = require('./svg-icon'); import ShareLinks from './share-links';
import SvgIcon from './svg-icon';
/** /**
* "Popup"-style component for sharing a single annotation. * "Popup"-style component for sharing a single annotation.
...@@ -149,4 +149,4 @@ AnnotationShareControl.propTypes = { ...@@ -149,4 +149,4 @@ AnnotationShareControl.propTypes = {
AnnotationShareControl.injectedProps = ['analytics', 'flash', 'permissions']; AnnotationShareControl.injectedProps = ['analytics', 'flash', 'permissions'];
module.exports = withServices(AnnotationShareControl); export default withServices(AnnotationShareControl);
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import propTypes from 'prop-types';
const { withServices } = require('../util/service-context'); import useStore from '../store/use-store';
const useStore = require('../store/use-store'); import { withServices } from '../util/service-context';
const SvgIcon = require('./svg-icon'); import SvgIcon from './svg-icon';
/** /**
* Render information about what group an annotation is in and * Render information about what group an annotation is in and
...@@ -72,4 +72,4 @@ AnnotationShareInfo.propTypes = { ...@@ -72,4 +72,4 @@ AnnotationShareInfo.propTypes = {
AnnotationShareInfo.injectedProps = ['permissions']; AnnotationShareInfo.injectedProps = ['permissions'];
module.exports = withServices(AnnotationShareInfo); export default withServices(AnnotationShareInfo);
...@@ -109,10 +109,7 @@ function AnnotationThreadController(features, store) { ...@@ -109,10 +109,7 @@ function AnnotationThreadController(features, store) {
}; };
} }
/** export default {
* Renders a thread of annotations.
*/
module.exports = {
controllerAs: 'vm', controllerAs: 'vm',
controller: AnnotationThreadController, controller: AnnotationThreadController,
bindings: { bindings: {
......
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import propTypes from 'prop-types';
const { isThirdPartyUser, username } = require('../util/account-id'); import { isThirdPartyUser, username } from '../util/account-id';
const { withServices } = require('../util/service-context'); import { withServices } from '../util/service-context';
/** /**
* Display information about an annotation's user. Link to the user's * Display information about an annotation's user. Link to the user's
...@@ -63,4 +63,4 @@ AnnotationUser.propTypes = { ...@@ -63,4 +63,4 @@ AnnotationUser.propTypes = {
}; };
AnnotationUser.injectedProps = ['features', 'serviceUrl', 'settings']; AnnotationUser.injectedProps = ['features', 'serviceUrl', 'settings'];
module.exports = withServices(AnnotationUser); export default withServices(AnnotationUser);
...@@ -71,7 +71,7 @@ function AnnotationViewerContentController( ...@@ -71,7 +71,7 @@ function AnnotationViewerContentController(
}); });
} }
module.exports = { export default {
controller: AnnotationViewerContentController, controller: AnnotationViewerContentController,
controllerAs: 'vm', controllerAs: 'vm',
bindings: {}, bindings: {},
......
const { import events from '../events';
isNew, import { isThirdPartyUser } from '../util/account-id';
isReply, import { isNew, isReply, isPageNote, quote } from '../util/annotation-metadata';
isPageNote,
quote,
} = require('../util/annotation-metadata');
const events = require('../events');
const { isThirdPartyUser } = require('../util/account-id');
/** /**
* Return a copy of `annotation` with changes made in the editor applied. * Return a copy of `annotation` with changes made in the editor applied.
...@@ -451,7 +446,7 @@ function AnnotationController( ...@@ -451,7 +446,7 @@ function AnnotationController(
}; };
} }
module.exports = { export default {
controller: AnnotationController, controller: AnnotationController,
controllerAs: 'vm', controllerAs: 'vm',
bindings: { bindings: {
......
const classnames = require('classnames'); import classnames from 'classnames';
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import propTypes from 'prop-types';
const SvgIcon = require('./svg-icon'); import SvgIcon from './svg-icon';
/** /**
* A button, one of three base types depending on provided props: * A button, one of three base types depending on provided props:
...@@ -16,7 +16,7 @@ const SvgIcon = require('./svg-icon'); ...@@ -16,7 +16,7 @@ const SvgIcon = require('./svg-icon');
* - `usePrimaryStyle`: for applying "primary action" styling * - `usePrimaryStyle`: for applying "primary action" styling
* - `className`: arbitrary additional class name(s) to apply * - `className`: arbitrary additional class name(s) to apply
*/ */
function Button({ export default function Button({
buttonText = '', buttonText = '',
className = '', className = '',
icon = '', icon = '',
...@@ -128,5 +128,3 @@ Button.propTypes = { ...@@ -128,5 +128,3 @@ Button.propTypes = {
*/ */
usePrimaryStyle: propTypes.bool, usePrimaryStyle: propTypes.bool,
}; };
module.exports = Button;
const classnames = require('classnames'); import classnames from 'classnames';
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import { useCallback, useLayoutEffect, useRef, useState } from 'preact/hooks';
const { import propTypes from 'prop-types';
useCallback,
useLayoutEffect, import observeElementSize from '../util/observe-element-size';
useRef, import { withServices } from '../util/service-context';
useState, import { applyTheme } from '../util/theme';
} = require('preact/hooks');
const { applyTheme } = require('../util/theme');
const { withServices } = require('../util/service-context');
const observeElementSize = require('../util/observe-element-size');
/** /**
* An optional toggle link at the bottom of an excerpt which controls whether * An optional toggle link at the bottom of an excerpt which controls whether
...@@ -185,4 +180,4 @@ Excerpt.propTypes = { ...@@ -185,4 +180,4 @@ Excerpt.propTypes = {
Excerpt.injectedProps = ['settings']; Excerpt.injectedProps = ['settings'];
module.exports = withServices(Excerpt); export default withServices(Excerpt);
const { createElement } = require('preact'); import { createElement } from 'preact';
const useStore = require('../store/use-store'); import useStore from '../store/use-store';
/** /**
* Render a control to interact with any focused "mode" in the sidebar. * Render a control to interact with any focused "mode" in the sidebar.
* Currently only a user-focus mode is supported but this could be broadened * Currently only a user-focus mode is supported but this could be broadened
* and abstracted if needed. Allow user to toggle in and out of the focus "mode." * and abstracted if needed. Allow user to toggle in and out of the focus "mode."
*/ */
function FocusedModeHeader() { export default function FocusedModeHeader() {
const actions = useStore(store => ({ const actions = useStore(store => ({
setFocusModeFocused: store.setFocusModeFocused, setFocusModeFocused: store.setFocusModeFocused,
})); }));
...@@ -59,5 +59,3 @@ function FocusedModeHeader() { ...@@ -59,5 +59,3 @@ function FocusedModeHeader() {
} }
FocusedModeHeader.propTypes = {}; FocusedModeHeader.propTypes = {};
module.exports = FocusedModeHeader;
const propTypes = require('prop-types'); import { Fragment, createElement } from 'preact';
const { Fragment, createElement } = require('preact'); import propTypes from 'prop-types';
const useStore = require('../store/use-store'); import useStore from '../store/use-store';
const { orgName } = require('../util/group-list-item-common'); import { copyText } from '../util/copy-to-clipboard';
const { withServices } = require('../util/service-context'); import { orgName } from '../util/group-list-item-common';
const { copyText } = require('../util/copy-to-clipboard'); import { withServices } from '../util/service-context';
const MenuItem = require('./menu-item'); import MenuItem from './menu-item';
/** /**
* An item in the groups selection menu. * An item in the groups selection menu.
...@@ -155,4 +155,4 @@ GroupListItem.propTypes = { ...@@ -155,4 +155,4 @@ GroupListItem.propTypes = {
GroupListItem.injectedProps = ['analytics', 'flash', 'groups']; GroupListItem.injectedProps = ['analytics', 'flash', 'groups'];
module.exports = withServices(GroupListItem); export default withServices(GroupListItem);
const { createElement } = require('preact'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const GroupListItem = require('./group-list-item'); import GroupListItem from './group-list-item';
const MenuSection = require('./menu-section'); import MenuSection from './menu-section';
/** /**
* A labeled section of the groups list. * A labeled section of the groups list.
*/ */
function GroupListSection({ expandedGroup, onExpandGroup, groups, heading }) { export default function GroupListSection({
expandedGroup,
onExpandGroup,
groups,
heading,
}) {
return ( return (
<MenuSection heading={heading}> <MenuSection heading={heading}>
{groups.map(group => ( {groups.map(group => (
...@@ -42,5 +47,3 @@ GroupListSection.propTypes = { ...@@ -42,5 +47,3 @@ GroupListSection.propTypes = {
*/ */
onExpandGroup: propTypes.func, onExpandGroup: propTypes.func,
}; };
module.exports = GroupListSection;
const { createElement } = require('preact'); import { createElement } from 'preact';
const { useMemo, useState } = require('preact/hooks'); import { useMemo, useState } from 'preact/hooks';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const isThirdPartyService = require('../util/is-third-party-service'); import serviceConfig from '../service-config';
const { isThirdPartyUser } = require('../util/account-id'); import useStore from '../store/use-store';
const groupsByOrganization = require('../util/group-organizations'); import { isThirdPartyUser } from '../util/account-id';
const useStore = require('../store/use-store'); import groupsByOrganization from '../util/group-organizations';
const { withServices } = require('../util/service-context'); import isThirdPartyService from '../util/is-third-party-service';
const serviceConfig = require('../service-config'); import { withServices } from '../util/service-context';
const Menu = require('./menu'); import GroupListSection from './group-list-section';
const MenuItem = require('./menu-item'); import Menu from './menu';
const GroupListSection = require('./group-list-section'); import MenuItem from './menu-item';
/** /**
* Return the custom icon for the top bar configured by the publisher in * Return the custom icon for the top bar configured by the publisher in
...@@ -136,4 +136,4 @@ GroupList.propTypes = { ...@@ -136,4 +136,4 @@ GroupList.propTypes = {
GroupList.injectedProps = ['serviceUrl', 'settings']; GroupList.injectedProps = ['serviceUrl', 'settings'];
module.exports = withServices(GroupList); export default withServices(GroupList);
const { createElement } = require('preact'); import { createElement } from 'preact';
const { useCallback, useMemo, useState } = require('preact/hooks'); import { useCallback, useMemo, useState } from 'preact/hooks';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const uiConstants = require('../ui-constants'); import useStore from '../store/use-store';
const useStore = require('../store/use-store'); import uiConstants from '../ui-constants';
const VersionData = require('../util/version-data'); import { withServices } from '../util/service-context';
const { withServices } = require('../util/service-context'); import VersionData from '../util/version-data';
const SidebarPanel = require('./sidebar-panel'); import SidebarPanel from './sidebar-panel';
const SvgIcon = require('./svg-icon'); import SvgIcon from './svg-icon';
const Tutorial = require('./tutorial'); import Tutorial from './tutorial';
const VersionInfo = require('./version-info'); import VersionInfo from './version-info';
/** /**
* External link "tabs" inside of the help panel. * External link "tabs" inside of the help panel.
...@@ -156,4 +156,4 @@ HelpPanel.propTypes = { ...@@ -156,4 +156,4 @@ HelpPanel.propTypes = {
}; };
HelpPanel.injectedProps = ['session']; HelpPanel.injectedProps = ['session'];
module.exports = withServices(HelpPanel); export default withServices(HelpPanel);
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { useRef } = require('preact/hooks'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import { useRef } from 'preact/hooks';
import { act } from 'preact/test-utils';
import propTypes from 'prop-types';
const { act } = require('preact/test-utils'); import useElementShouldClose from '../use-element-should-close';
const { mount } = require('enzyme');
const useElementShouldClose = require('../use-element-should-close');
describe('hooks.useElementShouldClose', () => { describe('hooks.useElementShouldClose', () => {
let handleClose; let handleClose;
......
const { useEffect } = require('preact/hooks'); import { useEffect } from 'preact/hooks';
const { listen } = require('../../util/dom'); import { listen } from '../../util/dom';
/** /**
* This hook adds appropriate `eventListener`s to the document when a target * This hook adds appropriate `eventListener`s to the document when a target
...@@ -19,7 +19,11 @@ const { listen } = require('../../util/dom'); ...@@ -19,7 +19,11 @@ const { listen } = require('../../util/dom');
* @param {() => void} handleClose - A function that will do the actual closing * @param {() => void} handleClose - A function that will do the actual closing
* of `closeableEl` * of `closeableEl`
*/ */
function useElementShouldClose(closeableEl, isOpen, handleClose) { export default function useElementShouldClose(
closeableEl,
isOpen,
handleClose
) {
useEffect(() => { useEffect(() => {
if (!isOpen) { if (!isOpen) {
return () => {}; return () => {};
...@@ -69,5 +73,3 @@ function useElementShouldClose(closeableEl, isOpen, handleClose) { ...@@ -69,5 +73,3 @@ function useElementShouldClose(closeableEl, isOpen, handleClose) {
}; };
}, [closeableEl, isOpen, handleClose]); }, [closeableEl, isOpen, handleClose]);
} }
module.exports = useElementShouldClose;
const events = require('../events'); import bridgeEvents from '../../shared/bridge-events';
const { parseAccountID } = require('../util/account-id'); import events from '../events';
const serviceConfig = require('../service-config'); import serviceConfig from '../service-config';
const bridgeEvents = require('../../shared/bridge-events'); import uiConstants from '../ui-constants';
const uiConstants = require('../ui-constants'); import { parseAccountID } from '../util/account-id';
const isSidebar = require('../util/is-sidebar'); import isSidebar from '../util/is-sidebar';
const { shouldAutoDisplayTutorial } = require('../util/session'); import { shouldAutoDisplayTutorial } from '../util/session';
/** /**
* Return the user's authentication status from their profile. * Return the user's authentication status from their profile.
...@@ -163,7 +163,7 @@ function HypothesisAppController( ...@@ -163,7 +163,7 @@ function HypothesisAppController(
}; };
} }
module.exports = { export default {
controller: HypothesisAppController, controller: HypothesisAppController,
controllerAs: 'vm', controllerAs: 'vm',
template: require('../templates/hypothesis-app.html'), template: require('../templates/hypothesis-app.html'),
......
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import propTypes from 'prop-types';
const { withServices } = require('../util/service-context'); import { withServices } from '../util/service-context';
const SvgIcon = require('./svg-icon'); import SvgIcon from './svg-icon';
/** /**
* Render a call-to-action to log in or sign up. This message is intended to be * Render a call-to-action to log in or sign up. This message is intended to be
...@@ -46,4 +46,4 @@ LoggedOutMessage.propTypes = { ...@@ -46,4 +46,4 @@ LoggedOutMessage.propTypes = {
LoggedOutMessage.injectedProps = ['serviceUrl']; LoggedOutMessage.injectedProps = ['serviceUrl'];
module.exports = withServices(LoggedOutMessage); export default withServices(LoggedOutMessage);
const classnames = require('classnames'); import classnames from 'classnames';
const { createElement } = require('preact'); import { createElement } from 'preact';
const { useEffect, useRef, useState } = require('preact/hooks'); import { useEffect, useRef, useState } from 'preact/hooks';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const MarkdownView = require('./markdown-view'); import {
const {
LinkType, LinkType,
convertSelectionToLink, convertSelectionToLink,
toggleBlockStyle, toggleBlockStyle,
toggleSpanStyle, toggleSpanStyle,
} = require('../markdown-commands'); } from '../markdown-commands';
const SvgIcon = require('./svg-icon');
import MarkdownView from './markdown-view';
import SvgIcon from './svg-icon';
// Mapping of toolbar command name to key for Ctrl+<key> keyboard shortcuts. // Mapping of toolbar command name to key for Ctrl+<key> keyboard shortcuts.
// The shortcuts are taken from Stack Overflow's editor. // The shortcuts are taken from Stack Overflow's editor.
...@@ -233,7 +234,7 @@ Toolbar.propTypes = { ...@@ -233,7 +234,7 @@ Toolbar.propTypes = {
/** /**
* Viewer/editor for the body of an annotation in markdown format. * Viewer/editor for the body of an annotation in markdown format.
*/ */
function MarkdownEditor({ onEditText = () => {}, text = '' }) { export default function MarkdownEditor({ onEditText = () => {}, text = '' }) {
/** Whether the preview mode is currently active. */ /** Whether the preview mode is currently active. */
const [preview, setPreview] = useState(false); const [preview, setPreview] = useState(false);
...@@ -305,5 +306,3 @@ MarkdownEditor.propTypes = { ...@@ -305,5 +306,3 @@ MarkdownEditor.propTypes = {
*/ */
onEditText: propTypes.func, onEditText: propTypes.func,
}; };
module.exports = MarkdownEditor;
const classnames = require('classnames'); import classnames from 'classnames';
const { createElement } = require('preact'); import { createElement } from 'preact';
const { useEffect, useMemo, useRef } = require('preact/hooks'); import { useEffect, useMemo, useRef } from 'preact/hooks';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const { replaceLinksWithEmbeds } = require('../media-embedder'); import { replaceLinksWithEmbeds } from '../media-embedder';
const renderMarkdown = require('../render-markdown'); import renderMarkdown from '../render-markdown';
/** /**
* A component which renders markdown as HTML and replaces recognized links * A component which renders markdown as HTML and replaces recognized links
* with embedded video/audio. * with embedded video/audio.
*/ */
function MarkdownView({ markdown = '', textClass = {} }) { export default function MarkdownView({ markdown = '', textClass = {} }) {
const html = useMemo(() => (markdown ? renderMarkdown(markdown) : ''), [ const html = useMemo(() => (markdown ? renderMarkdown(markdown) : ''), [
markdown, markdown,
]); ]);
...@@ -39,5 +39,3 @@ MarkdownView.propTypes = { ...@@ -39,5 +39,3 @@ MarkdownView.propTypes = {
*/ */
textClass: propTypes.object, textClass: propTypes.object,
}; };
module.exports = MarkdownView;
const classnames = require('classnames'); import classnames from 'classnames';
const { createElement } = require('preact'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const { onActivate } = require('../util/on-activate'); import { onActivate } from '../util/on-activate';
const Slider = require('./slider'); import Slider from './slider';
const SvgIcon = require('./svg-icon'); import SvgIcon from './svg-icon';
/** /**
* An item in a dropdown menu. * An item in a dropdown menu.
...@@ -22,7 +22,7 @@ const SvgIcon = require('./svg-icon'); ...@@ -22,7 +22,7 @@ const SvgIcon = require('./svg-icon');
* For items that have submenus, the `MenuItem` will call the `renderSubmenu` * For items that have submenus, the `MenuItem` will call the `renderSubmenu`
* prop to render the content of the submenu, when the submenu is visible. * prop to render the content of the submenu, when the submenu is visible.
*/ */
function MenuItem({ export default function MenuItem({
href, href,
icon, icon,
iconAlt, iconAlt,
...@@ -189,5 +189,3 @@ MenuItem.propTypes = { ...@@ -189,5 +189,3 @@ MenuItem.propTypes = {
*/ */
submenu: propTypes.any, submenu: propTypes.any,
}; };
module.exports = MenuItem;
const { Fragment, createElement, toChildArray } = require('preact'); import { Fragment, createElement, toChildArray } from 'preact';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
/** /**
* Group a set of menu items together visually, with an optional header. * Group a set of menu items together visually, with an optional header.
...@@ -16,7 +16,7 @@ const propTypes = require('prop-types'); ...@@ -16,7 +16,7 @@ const propTypes = require('prop-types');
* </MenuSection> * </MenuSection>
* </Menu> * </Menu>
*/ */
function MenuSection({ heading, children }) { export default function MenuSection({ heading, children }) {
return ( return (
<Fragment> <Fragment>
{heading && <h2 className="menu-section__heading">{heading}</h2>} {heading && <h2 className="menu-section__heading">{heading}</h2>}
...@@ -43,5 +43,3 @@ MenuSection.propTypes = { ...@@ -43,5 +43,3 @@ MenuSection.propTypes = {
propTypes.arrayOf(propTypes.object), propTypes.arrayOf(propTypes.object),
]).isRequired, ]).isRequired,
}; };
module.exports = MenuSection;
const classnames = require('classnames'); import classnames from 'classnames';
const { Fragment, createElement } = require('preact'); import { Fragment, createElement } from 'preact';
const { useCallback, useEffect, useRef, useState } = require('preact/hooks'); import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const useElementShouldClose = require('./hooks/use-element-should-close'); import useElementShouldClose from './hooks/use-element-should-close';
import SvgIcon from './svg-icon';
const SvgIcon = require('./svg-icon');
// The triangular indicator below the menu toggle button that visually links it // The triangular indicator below the menu toggle button that visually links it
// to the menu content. // to the menu content.
...@@ -40,7 +39,7 @@ let ignoreNextClick = false; ...@@ -40,7 +39,7 @@ let ignoreNextClick = false;
* </MenuSection> * </MenuSection>
* </Menu> * </Menu>
*/ */
function Menu({ export default function Menu({
align = 'left', align = 'left',
arrowClass = '', arrowClass = '',
children, children,
...@@ -223,5 +222,3 @@ Menu.propTypes = { ...@@ -223,5 +222,3 @@ Menu.propTypes = {
*/ */
menuIndicator: propTypes.bool, menuIndicator: propTypes.bool,
}; };
module.exports = Menu;
const { createElement } = require('preact'); import classnames from 'classnames';
const classnames = require('classnames'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const annotationMetadata = require('../util/annotation-metadata'); import useStore from '../store/use-store';
const useStore = require('../store/use-store'); import * as annotationMetadata from '../util/annotation-metadata';
const { withServices } = require('../util/service-context'); import { withServices } from '../util/service-context';
/** /**
* Banner allows moderators to hide/unhide the flagged * Banner allows moderators to hide/unhide the flagged
...@@ -101,4 +101,4 @@ ModerationBanner.propTypes = { ...@@ -101,4 +101,4 @@ ModerationBanner.propTypes = {
ModerationBanner.injectedProps = ['api', 'flash']; ModerationBanner.injectedProps = ['api', 'flash'];
module.exports = withServices(ModerationBanner); export default withServices(ModerationBanner);
const { createElement } = require('preact'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const events = require('../events'); import events from '../events';
const useStore = require('../store/use-store'); import useStore from '../store/use-store';
const { applyTheme } = require('../util/theme'); import { withServices } from '../util/service-context';
const { withServices } = require('../util/service-context'); import { applyTheme } from '../util/theme';
const Button = require('./button'); import Button from './button';
function NewNoteButton({ $rootScope, settings }) { function NewNoteButton({ $rootScope, settings }) {
const store = useStore(store => ({ const store = useStore(store => ({
...@@ -43,4 +43,4 @@ NewNoteButton.propTypes = { ...@@ -43,4 +43,4 @@ NewNoteButton.propTypes = {
NewNoteButton.injectedProps = ['$rootScope', 'settings']; NewNoteButton.injectedProps = ['$rootScope', 'settings'];
module.exports = withServices(NewNoteButton); export default withServices(NewNoteButton);
const classnames = require('classnames'); import classnames from 'classnames';
const { createElement } = require('preact'); import { createElement } from 'preact';
const { useRef, useState } = require('preact/hooks'); import { useRef, useState } from 'preact/hooks';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const useStore = require('../store/use-store'); import useStore from '../store/use-store';
const Button = require('./button'); import Button from './button';
const Spinner = require('./spinner'); import Spinner from './spinner';
/** /**
* An input field in the top bar for entering a query that filters annotations * An input field in the top bar for entering a query that filters annotations
...@@ -17,7 +17,7 @@ const Spinner = require('./spinner'); ...@@ -17,7 +17,7 @@ const Spinner = require('./spinner');
* is fetching for data from the API or in a "loading" state for any other * is fetching for data from the API or in a "loading" state for any other
* reason. * reason.
*/ */
function SearchInput({ alwaysExpanded, query, onSearch }) { export default function SearchInput({ alwaysExpanded, query, onSearch }) {
const isLoading = useStore(store => store.isLoading()); const isLoading = useStore(store => store.isLoading());
const input = useRef(); const input = useRef();
...@@ -89,5 +89,3 @@ SearchInput.propTypes = { ...@@ -89,5 +89,3 @@ SearchInput.propTypes = {
*/ */
onSearch: propTypes.func, onSearch: propTypes.func,
}; };
module.exports = SearchInput;
const { createElement } = require('preact'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import { useMemo } from 'preact/hooks';
const { useMemo } = require('preact/hooks'); import propTypes from 'prop-types';
const { withServices } = require('../util/service-context'); import useStore from '../store/use-store';
const uiConstants = require('../ui-constants'); import uiConstants from '../ui-constants';
const useStore = require('../store/use-store'); import { withServices } from '../util/service-context';
const Button = require('./button'); import Button from './button';
/** /**
* Of the annotations in the thread `annThread`, how many * Of the annotations in the thread `annThread`, how many
...@@ -187,4 +187,4 @@ SearchStatusBar.propTypes = { ...@@ -187,4 +187,4 @@ SearchStatusBar.propTypes = {
SearchStatusBar.injectedProps = ['rootThread']; SearchStatusBar.injectedProps = ['rootThread'];
module.exports = withServices(SearchStatusBar); export default withServices(SearchStatusBar);
const classnames = require('classnames'); import classnames from 'classnames';
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import { Fragment } from 'preact';
const { Fragment } = require('preact'); import propTypes from 'prop-types';
const NewNoteBtn = require('./new-note-btn'); import useStore from '../store/use-store';
const uiConstants = require('../ui-constants'); import uiConstants from '../ui-constants';
const useStore = require('../store/use-store'); import { withServices } from '../util/service-context';
const { withServices } = require('../util/service-context');
const SvgIcon = require('./svg-icon'); import NewNoteBtn from './new-note-btn';
import SvgIcon from './svg-icon';
/** /**
* Display name of the tab and annotation count. * Display name of the tab and annotation count.
...@@ -177,4 +177,4 @@ SelectionTabs.propTypes = { ...@@ -177,4 +177,4 @@ SelectionTabs.propTypes = {
SelectionTabs.injectedProps = ['settings']; SelectionTabs.injectedProps = ['settings'];
module.exports = withServices(SelectionTabs); export default withServices(SelectionTabs);
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import propTypes from 'prop-types';
const useStore = require('../store/use-store');
const { copyText } = require('../util/copy-to-clipboard');
const { withServices } = require('../util/service-context');
const uiConstants = require('../ui-constants');
const Button = require('./button'); import useStore from '../store/use-store';
const ShareLinks = require('./share-links'); import uiConstants from '../ui-constants';
const SidebarPanel = require('./sidebar-panel'); import { copyText } from '../util/copy-to-clipboard';
const SvgIcon = require('./svg-icon'); import { withServices } from '../util/service-context';
import Button from './button';
import ShareLinks from './share-links';
import SidebarPanel from './sidebar-panel';
import SvgIcon from './svg-icon';
/** /**
* A panel for sharing the current group's annotations. * A panel for sharing the current group's annotations.
...@@ -122,4 +123,4 @@ ShareAnnotationsPanel.propTypes = { ...@@ -122,4 +123,4 @@ ShareAnnotationsPanel.propTypes = {
ShareAnnotationsPanel.injectedProps = ['analytics', 'flash']; ShareAnnotationsPanel.injectedProps = ['analytics', 'flash'];
module.exports = withServices(ShareAnnotationsPanel); export default withServices(ShareAnnotationsPanel);
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import propTypes from 'prop-types';
const { withServices } = require('../util/service-context'); import { withServices } from '../util/service-context';
const SvgIcon = require('./svg-icon'); import SvgIcon from './svg-icon';
/** /**
* A single sharing link as a list item * A single sharing link as a list item
...@@ -91,4 +91,4 @@ ShareLinks.propTypes = { ...@@ -91,4 +91,4 @@ ShareLinks.propTypes = {
ShareLinks.injectedProps = ['analytics']; ShareLinks.injectedProps = ['analytics'];
module.exports = withServices(ShareLinks); export default withServices(ShareLinks);
const { Fragment, createElement } = require('preact'); import { Fragment, createElement } from 'preact';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
/** /**
* An error message to display in the sidebar. * An error message to display in the sidebar.
*/ */
function SidebarContentError({ export default function SidebarContentError({
loggedOutErrorMessage, loggedOutErrorMessage,
loggedInErrorMessage, loggedInErrorMessage,
onLoginRequest, onLoginRequest,
...@@ -46,5 +46,3 @@ SidebarContentError.propTypes = { ...@@ -46,5 +46,3 @@ SidebarContentError.propTypes = {
/* A boolean indicating whether the user is logged in or not. */ /* A boolean indicating whether the user is logged in or not. */
isLoggedIn: propTypes.bool, isLoggedIn: propTypes.bool,
}; };
module.exports = SidebarContentError;
const events = require('../events'); import events from '../events';
const isThirdPartyService = require('../util/is-third-party-service'); import isThirdPartyService from '../util/is-third-party-service';
const tabs = require('../util/tabs'); import * as tabs from '../util/tabs';
// @ngInject // @ngInject
function SidebarContentController( function SidebarContentController(
...@@ -191,7 +191,7 @@ function SidebarContentController( ...@@ -191,7 +191,7 @@ function SidebarContentController(
}; };
} }
module.exports = { export default {
controller: SidebarContentController, controller: SidebarContentController,
controllerAs: 'vm', controllerAs: 'vm',
bindings: { bindings: {
......
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import { useEffect, useRef } from 'preact/hooks';
const { useEffect, useRef } = require('preact/hooks'); import propTypes from 'prop-types';
const scrollIntoView = require('scroll-into-view'); import scrollIntoView from 'scroll-into-view';
const useStore = require('../store/use-store'); import useStore from '../store/use-store';
const Button = require('./button'); import Button from './button';
const Slider = require('./slider'); import Slider from './slider';
/** /**
* Base component for a sidebar panel. * Base component for a sidebar panel.
...@@ -15,7 +15,12 @@ const Slider = require('./slider'); ...@@ -15,7 +15,12 @@ const Slider = require('./slider');
* as providing a close button. Only one sidebar panel (as defined by the panel's * as providing a close button. Only one sidebar panel (as defined by the panel's
* `panelName`) is active at one time. * `panelName`) is active at one time.
*/ */
function SidebarPanel({ children, panelName, title, onActiveChanged }) { export default function SidebarPanel({
children,
panelName,
title,
onActiveChanged,
}) {
const panelIsActive = useStore(store => store.isSidebarPanelOpen(panelName)); const panelIsActive = useStore(store => store.isSidebarPanelOpen(panelName));
const togglePanelFn = useStore(store => store.toggleSidebarPanel); const togglePanelFn = useStore(store => store.toggleSidebarPanel);
...@@ -75,5 +80,3 @@ SidebarPanel.propTypes = { ...@@ -75,5 +80,3 @@ SidebarPanel.propTypes = {
/** Optional callback to invoke when this panel's active status changes */ /** Optional callback to invoke when this panel's active status changes */
onActiveChanged: propTypes.func, onActiveChanged: propTypes.func,
}; };
module.exports = SidebarPanel;
const propTypes = require('prop-types'); import { createElement } from 'preact';
const { createElement } = require('preact'); import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
const { useCallback, useEffect, useRef, useState } = require('preact/hooks'); import propTypes from 'prop-types';
/** /**
* A container which reveals its content when `visible` is `true` using * A container which reveals its content when `visible` is `true` using
...@@ -12,7 +12,7 @@ const { useCallback, useEffect, useRef, useState } = require('preact/hooks'); ...@@ -12,7 +12,7 @@ const { useCallback, useEffect, useRef, useState } = require('preact/hooks');
* *
* Currently the only reveal/expand direction supported is top-down. * Currently the only reveal/expand direction supported is top-down.
*/ */
function Slider({ children, visible }) { export default function Slider({ children, visible }) {
const containerRef = useRef(null); const containerRef = useRef(null);
const [containerHeight, setContainerHeight] = useState(visible ? 'auto' : 0); const [containerHeight, setContainerHeight] = useState(visible ? 'auto' : 0);
...@@ -97,5 +97,3 @@ Slider.propTypes = { ...@@ -97,5 +97,3 @@ Slider.propTypes = {
*/ */
visible: propTypes.bool, visible: propTypes.bool,
}; };
module.exports = Slider;
const { createElement } = require('preact'); import { createElement } from 'preact';
const useStore = require('../store/use-store'); import useStore from '../store/use-store';
const Button = require('./button'); import Button from './button';
const Menu = require('./menu'); import Menu from './menu';
const MenuItem = require('./menu-item'); import MenuItem from './menu-item';
/** /**
* A drop-down menu of sorting options for a collection of annotations. * A drop-down menu of sorting options for a collection of annotations.
*/ */
function SortMenu() { export default function SortMenu() {
const actions = useStore(store => ({ const actions = useStore(store => ({
setSortKey: store.setSortKey, setSortKey: store.setSortKey,
})); }));
...@@ -58,5 +58,3 @@ function SortMenu() { ...@@ -58,5 +58,3 @@ function SortMenu() {
} }
SortMenu.propTypes = {}; SortMenu.propTypes = {};
module.exports = SortMenu;
const { createElement } = require('preact'); import { createElement } from 'preact';
/** /**
* Loading indicator. * Loading indicator.
*/ */
function Spinner() { export default function Spinner() {
// The `spinner__container` div only exists to center the spinner within // The `spinner__container` div only exists to center the spinner within
// the `<spinner>` Angular component element. Once consumers of this component // the `<spinner>` Angular component element. Once consumers of this component
// have been converted to Preact, we should be able to remove this. // have been converted to Preact, we should be able to remove this.
...@@ -20,5 +20,3 @@ function Spinner() { ...@@ -20,5 +20,3 @@ function Spinner() {
} }
Spinner.propTypes = {}; Spinner.propTypes = {};
module.exports = Spinner;
...@@ -66,7 +66,7 @@ function StreamContentController( ...@@ -66,7 +66,7 @@ function StreamContentController(
this.loadMore = fetch; this.loadMore = fetch;
} }
module.exports = { export default {
controller: StreamContentController, controller: StreamContentController,
controllerAs: 'vm', controllerAs: 'vm',
bindings: {}, bindings: {},
......
const { createElement } = require('preact'); import { createElement } from 'preact';
const { useEffect, useState } = require('preact/hooks'); import { useEffect, useState } from 'preact/hooks';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
const { withServices } = require('../util/service-context'); import { withServices } from '../util/service-context';
const SearchInput = require('./search-input'); import SearchInput from './search-input';
/** /**
* Search input for the single annotation view and stream. * Search input for the single annotation view and stream.
...@@ -37,4 +37,4 @@ StreamSearchInput.propTypes = { ...@@ -37,4 +37,4 @@ StreamSearchInput.propTypes = {
StreamSearchInput.injectedProps = ['$location', '$rootScope']; StreamSearchInput.injectedProps = ['$location', '$rootScope'];
module.exports = withServices(StreamSearchInput); export default withServices(StreamSearchInput);
const classnames = require('classnames'); import classnames from 'classnames';
const { createElement } = require('preact'); import { createElement } from 'preact';
const { useLayoutEffect, useRef } = require('preact/hooks'); import { useLayoutEffect, useRef } from 'preact/hooks';
const propTypes = require('prop-types'); import propTypes from 'prop-types';
// The list of supported icons // The list of supported icons
const icons = { const icons = {
...@@ -56,7 +56,12 @@ const icons = { ...@@ -56,7 +56,12 @@ const icons = {
* This matches the way we do icons on the website, see * This matches the way we do icons on the website, see
* https://github.com/hypothesis/h/pull/3675 * https://github.com/hypothesis/h/pull/3675
*/ */
function SvgIcon({ name, className = '', inline = false, title = '' }) { export default function SvgIcon({
name,
className = '',
inline = false,
title = '',
}) {
if (!icons[name]) { if (!icons[name]) {
throw new Error(`Unknown icon ${name}`); throw new Error(`Unknown icon ${name}`);
} }
...@@ -101,5 +106,3 @@ SvgIcon.propTypes = { ...@@ -101,5 +106,3 @@ SvgIcon.propTypes = {
/** Optional title attribute to apply to the SVG's containing `span` */ /** Optional title attribute to apply to the SVG's containing `span` */
title: propTypes.string, title: propTypes.string,
}; };
module.exports = SvgIcon;
const { createElement } = require('preact'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import { useMemo, useRef, useState } from 'preact/hooks';
const { useMemo, useRef, useState } = require('preact/hooks'); import propTypes from 'prop-types';
const { withServices } = require('../util/service-context'); import { withServices } from '../util/service-context';
const SvgIcon = require('./svg-icon');
import SvgIcon from './svg-icon';
// Global counter used to create a unique id for each instance of a TagEditor // Global counter used to create a unique id for each instance of a TagEditor
let datalistIdCounter = 0; let datalistIdCounter = 0;
...@@ -244,4 +245,4 @@ TagEditor.propTypes = { ...@@ -244,4 +245,4 @@ TagEditor.propTypes = {
TagEditor.injectedProps = ['serviceUrl', 'tags']; TagEditor.injectedProps = ['serviceUrl', 'tags'];
module.exports = withServices(TagEditor); export default withServices(TagEditor);
const { createElement } = require('preact'); import { createElement } from 'preact';
const propTypes = require('prop-types'); import { useMemo } from 'preact/hooks';
const { useMemo } = require('preact/hooks'); import propTypes from 'prop-types';
const { isThirdPartyUser } = require('../util/account-id'); import { isThirdPartyUser } from '../util/account-id';
const { withServices } = require('../util/service-context'); import { withServices } from '../util/service-context';
/** /**
* Component to render an annotation's tags. * Component to render an annotation's tags.
...@@ -70,4 +70,4 @@ TagList.propTypes = { ...@@ -70,4 +70,4 @@ TagList.propTypes = {
TagList.injectedProps = ['serviceUrl', 'settings']; TagList.injectedProps = ['serviceUrl', 'settings'];
module.exports = withServices(TagList); export default withServices(TagList);
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const { act } = require('preact/test-utils'); import { act } from 'preact/test-utils';
const { waitFor } = require('./util'); import AnnotationActionBar from '../annotation-action-bar';
import { $imports } from '../annotation-action-bar';
const AnnotationActionBar = require('../annotation-action-bar'); import mockImportedComponents from './mock-imported-components';
const { $imports } = require('../annotation-action-bar'); import { waitFor } from './util';
const mockImportedComponents = require('./mock-imported-components');
describe('AnnotationActionBar', () => { describe('AnnotationActionBar', () => {
let fakeAnnotation; let fakeAnnotation;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const AnnotationBody = require('../annotation-body'); import AnnotationBody from '../annotation-body';
const { $imports } = require('../annotation-body'); import { $imports } from '../annotation-body';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('AnnotationBody', () => { describe('AnnotationBody', () => {
function createBody(props = {}) { function createBody(props = {}) {
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const fixtures = require('../../test/annotation-fixtures'); import * as fixtures from '../../test/annotation-fixtures';
import AnnotationDocumentInfo from '../annotation-document-info';
import { $imports } from '../annotation-document-info';
const AnnotationDocumentInfo = require('../annotation-document-info'); import mockImportedComponents from './mock-imported-components';
const { $imports } = require('../annotation-document-info');
const mockImportedComponents = require('./mock-imported-components');
describe('AnnotationDocumentInfo', () => { describe('AnnotationDocumentInfo', () => {
let fakeDomainAndTitle; let fakeDomainAndTitle;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const fixtures = require('../../test/annotation-fixtures'); import * as fixtures from '../../test/annotation-fixtures';
import AnnotationHeader from '../annotation-header';
import { $imports } from '../annotation-header';
const AnnotationHeader = require('../annotation-header'); import mockImportedComponents from './mock-imported-components';
const { $imports } = require('../annotation-header');
const mockImportedComponents = require('./mock-imported-components');
describe('AnnotationHeader', () => { describe('AnnotationHeader', () => {
let fakeIsHighlight; let fakeIsHighlight;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const mockImportedComponents = require('./mock-imported-components'); import * as fixtures from '../../test/annotation-fixtures';
const fixtures = require('../../test/annotation-fixtures');
import mockImportedComponents from './mock-imported-components';
// @TODO Note this import as `Annotation` for easier updating later // @TODO Note this import as `Annotation` for easier updating later
const Annotation = require('../annotation-omega');
const { $imports } = require('../annotation-omega'); import Annotation from '../annotation-omega';
import { $imports } from '../annotation-omega';
describe('AnnotationOmega', () => { describe('AnnotationOmega', () => {
let fakeOnReplyCountClick; let fakeOnReplyCountClick;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const AnnotationPublishControl = require('../annotation-publish-control'); import AnnotationPublishControl from '../annotation-publish-control';
const { $imports } = require('../annotation-publish-control'); import { $imports } from '../annotation-publish-control';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('AnnotationPublishControl', () => { describe('AnnotationPublishControl', () => {
let fakeGroup; let fakeGroup;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const AnnotationQuote = require('../annotation-quote'); import AnnotationQuote from '../annotation-quote';
const { $imports } = require('../annotation-quote'); import { $imports } from '../annotation-quote';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('AnnotationQuote', () => { describe('AnnotationQuote', () => {
let fakeAnnotation; let fakeAnnotation;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const { act } = require('preact/test-utils'); import { act } from 'preact/test-utils';
const AnnotationShareControl = require('../annotation-share-control'); import AnnotationShareControl from '../annotation-share-control';
const { $imports } = require('../annotation-share-control'); import { $imports } from '../annotation-share-control';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('AnnotationShareControl', () => { describe('AnnotationShareControl', () => {
let fakeAnnotation; let fakeAnnotation;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const fixtures = require('../../test/annotation-fixtures'); import * as fixtures from '../../test/annotation-fixtures';
import AnnotationShareInfo from '../annotation-share-info';
import { $imports } from '../annotation-share-info';
const AnnotationShareInfo = require('../annotation-share-info'); import mockImportedComponents from './mock-imported-components';
const { $imports } = require('../annotation-share-info');
const mockImportedComponents = require('./mock-imported-components');
describe('AnnotationShareInfo', () => { describe('AnnotationShareInfo', () => {
let fakeGroup; let fakeGroup;
......
const angular = require('angular'); import angular from 'angular';
const events = require('../../events'); import * as util from '../../directive/test/util';
const fixtures = require('../../test/annotation-fixtures'); import events from '../../events';
const util = require('../../directive/test/util'); import * as fixtures from '../../test/annotation-fixtures';
import annotationComponent from '../annotation';
const annotationComponent = require('../annotation'); import { $imports, updateModel } from '../annotation';
const { $imports, updateModel } = require('../annotation');
const inject = angular.mock.inject; const inject = angular.mock.inject;
......
const angular = require('angular'); import angular from 'angular';
const annotationThread = require('../annotation-thread'); import * as util from '../../directive/test/util';
const moderationBanner = require('../moderation-banner'); import * as fixtures from '../../test/annotation-fixtures';
const fixtures = require('../../test/annotation-fixtures'); import annotationThread from '../annotation-thread';
const util = require('../../directive/test/util'); import moderationBanner from '../moderation-banner';
function PageObject(element) { function PageObject(element) {
this.annotations = function() { this.annotations = function() {
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const AnnotationUser = require('../annotation-user'); import AnnotationUser from '../annotation-user';
const { $imports } = require('../annotation-user'); import { $imports } from '../annotation-user';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('AnnotationUser', () => { describe('AnnotationUser', () => {
let fakeAnnotation; let fakeAnnotation;
......
const angular = require('angular'); import angular from 'angular';
const annotationViewerContent = require('../annotation-viewer-content'); import annotationViewerContent from '../annotation-viewer-content';
// Fake implementation of the API for fetching annotations and replies to // Fake implementation of the API for fetching annotations and replies to
// annotations. // annotations.
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const Button = require('../button'); import Button from '../button';
const { $imports } = require('../button'); import { $imports } from '../button';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('Button', () => { describe('Button', () => {
let fakeOnClick; let fakeOnClick;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { act } = require('preact/test-utils'); import { createElement } from 'preact';
const { mount } = require('enzyme'); import { act } from 'preact/test-utils';
const Excerpt = require('../excerpt'); import Excerpt from '../excerpt';
const { $imports } = require('../excerpt'); import { $imports } from '../excerpt';
describe('Excerpt', () => { describe('Excerpt', () => {
const SHORT_DIV = <div id="foo" style="height: 5px;" />; const SHORT_DIV = <div id="foo" style="height: 5px;" />;
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const FocusedModeHeader = require('../focused-mode-header'); import FocusedModeHeader from '../focused-mode-header';
const { $imports } = require('../focused-mode-header'); import { $imports } from '../focused-mode-header';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('FocusedModeHeader', function() { describe('FocusedModeHeader', function() {
let fakeStore; let fakeStore;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { act } = require('preact/test-utils'); import { createElement } from 'preact';
import { act } from 'preact/test-utils';
const { mount } = require('enzyme'); import { events } from '../../services/analytics';
const GroupListItem = require('../group-list-item'); import GroupListItem from '../group-list-item';
const { $imports } = require('../group-list-item'); import { $imports } from '../group-list-item';
const { events } = require('../../services/analytics');
describe('GroupListItem', () => { describe('GroupListItem', () => {
let fakeAnalytics; let fakeAnalytics;
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const GroupListSection = require('../group-list-section'); import GroupListSection from '../group-list-section';
const { $imports } = require('../group-list-section'); import { $imports } from '../group-list-section';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('GroupListSection', () => { describe('GroupListSection', () => {
const testGroups = [ const testGroups = [
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const { act } = require('preact/test-utils'); import { act } from 'preact/test-utils';
const GroupList = require('../group-list'); import GroupList from '../group-list';
const { $imports } = require('../group-list'); import { $imports } from '../group-list';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('GroupList', () => { describe('GroupList', () => {
let fakeServiceConfig; let fakeServiceConfig;
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const { act } = require('preact/test-utils'); import { act } from 'preact/test-utils';
const HelpPanel = require('../help-panel'); import HelpPanel from '../help-panel';
const { $imports } = require('../help-panel'); import { $imports } from '../help-panel';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('HelpPanel', function() { describe('HelpPanel', function() {
let fakeAuth; let fakeAuth;
......
const angular = require('angular'); import angular from 'angular';
const events = require('../../events'); import bridgeEvents from '../../../shared/bridge-events';
const { events: analyticsEvents } = require('../../services/analytics'); import events from '../../events';
const bridgeEvents = require('../../../shared/bridge-events'); import { events as analyticsEvents } from '../../services/analytics';
import hypothesisApp from '../hypothesis-app';
const hypothesisApp = require('../hypothesis-app'); import { $imports } from '../hypothesis-app';
const { $imports } = require('../hypothesis-app');
describe('sidebar.components.hypothesis-app', function() { describe('sidebar.components.hypothesis-app', function() {
let $componentController = null; let $componentController = null;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const LoggedOutMessage = require('../logged-out-message'); import LoggedOutMessage from '../logged-out-message';
const { $imports } = require('../logged-out-message'); import { $imports } from '../logged-out-message';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('LoggedOutMessage', () => { describe('LoggedOutMessage', () => {
const createLoggedOutMessage = props => { const createLoggedOutMessage = props => {
......
const { createElement, render } = require('preact'); import { mount } from 'enzyme';
const { act } = require('preact/test-utils'); import { createElement, render } from 'preact';
const { mount } = require('enzyme'); import { act } from 'preact/test-utils';
const { LinkType } = require('../../markdown-commands'); import { LinkType } from '../../markdown-commands';
const MarkdownEditor = require('../markdown-editor'); import MarkdownEditor from '../markdown-editor';
const { $imports } = require('../markdown-editor'); import { $imports } from '../markdown-editor';
describe('MarkdownEditor', () => { describe('MarkdownEditor', () => {
const formatResult = { const formatResult = {
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const MarkdownView = require('../markdown-view'); import MarkdownView from '../markdown-view';
const { $imports } = require('../markdown-view'); import { $imports } from '../markdown-view';
describe('MarkdownView', () => { describe('MarkdownView', () => {
let fakeMediaEmbedder; let fakeMediaEmbedder;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const MenuItem = require('../menu-item'); import MenuItem from '../menu-item';
const { $imports } = require('../menu-item'); import { $imports } from '../menu-item';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('MenuItem', () => { describe('MenuItem', () => {
const createMenuItem = props => const createMenuItem = props =>
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const MenuSection = require('../menu-section'); import MenuSection from '../menu-section';
const { $imports } = require('../menu-section'); import { $imports } from '../menu-section';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('MenuSection', () => { describe('MenuSection', () => {
const createMenuSection = props => const createMenuSection = props =>
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { act } = require('preact/test-utils'); import { createElement } from 'preact';
const { mount } = require('enzyme'); import { act } from 'preact/test-utils';
const Menu = require('../menu'); import Menu from '../menu';
const { $imports } = require('../menu'); import { $imports } from '../menu';
describe('Menu', () => { describe('Menu', () => {
let container; let container;
......
...@@ -52,7 +52,7 @@ function getDisplayName(component) { ...@@ -52,7 +52,7 @@ function getDisplayName(component) {
* *
* @return {Function} - A function that can be passed to `$imports.$mock`. * @return {Function} - A function that can be passed to `$imports.$mock`.
*/ */
function mockImportedComponents() { export default function mockImportedComponents() {
return (source, symbol, value) => { return (source, symbol, value) => {
if (!isComponent(value)) { if (!isComponent(value)) {
return null; return null;
...@@ -64,5 +64,3 @@ function mockImportedComponents() { ...@@ -64,5 +64,3 @@ function mockImportedComponents() {
return mock; return mock;
}; };
} }
module.exports = mockImportedComponents;
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const ModerationBanner = require('../moderation-banner'); import * as fixtures from '../../test/annotation-fixtures';
const { $imports } = require('../moderation-banner'); import ModerationBanner from '../moderation-banner';
const fixtures = require('../../test/annotation-fixtures'); import { $imports } from '../moderation-banner';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
const moderatedAnnotation = fixtures.moderatedAnnotation; const moderatedAnnotation = fixtures.moderatedAnnotation;
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const { act } = require('preact/test-utils'); import { act } from 'preact/test-utils';
const events = require('../../events'); import events from '../../events';
const NewNoteButton = require('../new-note-btn'); import NewNoteButton from '../new-note-btn';
const { $imports } = require('../new-note-btn'); import { $imports } from '../new-note-btn';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('NewNoteButton', function() { describe('NewNoteButton', function() {
let fakeStore; let fakeStore;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const SearchInput = require('../search-input'); import SearchInput from '../search-input';
const { $imports } = require('../search-input'); import { $imports } from '../search-input';
describe('SearchInput', () => { describe('SearchInput', () => {
let fakeStore; let fakeStore;
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const SearchStatusBar = require('../search-status-bar'); import SearchStatusBar from '../search-status-bar';
const { $imports } = require('../search-status-bar'); import { $imports } from '../search-status-bar';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('SearchStatusBar', () => { describe('SearchStatusBar', () => {
let fakeRootThread; let fakeRootThread;
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const uiConstants = require('../../ui-constants'); import uiConstants from '../../ui-constants';
const SelectionTabs = require('../selection-tabs'); import SelectionTabs from '../selection-tabs';
const { $imports } = require('../selection-tabs'); import { $imports } from '../selection-tabs';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('SelectionTabs', function() { describe('SelectionTabs', function() {
// mock services // mock services
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const ShareAnnotationsPanel = require('../share-annotations-panel'); import ShareAnnotationsPanel from '../share-annotations-panel';
const { $imports } = require('../share-annotations-panel'); import { $imports } from '../share-annotations-panel';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('ShareAnnotationsPanel', () => { describe('ShareAnnotationsPanel', () => {
let fakeStore; let fakeStore;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const ShareLinks = require('../share-links'); import ShareLinks from '../share-links';
const { $imports } = require('../share-links'); import { $imports } from '../share-links';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('ShareLinks', () => { describe('ShareLinks', () => {
let fakeAnalytics; let fakeAnalytics;
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const SidebarContentError = require('../sidebar-content-error'); import SidebarContentError from '../sidebar-content-error';
const { $imports } = require('../sidebar-content-error'); import { $imports } from '../sidebar-content-error';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('SidebarContentError', () => { describe('SidebarContentError', () => {
const createSidebarContentError = ( const createSidebarContentError = (
......
const angular = require('angular'); import angular from 'angular';
const EventEmitter = require('tiny-emitter'); import EventEmitter from 'tiny-emitter';
const events = require('../../events'); import events from '../../events';
const sidebarContent = require('../sidebar-content'); import storeFactory from '../../store';
const storeFactory = require('../../store'); import sidebarContent from '../sidebar-content';
class FakeRootThread extends EventEmitter { class FakeRootThread extends EventEmitter {
constructor() { constructor() {
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const SidebarPanel = require('../sidebar-panel'); import SidebarPanel from '../sidebar-panel';
const { $imports } = require('../sidebar-panel'); import { $imports } from '../sidebar-panel';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('SidebarPanel', () => { describe('SidebarPanel', () => {
let fakeStore; let fakeStore;
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const Slider = require('../slider'); import Slider from '../slider';
describe('Slider', () => { describe('Slider', () => {
let container; let container;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const SortMenu = require('../sort-menu'); import SortMenu from '../sort-menu';
const { $imports } = require('../sort-menu'); import { $imports } from '../sort-menu';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('SortMenu', () => { describe('SortMenu', () => {
let fakeState; let fakeState;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const Spinner = require('../spinner'); import Spinner from '../spinner';
describe('Spinner', function() { describe('Spinner', function() {
const createSpinner = (props = {}) => mount(<Spinner {...props} />); const createSpinner = (props = {}) => mount(<Spinner {...props} />);
......
const angular = require('angular'); import angular from 'angular';
const EventEmitter = require('tiny-emitter'); import EventEmitter from 'tiny-emitter';
const streamContent = require('../stream-content'); import streamContent from '../stream-content';
class FakeRootThread extends EventEmitter { class FakeRootThread extends EventEmitter {
constructor() { constructor() {
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const { act } = require('preact/test-utils'); import { act } from 'preact/test-utils';
const StreamSearchInput = require('../stream-search-input'); import StreamSearchInput from '../stream-search-input';
const { $imports } = require('../stream-search-input'); import { $imports } from '../stream-search-input';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('StreamSearchInput', () => { describe('StreamSearchInput', () => {
let fakeLocation; let fakeLocation;
......
const { createElement, render } = require('preact'); import { createElement, render } from 'preact';
const SvgIcon = require('../svg-icon'); import SvgIcon from '../svg-icon';
describe('SvgIcon', () => { describe('SvgIcon', () => {
// Tests here use DOM APIs rather than Enzyme because SvgIcon uses // Tests here use DOM APIs rather than Enzyme because SvgIcon uses
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const mockImportedComponents = require('./mock-imported-components'); import TagEditor from '../tag-editor';
const TagEditor = require('../tag-editor'); import { $imports } from '../tag-editor';
const { $imports } = require('../tag-editor');
import mockImportedComponents from './mock-imported-components';
describe('TagEditor', function() { describe('TagEditor', function() {
let fakeTags = ['tag1', 'tag2']; let fakeTags = ['tag1', 'tag2'];
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const mockImportedComponents = require('./mock-imported-components'); import TagList from '../tag-list';
const TagList = require('../tag-list'); import { $imports } from '../tag-list';
const { $imports } = require('../tag-list');
import mockImportedComponents from './mock-imported-components';
describe('TagList', function() { describe('TagList', function() {
let fakeServiceUrl; let fakeServiceUrl;
......
const angular = require('angular'); import angular from 'angular';
import immutable from 'seamless-immutable';
import EventEmitter from 'tiny-emitter';
const EventEmitter = require('tiny-emitter'); import * as util from '../../directive/test/util';
const immutable = require('seamless-immutable'); import events from '../../events';
import threadList from '../thread-list';
const events = require('../../events');
const threadList = require('../thread-list');
const util = require('../../directive/test/util');
const annotFixtures = immutable({ const annotFixtures = immutable({
annotation: { $tag: 't1', id: '1', text: 'text' }, annotation: { $tag: 't1', id: '1', text: 'text' },
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { act } = require('preact/test-utils'); import { createElement } from 'preact';
const { mount } = require('enzyme'); import { act } from 'preact/test-utils';
const Timestamp = require('../timestamp'); import Timestamp from '../timestamp';
const { $imports } = require('../timestamp'); import { $imports } from '../timestamp';
describe('Timestamp', () => { describe('Timestamp', () => {
let clock; let clock;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const uiConstants = require('../../ui-constants'); import bridgeEvents from '../../../shared/bridge-events';
const bridgeEvents = require('../../../shared/bridge-events'); import uiConstants from '../../ui-constants';
import TopBar from '../top-bar';
import { $imports } from '../top-bar';
const TopBar = require('../top-bar'); import mockImportedComponents from './mock-imported-components';
const { $imports } = require('../top-bar');
const mockImportedComponents = require('./mock-imported-components');
describe('TopBar', () => { describe('TopBar', () => {
const fakeSettings = {}; const fakeSettings = {};
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const Tutorial = require('../tutorial'); import Tutorial from '../tutorial';
const { $imports } = require('../tutorial'); import { $imports } from '../tutorial';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('Tutorial', function() { describe('Tutorial', function() {
let fakeIsThirdPartyService; let fakeIsThirdPartyService;
......
const { createElement } = require('preact'); import { mount } from 'enzyme';
const { mount } = require('enzyme'); import { createElement } from 'preact';
const UserMenu = require('../user-menu'); import UserMenu from '../user-menu';
const { $imports } = require('../user-menu'); import { $imports } from '../user-menu';
const mockImportedComponents = require('./mock-imported-components');
import mockImportedComponents from './mock-imported-components';
describe('UserMenu', () => { describe('UserMenu', () => {
let fakeAuth; let fakeAuth;
......
const { mount } = require('enzyme'); import { mount } from 'enzyme';
const { createElement } = require('preact'); import { createElement } from 'preact';
const VersionInfo = require('../version-info'); import VersionInfo from '../version-info';
const { $imports } = require('../version-info'); import { $imports } from '../version-info';
describe('VersionInfo', function() { describe('VersionInfo', function() {
let fakeVersionData; let fakeVersionData;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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