Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis authored and astrobot-houston committed Jul 27, 2024
1 parent 0b381d5 commit 85b1ab4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions packages/starlight/__tests__/basics/head.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@ describe('createHead', () => {
test('merges two <link rel="canonical" href="" /> tags', () => {
expect(
createHead(
[{ tag: 'link', attrs: { rel: 'canonical', href: "https://example.com" }, }],
[{ tag: 'link', attrs: { rel: 'canonical', href: "https://astro.build" }, content: '' }],
[{ tag: 'link', attrs: { rel: 'canonical', href: 'https://example.com' } }],
[{ tag: 'link', attrs: { rel: 'canonical', href: 'https://astro.build' }, content: '' }]
)
).toEqual([{ tag: 'link', attrs: { rel: 'canonical', href: "https://astro.build" }, content: '' }]);
).toEqual([
{ tag: 'link', attrs: { rel: 'canonical', href: 'https://astro.build' }, content: '' },
]);
});

test('does not merge same link tags', () => {
expect(
createHead(
[{ tag: 'link', attrs: { rel: 'stylesheet', href: "primary.css" }, content: '' }],
[{ tag: 'link', attrs: { rel: 'stylesheet', href: "secondary.css" }, content: '' }],
[{ tag: 'link', attrs: { rel: 'stylesheet', href: 'primary.css' }, content: '' }],
[{ tag: 'link', attrs: { rel: 'stylesheet', href: 'secondary.css' }, content: '' }]
)
).toEqual([
{ tag: 'link', attrs: { rel: 'stylesheet', href: "primary.css" }, content: '' },
{ tag: 'link', attrs: { rel: 'stylesheet', href: "secondary.css" }, content: '' }
{ tag: 'link', attrs: { rel: 'stylesheet', href: 'primary.css' }, content: '' },
{ tag: 'link', attrs: { rel: 'stylesheet', href: 'secondary.css' }, content: '' },
]);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/starlight/utils/head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function hasTag(head: HeadConfig, entry: HeadConfig[number]): boolean {
case 'meta':
return hasOneOf(head, entry, ['name', 'property', 'http-equiv']);
case 'link':
return head.some(({ attrs }) => attrs.rel === 'canonical')
return head.some(({ attrs }) => attrs.rel === 'canonical');
default:
return false;
}
Expand Down

0 comments on commit 85b1ab4

Please sign in to comment.