Fix broken tests
This commit is contained in:
parent
17dbc568c8
commit
a4de1f25c1
|
@ -20,7 +20,10 @@ Discourse.HeaderView = Discourse.View.extend({
|
|||
$html = $('html'),
|
||||
self = this;
|
||||
|
||||
self.set('controller.visibleDropdown', elementId);
|
||||
var controller = self.get('controller');
|
||||
if(controller && !controller.isDestroyed){
|
||||
controller.set('visibleDropdown', elementId);
|
||||
}
|
||||
// we need to ensure we are rendered,
|
||||
// this optimises the speed of the initial render
|
||||
var render = $target.data('render');
|
||||
|
@ -38,7 +41,10 @@ Discourse.HeaderView = Discourse.View.extend({
|
|||
$dropdown.fadeOut('fast');
|
||||
$li.removeClass('active');
|
||||
$html.data('hide-dropdown', null);
|
||||
self.set('controller.visibleDropdown', null);
|
||||
var controller = self.get('controller');
|
||||
if(controller && !controller.isDestroyed){
|
||||
controller.set('visibleDropdown', null);
|
||||
}
|
||||
return $html.off('click.d-dropdown');
|
||||
};
|
||||
|
||||
|
|
|
@ -90,10 +90,11 @@ test("sitemap dropdown", function() {
|
|||
Discourse.SiteSettings.faq_url = "faq-url";
|
||||
Discourse.SiteSettings.enable_mobile_theme = true;
|
||||
|
||||
Discourse.User.current.returns({
|
||||
Discourse.User.current.returns(Ember.Object.create({
|
||||
username: 'test',
|
||||
staff: true,
|
||||
site_flagged_posts_count: 1
|
||||
});
|
||||
}));
|
||||
|
||||
Discourse.Category.list.returns([
|
||||
Discourse.Category.create({
|
||||
|
|
Loading…
Reference in New Issue