Skip to content

Commit f71bc31

Browse files
committed
add data-testid to legend switches, sidebar-legend, calculator selectors
1 parent 1e035b0 commit f71bc31

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

packages/app/src/components/calculator/ThroughputCalculatorDisplay.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,18 +513,21 @@ export default function ThroughputCalculatorDisplay() {
513513
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 gap-4">
514514
<ModelSelector
515515
id="calc-model"
516+
data-testid="calc-model-selector"
516517
value={selectedModel}
517518
onChange={handleModelChange}
518519
availableModels={availableModels}
519520
/>
520521
<SequenceSelector
521522
id="calc-sequence"
523+
data-testid="calc-sequence-selector"
522524
value={selectedSequence}
523525
onChange={handleSequenceChange}
524526
availableSequences={availableSequences}
525527
/>
526528
<PrecisionSelector
527529
id="calc-precision"
530+
data-testid="calc-precision-selector"
528531
value={selectedPrecisions}
529532
onChange={handlePrecisionChange}
530533
availablePrecisions={availablePrecisions}
@@ -537,7 +540,11 @@ export default function ThroughputCalculatorDisplay() {
537540
tooltip="The pricing tier used to calculate cost per million tokens. Hyperscaler (e.g. AWS/GCP), Neocloud (e.g. CoreWeave), or 3-year rental."
538541
/>
539542
<Select value={costProvider} onValueChange={handleCostProviderChange}>
540-
<SelectTrigger id="calc-cost" className="w-full">
543+
<SelectTrigger
544+
id="calc-cost"
545+
data-testid="calc-cost-selector"
546+
className="w-full"
547+
>
541548
<SelectValue />
542549
</SelectTrigger>
543550
<SelectContent>
@@ -557,7 +564,11 @@ export default function ThroughputCalculatorDisplay() {
557564
tooltip="Whether to show costs for total tokens, input tokens only, or output tokens only."
558565
/>
559566
<Select value={costType} onValueChange={handleCostTypeChange}>
560-
<SelectTrigger id="calc-cost-type" className="w-full">
567+
<SelectTrigger
568+
id="calc-cost-type"
569+
data-testid="calc-cost-type-selector"
570+
className="w-full"
571+
>
561572
<SelectValue />
562573
</SelectTrigger>
563574
<SelectContent>

packages/app/src/components/ui/chart-legend.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,12 @@ export default function ChartLegend({
234234
>
235235
{switches.map((sw) => (
236236
<div key={sw.id} className="mt-2 flex items-center gap-2">
237-
<Switch id={sw.id} checked={sw.checked} onCheckedChange={sw.onCheckedChange} />
237+
<Switch
238+
id={sw.id}
239+
data-testid={sw.id}
240+
checked={sw.checked}
241+
onCheckedChange={sw.onCheckedChange}
242+
/>
238243
<Label
239244
htmlFor={sw.id}
240245
className="text-xs text-muted-foreground hover:text-foreground cursor-pointer"
@@ -461,7 +466,7 @@ export default function ChartLegend({
461466

462467
const content = (
463468
<div className={isSidebar ? 'h-full' : 'relative'}>
464-
<div className={outerClasses} style={outerStyle}>
469+
<div data-testid="chart-legend" className={outerClasses} style={outerStyle}>
465470
{searchInput}
466471
{scrollContent}
467472
{bottomControls}

0 commit comments

Comments
 (0)