@@ -100,6 +100,11 @@ describe('server', () => {
100
100
101
101
expect ( styleComponent ) . toEqual ( isArray ) ;
102
102
expect ( styleComponent ) . toHaveLength ( 0 ) ;
103
+
104
+ expect ( head . priority ) . toBeDefined ( ) ;
105
+ expect ( head . priority . toString ) . toBeDefined ( ) ;
106
+ expect ( head . priority . toString ( ) ) . toEqual ( '' ) ;
107
+ expect ( head . priority . toComponent ) . toBeDefined ( ) ;
103
108
} ) ;
104
109
105
110
it ( 'does not render undefined attribute values' , ( ) => {
@@ -214,6 +219,11 @@ describe('server', () => {
214
219
215
220
expect ( styleComponent ) . toEqual ( isArray ) ;
216
221
expect ( styleComponent ) . toHaveLength ( 0 ) ;
222
+
223
+ expect ( head . priority ) . toBeDefined ( ) ;
224
+ expect ( head . priority . toString ) . toBeDefined ( ) ;
225
+ expect ( head . priority . toString ( ) ) . toEqual ( '' ) ;
226
+ expect ( head . priority . toComponent ) . toBeDefined ( ) ;
217
227
} ) ;
218
228
219
229
it ( 'does not render undefined attribute values' , ( ) => {
@@ -229,5 +239,57 @@ describe('server', () => {
229
239
230
240
expect ( script . toString ( ) ) . toMatchSnapshot ( ) ;
231
241
} ) ;
242
+
243
+ it ( 'prioritizes SEO tags when asked to' , ( ) => {
244
+ const context = { } ;
245
+ render (
246
+ < Helmet prioritizeSeoTags >
247
+ < link rel = "notImportant" href = "https://www.chipotle.com" />
248
+ < link rel = "canonical" href = "https://www.tacobell.com" />
249
+ < meta property = "og:title" content = "A very important title" />
250
+ </ Helmet > ,
251
+ context
252
+ ) ;
253
+
254
+ expect ( context . helmet . priority . toString ( ) ) . toContain (
255
+ 'rel="canonical" href="https://www.tacobell.com"'
256
+ ) ;
257
+ expect ( context . helmet . link . toString ( ) ) . not . toContain (
258
+ 'rel="canonical" href="https://www.tacobell.com"'
259
+ ) ;
260
+
261
+ expect ( context . helmet . priority . toString ( ) ) . toContain (
262
+ 'property="og:title" content="A very important title"'
263
+ ) ;
264
+ expect ( context . helmet . meta . toString ( ) ) . not . toContain (
265
+ 'property="og:title" content="A very important title"'
266
+ ) ;
267
+ } ) ;
268
+
269
+ it ( 'does not prioritize SEO unless asked to' , ( ) => {
270
+ const context = { } ;
271
+ render (
272
+ < Helmet >
273
+ < link rel = "notImportant" href = "https://www.chipotle.com" />
274
+ < link rel = "canonical" href = "https://www.tacobell.com" />
275
+ < meta property = "og:title" content = "A very important title" />
276
+ </ Helmet > ,
277
+ context
278
+ ) ;
279
+
280
+ expect ( context . helmet . priority . toString ( ) ) . not . toContain (
281
+ 'rel="canonical" href="https://www.tacobell.com"'
282
+ ) ;
283
+ expect ( context . helmet . link . toString ( ) ) . toContain (
284
+ 'rel="canonical" href="https://www.tacobell.com"'
285
+ ) ;
286
+
287
+ expect ( context . helmet . priority . toString ( ) ) . not . toContain (
288
+ 'property="og:title" content="A very important title"'
289
+ ) ;
290
+ expect ( context . helmet . meta . toString ( ) ) . toContain (
291
+ 'property="og:title" content="A very important title"'
292
+ ) ;
293
+ } ) ;
232
294
} ) ;
233
295
} ) ;
0 commit comments