Skip to content

Commit c768bb7

Browse files
committed
fix tests broken by #39
1 parent f4ec8c0 commit c768bb7

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ To add more tags to the document head, you can use the `tag()` and `rawTag()` me
140140

141141
```php
142142
seo()->tag('fb:image', asset('foo'));
143-
seo()->rawTag('<meta property="fb:url" content="bar" />');
144-
seo()->rawTag('fb_url', '<meta property="fb:url" content="bar" />'); // Keyed, allows overrides later on
143+
seo()->rawTag('<meta property="fb:url" content="bar">');
144+
seo()->rawTag('fb_url', '<meta property="fb:url" content="bar">'); // Keyed, allows overrides later on
145145
```
146146

147147
### Canonical URL
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<meta name="twitter:card" content="summary_large_image">
2-
@if(seo('twitter.creator')) <meta name="twitter:creator" content="@seo('twitter.creator')" /> @endif
3-
@if(seo('twitter.site')) <meta name="twitter:site" content="@seo('twitter.site')" /> @endif
4-
@if(seo('twitter.title')) <meta name="twitter:title" content="@seo('twitter.title')" /> @endif
5-
@if(seo('twitter.description')) <meta name="twitter:description" content="@seo('twitter.description')" /> @endif
6-
@if(seo('twitter.image')) <meta name="twitter:image" content="@seo('twitter.image')" /> @endif
2+
@if(seo('twitter.creator')) <meta name="twitter:creator" content="@seo('twitter.creator')"> @endif
3+
@if(seo('twitter.site')) <meta name="twitter:site" content="@seo('twitter.site')"> @endif
4+
@if(seo('twitter.title')) <meta name="twitter:title" content="@seo('twitter.title')"> @endif
5+
@if(seo('twitter.description')) <meta name="twitter:description" content="@seo('twitter.description')"> @endif
6+
@if(seo('twitter.image')) <meta name="twitter:image" content="@seo('twitter.image')"> @endif

src/SEOManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public function tag(string $property, string $content): static
264264
{
265265
$content = e($content);
266266

267-
$this->rawTag("meta.{$property}", "<meta property=\"{$property}\" content=\"{$content}\" />");
267+
$this->rawTag("meta.{$property}", "<meta property=\"{$property}\" content=\"{$content}\">");
268268

269269
return $this;
270270
}

tests/Pest/ExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
seo()->facebookTitle('abc');
4242

43-
expect(meta())->toContain('<meta name="facebook:title" content="ABC" />');
43+
expect(meta())->toContain('<meta name="facebook:title" content="ABC">');
4444
});
4545

4646
test('twitter falls back to the default values', function () {
@@ -56,7 +56,7 @@
5656
expect(seo('twitter.description'))->toBe('bar');
5757
expect(seo('description'))->toBe('baz');
5858

59-
expect(meta())->toContain('<meta name="twitter:title" content="foo" />');
59+
expect(meta())->toContain('<meta name="twitter:title" content="foo">');
6060
});
6161

6262
test('extensions are automatically enabled when values for them are set', function () {

tests/Pest/ManagerTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
test('meta tags can be added to the template', function () {
8787
seo()->tag('fb:image', 'foo');
8888

89-
expect(meta())->toContain('<meta property="fb:image" content="foo" />');
89+
expect(meta())->toContain('<meta property="fb:image" content="foo">');
9090
});
9191

9292
test('raw tags can be added to the template', function () {
@@ -114,8 +114,8 @@
114114
seo()->withUrl();
115115

116116
expect(meta())
117-
->toContain('<meta property="og:url" content="http://localhost" />')
118-
->toContain('<link rel="canonical" href="http://localhost" />');
117+
->toContain('<meta property="og:url" content="http://localhost">')
118+
->toContain('<link rel="canonical" href="http://localhost">');
119119
});
120120

121121
test('canonical url can be changed', function () {
@@ -124,8 +124,8 @@
124124
seo()->url('http://foo.com/bar');
125125

126126
expect(meta())
127-
->toContain('<meta property="og:url" content="http://foo.com/bar" />')
128-
->toContain('<link rel="canonical" href="http://foo.com/bar" />');
127+
->toContain('<meta property="og:url" content="http://foo.com/bar">')
128+
->toContain('<link rel="canonical" href="http://foo.com/bar">');
129129
});
130130

131131
test('og:title can be overridden using a tag', function () {
@@ -134,16 +134,16 @@
134134

135135
expect(meta())
136136
->toContain('<title>foo</title>')
137-
->toContain('<meta property="og:title" content="bar" />');
137+
->toContain('<meta property="og:title" content="bar">');
138138
});
139139

140140
test('type can be overridden using the type method', function () {
141-
expect(meta())->toContain('<meta property="og:type" content="website" />'); // default
141+
expect(meta())->toContain('<meta property="og:type" content="website">'); // default
142142

143143
seo()->type('foo');
144144

145145
expect(meta())
146-
->toContain('<meta property="og:type" content="foo" />') // overridden
146+
->toContain('<meta property="og:type" content="foo">') // overridden
147147
->not()->toContain('website');
148148
});
149149

@@ -155,5 +155,5 @@
155155
test('og:locale can be added to the template', function () {
156156
seo()->locale('de_DE');
157157

158-
expect(meta())->toContain('<meta property="og:locale" content="de_DE" />');
158+
expect(meta())->toContain('<meta property="og:locale" content="de_DE">');
159159
});

tests/Pest/SanitizationTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
expect($meta)->not()->toContain('content="Testing string " with several \' XSS characters </title> " . \' ."');
1414
expect($meta)->not()->toContain("content=\"{$unsanitizedContent}\"");
1515

16-
expect($meta)->toContain("<meta property=\"$property\" content=\"{$sanitizedContent}\" />");
17-
expect($meta)->toContain("<meta property=\"$property\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\" />");
16+
expect($meta)->toContain("<meta property=\"$property\" content=\"{$sanitizedContent}\">");
17+
expect($meta)->toContain("<meta property=\"$property\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\">");
1818
})->with([
1919
['site', 'og:site_name'],
2020
['url', 'og:url'],
@@ -37,8 +37,8 @@
3737
expect($meta)->not()->toContain('content="Testing string " with several \' XSS characters </title> " . \' ."');
3838
expect($meta)->not()->toContain("content=\"{$unsanitizedContent}\"");
3939

40-
expect($meta)->toContain("<meta name=\"$property\" content=\"{$sanitizedContent}\" />");
41-
expect($meta)->toContain("<meta name=\"$property\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\" />");
40+
expect($meta)->toContain("<meta name=\"$property\" content=\"{$sanitizedContent}\">");
41+
expect($meta)->toContain("<meta name=\"$property\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\">");
4242
})->with([
4343
['twitterCreator', 'twitter:creator'],
4444
['twitterSite', 'twitter:site'],
@@ -65,8 +65,8 @@
6565

6666
expect($meta)->toContain("<title>{$sanitizedContent}</title>");
6767
expect($meta)->toContain("<title>Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .</title>");
68-
expect($meta)->toContain("<meta property=\"og:title\" content=\"{$sanitizedContent}\" />");
69-
expect($meta)->toContain("<meta property=\"og:title\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\" />");
68+
expect($meta)->toContain("<meta property=\"og:title\" content=\"{$sanitizedContent}\">");
69+
expect($meta)->toContain("<meta property=\"og:title\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\">");
7070
});
7171

7272
test('seo blade directive calls are sanitized', function () {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<meta name="facebook:title" content="{{ strtoupper(seo()->facebookTitle) }}" />
1+
<meta name="facebook:title" content="{{ strtoupper(seo()->facebookTitle) }}">

0 commit comments

Comments
 (0)