@@ -20,7 +20,7 @@ describe('WithNativeAttributes', () => {
20
20
21
21
test ( 'renders with basic props' , ( ) => {
22
22
const { container } = render (
23
- < WithNativeAttributes tag = "div" nativeAttributes = { { } } >
23
+ < WithNativeAttributes tag = "div" componentName = "" nativeAttributes = { { } } >
24
24
Test content
25
25
</ WithNativeAttributes >
26
26
) ;
@@ -31,13 +31,13 @@ describe('WithNativeAttributes', () => {
31
31
} ) ;
32
32
test ( 'works with different HTML tags' , ( ) => {
33
33
const { container : spanContainer } = render (
34
- < WithNativeAttributes tag = "span" nativeAttributes = { { } } >
34
+ < WithNativeAttributes tag = "span" componentName = "" nativeAttributes = { { } } >
35
35
Span content
36
36
</ WithNativeAttributes >
37
37
) ;
38
38
39
39
const { container : buttonContainer } = render (
40
- < WithNativeAttributes tag = "button" nativeAttributes = { { } } >
40
+ < WithNativeAttributes tag = "button" componentName = "" nativeAttributes = { { } } >
41
41
Button content
42
42
</ WithNativeAttributes >
43
43
) ;
@@ -50,6 +50,7 @@ describe('WithNativeAttributes', () => {
50
50
const { container } = render (
51
51
< WithNativeAttributes < HTMLDivElement , HTMLAttributes < HTMLDivElement > >
52
52
tag = "div"
53
+ componentName = ""
53
54
className = "test-class"
54
55
nativeAttributes = { undefined }
55
56
>
@@ -64,7 +65,12 @@ describe('WithNativeAttributes', () => {
64
65
65
66
test ( 'concatenates className from rest props and nativeAttributes' , ( ) => {
66
67
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
+ >
68
74
Test content
69
75
</ WithNativeAttributes >
70
76
) ;
@@ -78,6 +84,7 @@ describe('WithNativeAttributes', () => {
78
84
const { container } = render (
79
85
< WithNativeAttributes
80
86
tag = "div"
87
+ componentName = ""
81
88
style = { { color : 'red' , fontSize : '16px' } }
82
89
nativeAttributes = { { style : { backgroundColor : 'blue' , fontSize : '18px' } } }
83
90
>
@@ -96,7 +103,12 @@ describe('WithNativeAttributes', () => {
96
103
const restHandler = jest . fn ( ) ;
97
104
98
105
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
+ >
100
112
Click me
101
113
</ WithNativeAttributes >
102
114
) ;
@@ -113,7 +125,12 @@ describe('WithNativeAttributes', () => {
113
125
const restHandler = jest . fn ( ) ;
114
126
115
127
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
+ >
117
134
Click me
118
135
</ WithNativeAttributes >
119
136
) ;
@@ -127,22 +144,27 @@ describe('WithNativeAttributes', () => {
127
144
128
145
test ( 'overrides other attributes and shows warning' , ( ) => {
129
146
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
+ >
131
153
Test content
132
154
</ WithNativeAttributes >
133
155
) ;
134
156
135
157
const element = container . firstElementChild ! ;
136
158
expect ( element . id ) . toBe ( 'override-id' ) ;
137
159
expect ( mockedWarnOnce ) . toHaveBeenCalledWith (
138
- 'Button ' ,
160
+ 'my-component ' ,
139
161
'Overriding native attribute [id] which has a Cloudscape-provided value'
140
162
) ;
141
163
} ) ;
142
164
143
165
test ( 'passes through data attributes without warning' , ( ) => {
144
166
const { container } = render (
145
- < WithNativeAttributes tag = "div" nativeAttributes = { { 'data-testid' : 'test-element' } } >
167
+ < WithNativeAttributes tag = "div" componentName = "" nativeAttributes = { { 'data-testid' : 'test-element' } } >
146
168
Test content
147
169
</ WithNativeAttributes >
148
170
) ;
@@ -154,7 +176,7 @@ describe('WithNativeAttributes', () => {
154
176
155
177
test ( 'does not allow children to be overrwitten' , ( ) => {
156
178
const { container } = render (
157
- < WithNativeAttributes tag = "div" nativeAttributes = { { children : 'Something custom' } as any } >
179
+ < WithNativeAttributes tag = "div" componentName = "" nativeAttributes = { { children : 'Something custom' } as any } >
158
180
Test content
159
181
</ WithNativeAttributes >
160
182
) ;
0 commit comments