more sensible test
This commit is contained in:
@@ -55,49 +55,29 @@ await createTest(
|
|||||||
"buttons",
|
"buttons",
|
||||||
"should show button text, emojis, and make automatic action rows",
|
"should show button text, emojis, and make automatic action rows",
|
||||||
async (channel) => {
|
async (channel) => {
|
||||||
const propCombinations = generatePropCombinations<ButtonProps>({
|
|
||||||
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)
|
|
||||||
|
|
||||||
for (const combinations of chunk(propCombinations, 8)) {
|
|
||||||
reacord.send(
|
reacord.send(
|
||||||
channel.id,
|
channel.id,
|
||||||
combinations.map((combination, index) => (
|
<>
|
||||||
<Button
|
<Button label="strawberry" onClick={() => {}} />
|
||||||
key={index}
|
<Button emoji="🍓" onClick={() => {}} />
|
||||||
{...combination}
|
<Button label="strawberry" emoji="🍓" onClick={() => {}} />
|
||||||
label={
|
</>,
|
||||||
combination.label &&
|
)
|
||||||
[
|
reacord.send(
|
||||||
combination.label,
|
channel.id,
|
||||||
combination.style || "secondary (default)",
|
<>
|
||||||
combination.emoji && "emoji",
|
<Button label="primary" style="primary" onClick={() => {}} />
|
||||||
combination.disabled && "disabled",
|
<Button label="secondary" style="secondary" onClick={() => {}} />
|
||||||
]
|
<Button label="success" style="success" onClick={() => {}} />
|
||||||
.filter(Boolean)
|
<Button label="danger" style="danger" onClick={() => {}} />
|
||||||
.join(" + ")
|
</>,
|
||||||
}
|
)
|
||||||
// eslint-disable-next-line react/no-children-prop
|
reacord.send(
|
||||||
children={
|
channel.id,
|
||||||
combination.children &&
|
<>
|
||||||
[
|
<Button label="disabled" disabled onClick={() => {}} />
|
||||||
combination.children,
|
</>,
|
||||||
combination.style || "secondary (default)",
|
|
||||||
combination.emoji && "emoji",
|
|
||||||
combination.disabled && "disabled",
|
|
||||||
]
|
|
||||||
.filter(Boolean)
|
|
||||||
.join(" + ")
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user