initial memory boilerplate, move sidebar toggle into it's init, test it behaves as it should

This commit is contained in:
El RIDO
2020-06-28 11:25:09 +02:00
parent 283d85c7cf
commit daae0d0dca
4 changed files with 85 additions and 9 deletions

29
js/test/Memory.js Normal file
View File

@@ -0,0 +1,29 @@
'use strict';
require('../common');
describe('Memory', function () {
describe('init', function () {
it(
'enables toggling the memory sidebar',
function() {
$('body').html(
'<main><div id="sidebar-wrapper"></div>' +
'<button id="menu-toggle"></button></main>'
);
assert.ok(!$('main').hasClass('toggled'));
$('#menu-toggle').click();
assert.ok(!$('main').hasClass('toggled'));
$.PrivateBin.Memory.init();
assert.ok(!$('main').hasClass('toggled'));
$('#menu-toggle').click();
assert.ok($('main').hasClass('toggled'));
$('#menu-toggle').click();
assert.ok(!$('main').hasClass('toggled'));
}
);
});
});