Skip to content

Commit 4d26050

Browse files
committed
Adds Storybook test cases for scene-ui.js
Why: They didn't exist yet, and production code was changed to use the Web Share API.
1 parent 230bb84 commit 4d26050

File tree

4 files changed

+91
-11
lines changed

4 files changed

+91
-11
lines changed

src/react-components/room/ChatSidebar.stories.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const Base = args => (
5151
timestamp={nextTimestamp()}
5252
messages={[
5353
{ id: "1", key: "1", type: "chat", body: "Hello!" },
54-
{ id: "2", key: "2", type: "chat", body: "This is a really long message that should cause a new line." },
54+
{ id: "2", key: "2", type: "chat", body: "This is a really long message that should cause a new line, so it needs to contain a lot of verbiage." },
5555
{ id: "3", key: "3", type: "image", body: { src: imgSrc } }
5656
]}
5757
/>
@@ -61,7 +61,7 @@ export const Base = args => (
6161
timestamp={nextTimestamp()}
6262
messages={[
6363
{ id: "4", key: "4", type: "chat", body: "Hello!" },
64-
{ id: "5", key: "5", type: "chat", body: "This is a really long message that should cause a new line." },
64+
{ id: "5", key: "5", type: "chat", body: "This is a really long message that should cause a new line, so it needs to contain a lot of verbiage." },
6565
{ id: "6", key: "6", type: "video", body: { src: videoSrc } },
6666
{ id: "7", key: "7", type: "chat", body: "Another message" },
6767
{ id: "8", key: "8", type: "chat", body: "One last message" }
@@ -89,7 +89,13 @@ export const Base = args => (
8989
key: "11",
9090
type: "chat",
9191
body: ":thumbsup:"
92-
}
92+
},
93+
{
94+
id: "10",
95+
key: "10",
96+
type: "chat",
97+
body: "Really long test message with url, to test line breaking. https://demo.hubsfoundation.org Woo!"
98+
},
9399
]}
94100
/>
95101
<SystemMessage type="join" presence="room" name="Liv" timestamp={nextTimestamp()} />
@@ -110,7 +116,12 @@ export const Base = args => (
110116
timestamp={nextTimestamp()}
111117
messages={[
112118
{ id: "14", key: "14", type: "chat", body: "https://hubsfoundation.org" },
113-
{ id: "15", key: "15", type: "chat", body: "Test message with url. https://hubsfoundation.org" }
119+
{
120+
id: "21",
121+
key: "21",
122+
type: "chat",
123+
body: "Another really long test message with url. https://hubsfoundation.org So where does the line break?"
124+
}
114125
]}
115126
/>
116127
<PermissionMessageGroup

src/react-components/room/Tip.stories.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,24 @@ Tips.propTypes = {
2525
step: PropTypes.string
2626
};
2727

28+
// Test cases where the actual software works fine, but the Storybook is wrong, have been commented out.
29+
// Test cases that are identical to desktop cases haven't been created.
2830
const TOOLTIP_STEPS = {
2931
"tips.desktop.welcome": "Desktop Welcome Message",
3032
"tips.desktop.locomotion": "Desktop Locomotion",
3133
"tips.desktop.turning": "Desktop Turning",
34+
"tips.desktop.defense": "Desktop Defense",
3235
"tips.desktop.invite": "Desktop Invite",
3336
"tips.desktop.end": "Desktop End",
3437
"tips.desktop.menu": "Desktop Menu",
35-
"tips.mobile.welcome": "Mobile Welcome Message",
36-
"tips.mobile.locomotion": "Mobile Locomotion",
37-
"tips.mobile.turning": "Mobile Turning",
38-
"tips.mobile.end": "Mobile End",
39-
"tips.mobile.menu": "Mobile Menu"
38+
// "tips.mobile.locomotion": "Mobile Locomotion",
39+
// "tips.mobile.turning": "Mobile Turning",
40+
// "tips.mobile.defense": "Mobile Defense",
41+
// "tips.mobile.menu": "Mobile Menu",
42+
// "tips.standalone.locomotion": "Standalone Locomotion",
43+
// "tips.standalone.turning": "Standalone Turning",
44+
"tips.standalone.defense": "Standalone Defense",
45+
"tips.standalone.invite": "Standalone Invite"
4046
};
4147

4248
export const Tooltips = ({ step }) => <RoomLayout viewport={<Tooltip step={step} />} />;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import React from "react";
2+
import SceneUI from "./scene-ui";
3+
4+
export default {
5+
title: "scene-ui",
6+
parameters: {
7+
layout: "fullscreen"
8+
}
9+
};
10+
11+
export const Base = () => (
12+
<SceneUI sceneName="Very Cool Scene" sceneDescription="A must see!" sceneScreenshotURL="https://example.com/" />
13+
);
14+
15+
export const ShowCreateRoom = () => (
16+
<SceneUI
17+
sceneName="Very Cool Scene"
18+
sceneDescription="A must see!"
19+
sceneScreenshotURL="https://example.com/"
20+
showCreateRoom={true}
21+
/>
22+
);
23+
24+
export const SceneAllowRemixing = () => (
25+
<SceneUI
26+
sceneName="Very Cool Scene"
27+
sceneDescription="A must see!"
28+
sceneScreenshotURL="https://example.com/"
29+
sceneAllowRemixing={true}
30+
/>
31+
);
32+
33+
export const SceneAttributions = () => (
34+
<SceneUI
35+
sceneName="Very Cool Scene"
36+
sceneDescription="A must see!"
37+
sceneScreenshotURL="https://example.com/"
38+
sceneAttributions={{
39+
creator: "Some Artist",
40+
content: [{ title: "Some Title", name: "Parent", author: "Joe Cool", remix: true }]
41+
}}
42+
/>
43+
);
44+
45+
export const OwnerProjectId = () => (
46+
<SceneUI
47+
sceneName="Very Cool Scene"
48+
sceneDescription="A must see!"
49+
sceneScreenshotURL="https://example.com/"
50+
isOwner={true}
51+
sceneProjectId="abc123"
52+
/>
53+
);
54+
55+
export const ShowUnavailable = () => (
56+
<SceneUI
57+
sceneName="Very Cool Scene"
58+
sceneDescription="A must see!"
59+
sceneScreenshotURL="https://example.com/"
60+
unavailable={true}
61+
/>
62+
);

src/react-components/sidebar/Sidebar.stories.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React from "react";
33
import { Column } from "../layout/Column";
44
import { RoomLayout } from "../layout/RoomLayout";
55
import { Sidebar } from "./Sidebar";
6+
import { BackButton } from "../input/BackButton";
67

78
export default {
89
title: "Sidebar/Sidebar"
@@ -12,8 +13,8 @@ export const Base = () => (
1213
<RoomLayout
1314
viewport={<div style={{ height: "100vh" }} />}
1415
sidebar={
15-
<Sidebar title="Sidebar">
16-
<Column padding>Test</Column>
16+
<Sidebar title="Sidebar" beforeTitle={<BackButton onClick={() => console.log("back button pressed")} />}>
17+
<Column padding>Column</Column>
1718
</Sidebar>
1819
}
1920
/>

0 commit comments

Comments
 (0)