Commit 9becd565 by AlasdairSwan

If not certificates remove the container element from the DOM

parent db05aeb7
...@@ -19,4 +19,4 @@ class ProgramListingPage(PageObject): ...@@ -19,4 +19,4 @@ class ProgramListingPage(PageObject):
@property @property
def is_sidebar_present(self): def is_sidebar_present(self):
"""Check whether sidebar is present.""" """Check whether sidebar is present."""
return self.q(css='.sidebar').present and self.q(css='.certificates-list').present return self.q(css='.sidebar').present
...@@ -25,6 +25,12 @@ ...@@ -25,6 +25,12 @@
if (certificatesData.length) { if (certificatesData.length) {
this.$el.html(this.tpl(this.context)); this.$el.html(this.tpl(this.context));
} else {
/**
* If not rendering remove el because
* styles are applied to it
*/
this.remove();
} }
} }
}); });
......
...@@ -50,15 +50,13 @@ define([ ...@@ -50,15 +50,13 @@ define([
}); });
it('should display no certificate box if certificates list is empty', function() { it('should display no certificate box if certificates list is empty', function() {
var $certificate;
view.remove(); view.remove();
setFixtures('<div class="certificates-list"></div>'); setFixtures('<div class="certificates-list"></div>');
view = new CertificateView({ view = new CertificateView({
context: {certificatesData: []} context: {certificatesData: []}
}); });
view.render(); view.render();
$certificate = view.$el.find('.certificate-link'); expect(view.$('.certificates-list').length).toBe(0);
expect($certificate.length).toBe(0);
}); });
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment