Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Cascade.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ protected function parseAntlers($item)

$viewCascade = array_merge(
app(ViewCascade::class)->toArray(),
$this->current,
$this->current ?? [],
['___tmpValue' => $value],
);

Expand Down
35 changes: 34 additions & 1 deletion tests/MetaTagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function getEnvironmentSetUp($app)
});
}

public function tearDown(): void
protected function tearDown(): void
{
$this->cleanUpViews();

Expand Down Expand Up @@ -113,6 +113,39 @@ public function it_generates_normalized_meta_when_visiting_statamic_route_with_r
$this->assertStringContainsStringIgnoringLineEndings($this->normalizeMultilineString($expected), $content);
}

/**
* @test
*
* @dataProvider viewScenarioProvider
*/
public function it_generates_normalized_meta_when_visiting_statamic_route_with_raw_data_when_no_fallback_entry_exists($viewType)
{
Entry::findByUri('/')->deleteQuietly();

$this->prepareViews($viewType);

$expected = <<<'EOT'
<title>The View | Site Name</title>
<meta name="description" content="A wonderful view!" />
<meta property="og:type" content="website" />
<meta property="og:title" content="The View" />
<meta property="og:description" content="A wonderful view!" />
<meta property="og:url" content="http://cool-runnings.com/the-view" />
<meta property="og:site_name" content="Site Name" />
<meta property="og:locale" content="en_US" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="The View" />
<meta name="twitter:description" content="A wonderful view!" />
<link href="http://cool-runnings.com" rel="home" />
<link href="http://cool-runnings.com/the-view" rel="canonical" />
<link type="text/plain" rel="author" href="http://cool-runnings.com/humans.txt" />
EOT;

$content = $this->get('/the-view')->content();
$this->assertStringContainsStringIgnoringLineEndings("<h1>{$viewType}</h1>", $content);
$this->assertStringContainsStringIgnoringLineEndings($this->normalizeMultilineString($expected), $content);
}

/**
* @test
*
Expand Down