diff --git a/src/components/Axis/Ticks.tsx b/src/components/Axis/Ticks.tsx index b26b477f..689532db 100644 --- a/src/components/Axis/Ticks.tsx +++ b/src/components/Axis/Ticks.tsx @@ -47,6 +47,7 @@ export function Ticks(props: Omit) { style, ...otherProps } = props; + // Primary Ticks let elements: Array = primaryTicks.map((tick) => { const { line, text } = getPositions(tick.position); diff --git a/tests/axis.test.tsx b/tests/axis.test.tsx index 1ffe5670..b871d501 100644 --- a/tests/axis.test.tsx +++ b/tests/axis.test.tsx @@ -1,8 +1,8 @@ import { test, expect } from '@playwright/experimental-ct-react'; -import { Axis, ParallelAxis } from '../src'; +import { Axis, LineSeries, ParallelAxis } from '../src'; -import { InfraredPlotTest } from './utils'; +import { DefaultPlotTest, InfraredPlotTest } from './utils'; test('all valid axes', async ({ mount }) => { const plot = await mount( @@ -76,3 +76,49 @@ test('axis scale', async ({ mount }) => { const timeAxis = ['.500:01', '.500:02', '.500:03', '.500:04'].join(''); await expect(time.locator('_react=Axis[scale="time"]')).toHaveText(timeAxis); }); + +test('constant x axis', async ({ mount }) => { + const plot = await mount( + + + , + ); + await expect(plot.locator('_react=HorizontalAxis >> text=0')).toBeVisible(); +}); + +test('constant y axis', async ({ mount }) => { + const plot = await mount( + + + , + ); + await expect(plot.locator('_react=VerticalAxis >> text=0')).toBeVisible(); +}); + +test('constant x and y axes', async ({ mount }) => { + const plot = await mount( + + + , + ); + await expect(plot.locator('_react=HorizontalAxis >> text=1')).toBeVisible(); + await expect(plot.locator('_react=VerticalAxis >> text=2')).toBeVisible(); +}); diff --git a/tests/utils.tsx b/tests/utils.tsx index 9b10f8e6..bdae7b3d 100644 --- a/tests/utils.tsx +++ b/tests/utils.tsx @@ -6,16 +6,20 @@ import { DirectedEllipse } from '../src/components/Annotations/DirectedEllipse'; import infrared from '../stories/data/infrared.json'; import { DEFAULT_PLOT_CONFIG } from '../stories/utils'; -export function InfraredPlotTest({ - children, -}: { - children?: ReactNode | ReactNode[]; -}) { +interface ChildrenProps { + children?: ReactNode; +} + +export function DefaultPlotTest({ children }: ChildrenProps) { + return {children}; +} + +export function InfraredPlotTest({ children }: ChildrenProps) { return ( - + {children} - + ); }