diff --git a/packages/components/src/composite/legacy/test/index.tsx b/packages/components/src/composite/legacy/test/index.tsx
index 07398e54b27ca3..8b2125397d70d1 100644
--- a/packages/components/src/composite/legacy/test/index.tsx
+++ b/packages/components/src/composite/legacy/test/index.tsx
@@ -1,7 +1,12 @@
/**
* External dependencies
*/
-import { queryByAttribute, render, screen } from '@testing-library/react';
+import {
+ queryByAttribute,
+ render,
+ screen,
+ renderHook,
+} from '@testing-library/react';
import { press, waitFor } from '@ariakit/test';
/**
@@ -156,6 +161,57 @@ function getShiftTestItems() {
};
}
+// Checking for deprecation warnings before other tests because the `deprecated`
+// utility only fires a console.warn the first time a component is rendered.
+describe( 'Shows a deprecation warning', () => {
+ it( 'useCompositeState', () => {
+ renderHook( () => useCompositeState() );
+ expect( console ).toHaveWarnedWith(
+ 'wp.components.__unstableUseCompositeState is deprecated since version 6.7. Please use Composite.useStore instead.'
+ );
+ } );
+ it( 'Composite', () => {
+ const Test = () => {
+ const props = useCompositeState();
+ return ;
+ };
+ render( );
+ expect( console ).toHaveWarnedWith(
+ 'wp.components.__unstableComposite is deprecated since version 6.7. Please use Composite instead.'
+ );
+ } );
+ it( 'CompositeItem', () => {
+ const Test = () => {
+ const props = useCompositeState();
+ return (
+
+
+
+ );
+ };
+ render( );
+ expect( console ).toHaveWarnedWith(
+ 'wp.components.__unstableCompositeItem is deprecated since version 6.7. Please use Composite.Item instead.'
+ );
+ } );
+ it( 'CompositeGroup', () => {
+ const Test = () => {
+ const props = useCompositeState();
+ return (
+
+
+
+
+
+ );
+ };
+ render( );
+ expect( console ).toHaveWarnedWith(
+ 'wp.components.__unstableCompositeGroup is deprecated since version 6.7. Please use Composite.Group or Composite.Row instead.'
+ );
+ } );
+} );
+
describe.each( [
[
'With "spread" state',