[CORL-416] Disable Live Updates (#2391)

* feat: initial implementation

* fix: docs
This commit is contained in:
Wyatt Johnson
2019-07-05 23:10:19 +00:00
committed by GitHub
parent da1fa9c9fc
commit e7745a85aa
41 changed files with 626 additions and 28 deletions
@@ -144,6 +144,75 @@ exports[`renders configure advanced 1`] = `
</div>
</div>
</div>
<div
className="Box-root HorizontalGutter-root FormField-root HorizontalGutter-half"
>
<div
className="Box-root HorizontalGutter-root HorizontalGutter-full"
>
<label
className="Box-root Typography-root Typography-heading1 Typography-colorTextPrimary Header-root"
htmlFor="configure-advanced-liveUpdates"
>
Comment Stream Live Updates
</label>
<p
className="Box-root Typography-root Typography-detail Typography-colorTextPrimary"
>
When enabled, there will be real-time loading and updating of comments as new comments and replies are published
</p>
<div>
<div
className="Box-root Flex-root RadioButton-root Flex-flex Flex-alignCenter"
>
<input
checked={true}
className="RadioButton-input"
disabled={false}
id="live.enabled-true"
name="live.enabled"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value={true}
/>
<label
className="RadioButton-label"
htmlFor="live.enabled-true"
>
<span>
On
</span>
</label>
</div>
<div
className="Box-root Flex-root RadioButton-root Flex-flex Flex-alignCenter"
>
<input
checked={false}
className="RadioButton-input"
disabled={false}
id="live.enabled-false"
name="live.enabled"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value={false}
/>
<label
className="RadioButton-label"
htmlFor="live.enabled-false"
>
<span>
Off
</span>
</label>
</div>
</div>
</div>
</div>
<div
className="Box-root HorizontalGutter-root FormField-root HorizontalGutter-half"
>
@@ -141,6 +141,32 @@ it("remove custom css", async () => {
});
});
it("renders with live configuration when configurable", async () => {
const { advancedContainer } = await createTestRenderer();
expect(
within(advancedContainer).queryByLabelText("Comment Stream Live Updates")
).toBeDefined();
});
it("renders without live configuration when not configurable", async () => {
const resolvers = createResolversStub<GQLResolver>({
Query: {
settings: () =>
pureMerge<typeof settings>(settings, {
live: { configurable: false },
}),
},
});
const { advancedContainer } = await createTestRenderer({
resolvers,
});
expect(
within(advancedContainer).queryByLabelText("Comment Stream Live Updates")
).toEqual(null);
});
it("change permitted domains to be empty", async () => {
const resolvers = createResolversStub<GQLResolver>({
Mutation: {
+4
View File
@@ -23,6 +23,10 @@ export const settings = createFixture<GQLSettings>({
id: "settings",
moderation: GQLMODERATION_MODE.POST,
premodLinksEnable: false,
live: {
enabled: true,
configurable: true,
},
wordList: {
suspect: ["idiot", "stupid"],
banned: ["fuck"],