From b3b0fdc2792cfc0a7ed9e717aeb9669d6bee9ec3 Mon Sep 17 00:00:00 2001 From: MapleLeaf <19603573+itsMapleLeaf@users.noreply.github.com> Date: Wed, 22 Dec 2021 12:57:15 -0600 Subject: [PATCH] button onClick --- integration/rendering.test.tsx | 55 ++++++++++++++++++++++++----- src/components/button.tsx | 15 ++++++-- src/node-tree.ts | 26 ++++++++++++-- src/renderer.ts | 63 +++++++++++++++++++++++++++------- 4 files changed, 133 insertions(+), 26 deletions(-) diff --git a/integration/rendering.test.tsx b/integration/rendering.test.tsx index 652227e..b5442bf 100644 --- a/integration/rendering.test.tsx +++ b/integration/rendering.test.tsx @@ -1,9 +1,11 @@ /* eslint-disable unicorn/no-null */ -import type { Message, MessageOptions } from "discord.js" +import type { ButtonInteraction, Message, MessageOptions } from "discord.js" import { Client, TextChannel } from "discord.js" +import { nanoid } from "nanoid" import React from "react" import { omit } from "../src/helpers/omit.js" import { raise } from "../src/helpers/raise.js" +import { waitForWithTimeout } from "../src/helpers/wait-for-with-timeout.js" import type { ReacordRoot } from "../src/main.js" import { ActionRow, @@ -112,17 +114,27 @@ test("kitchen sink", async () => { field content but inline - - - - - - + + + + + - + - + , ) @@ -231,6 +243,31 @@ test("kitchen sink", async () => { ]) }) +test("button onClick", async () => { + let clicked = false + + await root.render(