feat: add artifact tests (#859)

This commit is contained in:
Jeremy 2025-03-11 14:39:36 -07:00 committed by GitHub
parent 9628c54755
commit 8e561dced4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 669 additions and 255 deletions

View file

@ -8,6 +8,7 @@ function PureArtifactCloseButton() {
return (
<Button
data-testid="artifact-close-button"
variant="outline"
className="h-fit p-2 dark:hover:bg-zinc-700"
onClick={() => {

View file

@ -269,6 +269,7 @@ function PureArtifact({
<AnimatePresence>
{artifact.isVisible && (
<motion.div
data-testid="artifact"
className="flex flex-row h-dvh w-dvw fixed top-0 left-0 z-50 bg-transparent"
initial={{ opacity: 1 }}
animate={{ opacity: 1 }}

View file

@ -1,5 +1,4 @@
import type { Message } from 'ai';
import { toast } from 'sonner';
import { useSWRConfig } from 'swr';
import { useCopyToClipboard } from 'usehooks-ts';
@ -15,6 +14,7 @@ import {
} from './ui/tooltip';
import { memo } from 'react';
import equal from 'fast-deep-equal';
import { toast } from 'sonner';
export function PureMessageActions({
chatId,
@ -57,6 +57,7 @@ export function PureMessageActions({
<Tooltip>
<TooltipTrigger asChild>
<Button
data-testid="message-upvote"
className="py-1 px-2 h-fit text-muted-foreground !pointer-events-auto"
disabled={vote?.isUpvoted}
variant="outline"
@ -109,6 +110,7 @@ export function PureMessageActions({
<Tooltip>
<TooltipTrigger asChild>
<Button
data-testid="message-downvote"
className="py-1 px-2 h-fit text-muted-foreground !pointer-events-auto"
variant="outline"
disabled={vote && !vote.isUpvoted}

View file

@ -247,7 +247,7 @@ function PureMultimodalInput({
autoFocus
onKeyDown={(event) => {
if (
event.key === "Enter" &&
event.key === 'Enter' &&
!event.shiftKey &&
!event.nativeEvent.isComposing
) {