From 002ddf1812f5253bf530466b15ce98547a1dd58d Mon Sep 17 00:00:00 2001
From: Yihui Liao <44729383+yihuiliao@users.noreply.github.com>
Date: Thu, 6 Mar 2025 14:38:40 -0800
Subject: [PATCH] add tests
---
.../test/Separator.test.js | 54 +++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 packages/react-aria-components/test/Separator.test.js
diff --git a/packages/react-aria-components/test/Separator.test.js b/packages/react-aria-components/test/Separator.test.js
new file mode 100644
index 00000000000..d6514d48666
--- /dev/null
+++ b/packages/react-aria-components/test/Separator.test.js
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2025 Adobe. All rights reserved.
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License. You may obtain a copy
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
+ * OF ANY KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+import {render} from '@react-spectrum/test-utils-internal';
+import {Separator, SeparatorContext} from '../';
+
+
+describe('Separator', () => {
+ it('should render a separator with default class', () => {
+ let {getByRole} = render();
+ let separator = getByRole('separator');
+ expect(separator.tagName).toBe('HR');
+ expect(separator).toHaveAttribute('class', 'react-aria-Separator');
+ });
+
+ it('should render a separator with custom class', () => {
+ let {getByRole} = render();
+ let separator = getByRole('separator');
+ expect(separator).toHaveAttribute('class', 'test');
+ });
+
+ it('should support DOM props', () => {
+ let {getByRole} = render();
+ let separator = getByRole('separator');
+ expect(separator).toHaveAttribute('data-foo', 'bar');
+ });
+
+ it('should support slot', () => {
+ let {getByRole} = render(
+
+
+
+ );
+
+ let separator = getByRole('separator');
+ expect(separator).toHaveAttribute('slot', 'test');
+ expect(separator).toHaveAttribute('aria-label', 'test');
+ });
+
+ it('should support accessibility props', () => {
+ let {getByRole} = render();
+ let separator = getByRole('separator');
+ expect(separator).toHaveAttribute('aria-label', 'label');
+ });
+});