Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/x/components/sender/Sender.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { PropType, StyleValue } from "vue";
import type { CSSProperties } from "vue";

import { Flex } from "antdv-next";
import { useConfig } from "antdv-next/config-provider/context";
import { computed, defineComponent, ref, useAttrs, watch } from "vue";

Expand Down Expand Up @@ -363,10 +364,10 @@ export default defineComponent({
const actionListCls = `${cls}-actions-list`;

const actionNode = (
<div class={`${actionListCls}-presets`}>
<Flex class={`${actionListCls}-presets`}>
{props.allowSpeech && <SpeechButton />}
{props.loading ? <LoadingButton /> : <SendButton />}
</div>
</Flex>
);

const suffixNode =
Expand Down
15 changes: 14 additions & 1 deletion packages/x/components/sender/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { mount } from "@vue/test-utils";
import { describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";

import Sender from "..";

beforeEach(() => {
document.head.innerHTML = "";
});

describe("Sender", () => {
it("should render with default props", () => {
const wrapper = mount(Sender);
Expand Down Expand Up @@ -117,6 +121,15 @@ describe("Sender", () => {
expect(buttons.length).toBeGreaterThanOrEqual(1);
});

it("should render action presets with Flex", () => {
const wrapper = mount(Sender, {
props: { allowSpeech: true },
});

const presets = wrapper.find(".antd-sender-actions-list-presets");
expect(presets.classes()).toContain("ant-flex");
});

it("should render loading button when loading", () => {
const wrapper = mount(Sender, {
props: { loading: true },
Expand Down
Loading