From 83d146279aa78450be331869f1343c29699c6a8d Mon Sep 17 00:00:00 2001 From: itsMapleLeaf <19603573+itsMapleLeaf@users.noreply.github.com> Date: Tue, 26 Jul 2022 12:48:00 -0500 Subject: [PATCH] scuffed button test --- .../reacord/scripts/discordjs-manual-test.tsx | 79 +++++++++++++++---- 1 file changed, 64 insertions(+), 15 deletions(-) diff --git a/packages/reacord/scripts/discordjs-manual-test.tsx b/packages/reacord/scripts/discordjs-manual-test.tsx index 7b1c822..064f7a6 100644 --- a/packages/reacord/scripts/discordjs-manual-test.tsx +++ b/packages/reacord/scripts/discordjs-manual-test.tsx @@ -1,11 +1,12 @@ import type { TextChannel } from "discord.js" import { ChannelType, Client, IntentsBitField } from "discord.js" import "dotenv/config" -import { kebabCase } from "lodash-es" +import { chunk, kebabCase } from "lodash-es" import prettyMilliseconds from "pretty-ms" import React, { useEffect, useState } from "react" import { raise } from "../helpers/raise" import { waitFor } from "../helpers/wait-for" +import type { ButtonProps } from "../library.new/main" import { Button, ReacordDiscordJs } from "../library.new/main" const client = new Client({ intents: IntentsBitField.Flags.Guilds }) @@ -45,23 +46,49 @@ await createTest( "buttons", "should show button text, emojis, and make automatic action rows", async (channel) => { - const fruitEmojis = ["🍎", "🍊", "🍌", "🍉", "🍇", "🍓", "🍒", "🍍"] + const propCombinations = generatePropCombinations({ + style: ["primary", "secondary", "success", "danger"], + emoji: ["🍓", undefined], + disabled: [true, false, undefined], + label: ["label prop", undefined], + children: ["children prop", undefined], + onClick: [() => {}], + }).filter((combination) => combination.label || combination.emoji) - const FruitLabel = (props: { index: number }) => <>{props.index + 1} - - reacord.send( - channel.id, - <> - {Array.from({ length: 7 }, (_, i) => ( + for (const combinations of chunk(propCombinations, 8)) { + reacord.send( + channel.id, + combinations.map((combination, index) => (