Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Commit

Permalink
ensured that site dependencies are included first. fixes #18
Browse files Browse the repository at this point in the history
  • Loading branch information
travi committed May 10, 2014
1 parent 6bf9574 commit b173041
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ public function loadPageDependencies()
$controllerList = $this->pageDependenciesLists;
}

$this->addDependencies($this->pageDependenciesLists['site']);

$controllerName = strtolower($this->request->getController());
if (isset($controllerList[$controllerName])) {
$thisController = $controllerList[$controllerName];
Expand Down Expand Up @@ -390,6 +388,7 @@ public function setPageStyle($thisPageStyle = '')
public function setPageDependenciesLists($lists)
{
$this->pageDependenciesLists = $lists;
$this->addDependencies($this->pageDependenciesLists['site']);
}

public function setSiteTheme($sheet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,35 @@ public function testSiteDependenciesAddedEvenIfPageDoesNotHaveExtra()
);
}

public function testThatSiteDependenciesAreLoadedBeforePageDependencies()
{
$siteDeps = array(
'js' => array('script1.js', 'script2.js'),
'css' => array('sheet1.css', 'sheet2.css')
);
$dynamicDeps = array(
'js' => array('dynamic.js'),
'css' => array('dynamic.css')
);
$this->dependencyManager->setPageDependenciesLists(
array(
'site' => $siteDeps
)
);
$this->dependencyManager->addDependencies($dynamicDeps);

$this->dependencyManager->loadPageDependencies();

$this->assertEquals(
array_merge($siteDeps['js'], $dynamicDeps['js']),
$this->dependencyManager->getScripts()
);
$this->assertEquals(
array_merge($siteDeps['css'], $dynamicDeps['css']),
$this->dependencyManager->getStyleSheets()
);
}

public function testPageStyleNotSetIfEmpty()
{
$this->fileSystem->expects($this->once())
Expand Down

0 comments on commit b173041

Please sign in to comment.