@@ -20,7 +20,7 @@ describe('WithNativeAttributes', () => {
2020
2121 test ( 'renders with basic props' , ( ) => {
2222 const { container } = render (
23- < WithNativeAttributes tag = "div" nativeAttributes = { { } } >
23+ < WithNativeAttributes tag = "div" componentName = "" nativeAttributes = { { } } >
2424 Test content
2525 </ WithNativeAttributes >
2626 ) ;
@@ -31,13 +31,13 @@ describe('WithNativeAttributes', () => {
3131 } ) ;
3232 test ( 'works with different HTML tags' , ( ) => {
3333 const { container : spanContainer } = render (
34- < WithNativeAttributes tag = "span" nativeAttributes = { { } } >
34+ < WithNativeAttributes tag = "span" componentName = "" nativeAttributes = { { } } >
3535 Span content
3636 </ WithNativeAttributes >
3737 ) ;
3838
3939 const { container : buttonContainer } = render (
40- < WithNativeAttributes tag = "button" nativeAttributes = { { } } >
40+ < WithNativeAttributes tag = "button" componentName = "" nativeAttributes = { { } } >
4141 Button content
4242 </ WithNativeAttributes >
4343 ) ;
@@ -50,6 +50,7 @@ describe('WithNativeAttributes', () => {
5050 const { container } = render (
5151 < WithNativeAttributes < HTMLDivElement , HTMLAttributes < HTMLDivElement > >
5252 tag = "div"
53+ componentName = ""
5354 className = "test-class"
5455 nativeAttributes = { undefined }
5556 >
@@ -64,7 +65,12 @@ describe('WithNativeAttributes', () => {
6465
6566 test ( 'concatenates className from rest props and nativeAttributes' , ( ) => {
6667 const { container } = render (
67- < WithNativeAttributes tag = "div" className = "base-class" nativeAttributes = { { className : 'native-class' } } >
68+ < WithNativeAttributes
69+ tag = "div"
70+ componentName = ""
71+ className = "base-class"
72+ nativeAttributes = { { className : 'native-class' } }
73+ >
6874 Test content
6975 </ WithNativeAttributes >
7076 ) ;
@@ -78,6 +84,7 @@ describe('WithNativeAttributes', () => {
7884 const { container } = render (
7985 < WithNativeAttributes
8086 tag = "div"
87+ componentName = ""
8188 style = { { color : 'red' , fontSize : '16px' } }
8289 nativeAttributes = { { style : { backgroundColor : 'blue' , fontSize : '18px' } } }
8390 >
@@ -96,7 +103,12 @@ describe('WithNativeAttributes', () => {
96103 const restHandler = jest . fn ( ) ;
97104
98105 const { container } = render (
99- < WithNativeAttributes tag = "button" onClick = { restHandler } nativeAttributes = { { onClick : nativeHandler } } >
106+ < WithNativeAttributes
107+ tag = "button"
108+ componentName = ""
109+ onClick = { restHandler }
110+ nativeAttributes = { { onClick : nativeHandler } }
111+ >
100112 Click me
101113 </ WithNativeAttributes >
102114 ) ;
@@ -113,7 +125,12 @@ describe('WithNativeAttributes', () => {
113125 const restHandler = jest . fn ( ) ;
114126
115127 const { container } = render (
116- < WithNativeAttributes tag = "button" onClick = { restHandler } nativeAttributes = { { onClick : nativeHandler } } >
128+ < WithNativeAttributes
129+ tag = "button"
130+ componentName = ""
131+ onClick = { restHandler }
132+ nativeAttributes = { { onClick : nativeHandler } }
133+ >
117134 Click me
118135 </ WithNativeAttributes >
119136 ) ;
@@ -127,22 +144,27 @@ describe('WithNativeAttributes', () => {
127144
128145 test ( 'overrides other attributes and shows warning' , ( ) => {
129146 const { container } = render (
130- < WithNativeAttributes tag = "div" id = "original-id" nativeAttributes = { { id : 'override-id' } } >
147+ < WithNativeAttributes
148+ tag = "div"
149+ componentName = "my-component"
150+ id = "original-id"
151+ nativeAttributes = { { id : 'override-id' } }
152+ >
131153 Test content
132154 </ WithNativeAttributes >
133155 ) ;
134156
135157 const element = container . firstElementChild ! ;
136158 expect ( element . id ) . toBe ( 'override-id' ) ;
137159 expect ( mockedWarnOnce ) . toHaveBeenCalledWith (
138- 'Button ' ,
160+ 'my-component ' ,
139161 'Overriding native attribute [id] which has a Cloudscape-provided value'
140162 ) ;
141163 } ) ;
142164
143165 test ( 'passes through data attributes without warning' , ( ) => {
144166 const { container } = render (
145- < WithNativeAttributes tag = "div" nativeAttributes = { { 'data-testid' : 'test-element' } } >
167+ < WithNativeAttributes tag = "div" componentName = "" nativeAttributes = { { 'data-testid' : 'test-element' } } >
146168 Test content
147169 </ WithNativeAttributes >
148170 ) ;
@@ -154,7 +176,7 @@ describe('WithNativeAttributes', () => {
154176
155177 test ( 'does not allow children to be overrwitten' , ( ) => {
156178 const { container } = render (
157- < WithNativeAttributes tag = "div" nativeAttributes = { { children : 'Something custom' } as any } >
179+ < WithNativeAttributes tag = "div" componentName = "" nativeAttributes = { { children : 'Something custom' } as any } >
158180 Test content
159181 </ WithNativeAttributes >
160182 ) ;
0 commit comments