Changing how permalink and download links are hidden

Using a class name instead of setting the display CSS property. This
way, the ::after of the download link can be hidden when the permalink
is gone
This commit is contained in:
Jeff Avallone
2014-12-30 16:20:37 -05:00
parent 6c49d6ba8e
commit facd4f6ac4
4 changed files with 34 additions and 11 deletions
+11 -5
View File
@@ -9,11 +9,15 @@ describe('regexper.js', function() {
beforeEach(function() {
this.root = document.createElement('div');
this.root.innerHTML = [
'<form id="regexp-form" action="/"><input type="text" id="regexp-input" /></form>',
'<form id="regexp-form" action="/">',
'<input type="text" id="regexp-input">',
'<ul class="example">',
'<ul><a href="#" data-glyph="link-intact"></a></ul>',
'<ul><a href="#" data-glyph="data-transfer-download"></a></ul>',
'</ul>',
'</form>',
'<div id="error"></div>',
'<ul id="warnings"></ul>',
'<div><a href="#" data-glyph="link-intact"></a></div>',
'<div><a href="#" data-glyph="data-transfer-download"></a></div>',
'<div id="regexp-render"></div>',
].join('');
@@ -308,7 +312,8 @@ describe('regexper.js', function() {
it('hides the download link', function() {
this.regexper.updateLinks();
expect(this.regexper.download.parentNode.style.display).toEqual('none');
expect(this.regexper.links.className).toMatch(/\bexample\b/);
expect(this.regexper.links.className).toMatch(/\bhide-download\b/);
});
});
@@ -334,7 +339,8 @@ describe('regexper.js', function() {
it('hides the permalink', function() {
this.regexper.updateLinks();
expect(this.regexper.permalink.parentNode.style.display).toEqual('none');
expect(this.regexper.links.className).toMatch(/\bexample\b/);
expect(this.regexper.links.className).toMatch(/\bhide-permalink\b/);
});
});