Skip to content

Commit

Permalink
add regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TomK committed Jun 4, 2019
1 parent d1ad60f commit eb6d223
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/ResourceManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ public function testRequireInlineJs()
{
Dispatch::bind(new Dispatch(Path::system(__DIR__, '_root')));
ResourceManager::inline()->requireJs("alert('inline');");
$this->assertContains(
'alert(\'inline\');',
$this->assertEquals(
'<script>alert(\'inline\');</script>',
Dispatch::instance()->store()->generateHtmlIncludes(ResourceStore::TYPE_JS)
);
ResourceManager::inline()->requireJs("alert('priority');", null, ResourceStore::PRIORITY_HIGH);
$this->assertEquals(
'<script>alert(\'priority\');</script><script>alert(\'inline\');</script>',
Dispatch::instance()->store()->generateHtmlIncludes(ResourceStore::TYPE_JS)
);
}
Expand Down Expand Up @@ -162,8 +167,13 @@ public function testRequireInlineCss()
{
Dispatch::bind(new Dispatch(Path::system(__DIR__, '_root')));
ResourceManager::inline()->requireCss("body{background:green;}");
$this->assertContains(
'body{background:green;}',
$this->assertEquals(
'<style>body{background:green;}</style>',
Dispatch::instance()->store()->generateHtmlIncludes(ResourceStore::TYPE_CSS)
);
ResourceManager::inline()->requireCss("body{background:red;}", null, ResourceStore::PRIORITY_HIGH);
$this->assertEquals(
'<style>body{background:red;}</style><style>body{background:green;}</style>',
Dispatch::instance()->store()->generateHtmlIncludes(ResourceStore::TYPE_CSS)
);
}
Expand Down

0 comments on commit eb6d223

Please sign in to comment.