Skip to content

Commit

Permalink
Merge branch 'develop' into component/search_configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
SammyIsConfused committed Apr 20, 2020
2 parents ab94be8 + 2610c41 commit d3b2436
Show file tree
Hide file tree
Showing 27 changed files with 9,150 additions and 1,587 deletions.
11 changes: 11 additions & 0 deletions Source/Plugins/Core/com.equella.core/js/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
stories: ["../__stories__/**/*.stories.tsx"],
addons: [
"@storybook/preset-typescript",
"@storybook/addon-a11y",
"@storybook/addon-actions",
"@storybook/addon-docs",
"@storybook/addon-knobs",
"@storybook/addon-links"
]
};
6 changes: 6 additions & 0 deletions Source/Plugins/Core/com.equella.core/js/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { addDecorator } from "@storybook/react";
import { withA11y } from "@storybook/addon-a11y";
import StoryRouter from "storybook-react-router";

addDecorator(withA11y);
addDecorator(StoryRouter());
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from "react";
import { action } from "@storybook/addon-actions";
import AppBarQuery from "../../tsrc/components/AppBarQuery";

export default {
title: "AppBarQuery",
component: AppBarQuery
};

export const QueryText = () => (
<AppBarQuery query="" onChange={action("change")} />
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as React from "react";
import { action } from "@storybook/addon-actions";
import { boolean, text } from "@storybook/addon-knobs";
import ConfirmDialog from "../../tsrc/components/ConfirmDialog";

export default {
title: "ConfirmDialog",
component: ConfirmDialog
};

export const ShowDialog = () => (
<ConfirmDialog
open={boolean("open", true)}
title={text(
"title",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit"
)}
onCancel={action("cancel")}
onConfirm={action("confirm")}
/>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from "react";
import Error from "../../tsrc/components/Error";

export default {
title: "Error",
component: Error
};

export const WithWarningMessage = () => (
<Error>
<h1>Warning</h1>
<p>Something has gone wrong.</p>
</Error>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from "react";
import Loader from "../../tsrc/components/Loader";

export default {
title: "Loader",
component: Loader
};

export const Loading = () => <Loader />;
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import * as React from "react";
import { action } from "@storybook/addon-actions";
import { boolean, select, text } from "@storybook/addon-knobs";
import MessageInfo from "../../tsrc/components/MessageInfo";

export default {
title: "MessageInfo",
component: MessageInfo
};

export const DynamicVariant = () => (
<MessageInfo
open={boolean("open", true)}
onClose={action("close")}
title={text(
"title",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit"
)}
variant={select(
"variant",
{ success: "success", error: "error", info: "info", warning: "warning" },
"success"
)}
/>
);

export const VariantSuccess = () => (
<MessageInfo
open={boolean("open", true)}
onClose={action("close")}
title={text(
"title",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit"
)}
variant="success"
/>
);

export const VariantError = () => (
<MessageInfo
open={boolean("open", true)}
onClose={action("close")}
title={text(
"title",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit"
)}
variant="error"
/>
);

export const VariantInfo = () => (
<MessageInfo
open={boolean("open", true)}
onClose={action("close")}
title={text(
"title",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit"
)}
variant="info"
/>
);

export const VariantWarning = () => (
<MessageInfo
open={boolean("open", true)}
onClose={action("close")}
title={text(
"title",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit"
)}
variant="warning"
/>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as React from "react";
import { action } from "@storybook/addon-actions";
import { text } from "@storybook/addon-knobs";
import RichTextEditor from "../../tsrc/components/RichTextEditor";

/**
* FIXME: to get the tinyMCE skin styles with the current setup
* the entire node modules folder needed to be included as a static source
* in the future only the skin styles should be served as a static folder
*
* When an alternative is ready update the `storybook` and `build-storybook` scripts
* in package.json with the new `-s` option
*/
export default {
title: "RichTextEditor",
component: RichTextEditor
};

export const WithHTMLInput = () => (
<RichTextEditor
htmlInput={text("htmlInput", "<p>example</p>")}
onStateChange={action("stateChange")}
/>
);

export const WithoutHTMLInput = () => (
<RichTextEditor onStateChange={action("stateChange")} />
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as React from "react";
import { action } from "@storybook/addon-actions";
import { text } from "@storybook/addon-knobs";
import SearchResult from "../../tsrc/components/SearchResult";

export default {
title: "SearchResult",
component: SearchResult
};

export const PrimaryTextOnly = () => (
<SearchResult
onClick={action("click")}
onDelete={action("delete")}
to={text("to", "#example")}
primaryText={text(
"primaryText",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit"
)}
/>
);

export const PrimaryAndSecondaryText = () => (
<SearchResult
onClick={action("click")}
onDelete={action("delete")}
to={text("to", "#example")}
primaryText={text(
"primaryText",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit"
)}
secondaryText={text(
"secondaryText",
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"
)}
/>
);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import { createMount } from "@material-ui/core/test-utils";
import ErrorPage from "../../mainui/ErrorPage";
import ErrorPage from "../../../tsrc/mainui/ErrorPage";

jest.mock("@material-ui/core/styles", () => ({
makeStyles: () => () => ({ errorPage: "mock-classname" })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { actionCreator, wrapAsyncWorker } from "../../util/actionutil";
import { actionCreator, wrapAsyncWorker } from "../../../tsrc/util/actionutil";

describe("actionutil", () => {
describe("actionCreator", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { commonString } from "../../util/commonstrings";
import { commonString } from "../../../tsrc/util/commonstrings";

describe("commonstrings", () => {
describe("commonString", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { properties } from "../../util/dictionary";
import { properties } from "../../../tsrc/util/dictionary";

describe("dictionary", () => {
describe("properties", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { encodeQuery } from "../../util/encodequery";
import { encodeQuery } from "../../../tsrc/util/encodequery";

describe("encodequery", () => {
describe("encodeQuery", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
Sizes,
prepLangStrings,
initStrings
} from "../../util/langstrings";
} from "../../../tsrc/util/langstrings";

describe("langstrings", () => {
describe("formatSize", () => {
Expand Down Expand Up @@ -54,7 +54,9 @@ describe("langstrings", () => {
});

describe("initStrings", () => {
expect(() => initStrings()).not.toThrowError();
it("should not throw an exception", () => {
expect(() => initStrings()).not.toThrow();
});
});
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isInteger } from "../../util/validation";
import { isInteger } from "../../../tsrc/util/validation";

describe("validation", () => {
describe("isInteger", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ describe("versioncheck", () => {
const checkResult = createCheckResult("2020.1.0", mockData.mockReleases);
expect(checkResult.newer).toBe(false);

expect(checkResult.newerReleases.majorUpdate).toBe(null);
expect(checkResult.newerReleases.minorUpdate).toBe(null);
expect(checkResult.newerReleases.patchUpdate).toBe(null);
expect(checkResult.newerReleases.majorUpdate).toBeNull();
expect(checkResult.newerReleases.minorUpdate).toBeNull();
expect(checkResult.newerReleases.patchUpdate).toBeNull();
});
});
});
Loading

0 comments on commit d3b2436

Please sign in to comment.