This repository has been archived by the owner on Mar 15, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #747 from diox/fix-navbar-render-when-navigation-s…
…tack-is-empty Fix navbar rendering when navigation.stack is empty (bug 1088419)
- Loading branch information
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
(function() { | ||
var a = require('assert'); | ||
var eq_ = a.eq_; | ||
var contains = a.contains; | ||
var mock = a.mock; | ||
var defer = require('defer'); | ||
var urls = require('urls'); | ||
|
||
test('navbar render context path', function(done, fail) { | ||
var expected_path = '/testing'; | ||
var stack = [{path: '/ignoreme'}, {path: expected_path}]; | ||
mock( | ||
'navbar', | ||
{ | ||
navigation: {stack: function() { return stack; }}, | ||
nunjucks: { | ||
env: { | ||
render: function(template, context) { | ||
if (template == 'nav.html') { | ||
eq_(context.path, expected_path); | ||
} | ||
} | ||
} | ||
}, | ||
}, | ||
function(navbar) { | ||
navbar.render(); | ||
stack = []; | ||
expected_path = ''; | ||
navbar.render(); | ||
|
||
done(); | ||
}, | ||
fail | ||
); | ||
}); | ||
|
||
})(); |