If not certificates remove the container element from the DOM

This commit is contained in:
AlasdairSwan
2016-05-10 08:57:09 -04:00
parent db05aeb7e0
commit 9becd565b3
3 changed files with 8 additions and 4 deletions

View File

@@ -19,4 +19,4 @@ class ProgramListingPage(PageObject):
@property
def is_sidebar_present(self):
"""Check whether sidebar is present."""
return self.q(css='.sidebar').present and self.q(css='.certificates-list').present
return self.q(css='.sidebar').present

View File

@@ -25,6 +25,12 @@
if (certificatesData.length) {
this.$el.html(this.tpl(this.context));
} else {
/**
* If not rendering remove el because
* styles are applied to it
*/
this.remove();
}
}
});

View File

@@ -50,15 +50,13 @@ define([
});
it('should display no certificate box if certificates list is empty', function() {
var $certificate;
view.remove();
setFixtures('<div class="certificates-list"></div>');
view = new CertificateView({
context: {certificatesData: []}
});
view.render();
$certificate = view.$el.find('.certificate-link');
expect($certificate.length).toBe(0);
expect(view.$('.certificates-list').length).toBe(0);
});
});
}