fixup! Fixed tests

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2018-02-27 12:27:25 +01:00
parent 324e96b780
commit f1634cd3e2
No known key found for this signature in database
GPG Key ID: FB5ACEED51955BF8
1 changed files with 20 additions and 20 deletions

View File

@ -213,7 +213,7 @@ describe('OCA.External.Settings tests', function() {
expect($mountOptionsField.length).toEqual(1);
$mountOptionsField.val(JSON.stringify({previews:true}));
var $saveButton = $tr.find('td.save img');
var $saveButton = $tr.find('td.save .icon-save');
$saveButton.click();
expect(fakeServer.requests.length).toEqual(1);
@ -238,17 +238,17 @@ describe('OCA.External.Settings tests', function() {
// TODO: respond and check data-id
});
it('saves storage after closing mount options dropdown', function() {
$tr.find('.mountOptionsToggle img').click();
it('saves storage after closing mount options popovermenu', function() {
$tr.find('.mountOptionsToggle .icon-settings-dark').click();
$tr.find('[name=previews]').trigger(new $.Event('keyup', {keyCode: 97}));
$tr.find('input[data-parameter=field1]').val('test');
// does not save inside the dropdown
// does not save inside the popovermenu
expect(fakeServer.requests.length).toEqual(0);
$('body').mouseup();
// but after closing the dropdown
// but after closing the popovermenu
expect(fakeServer.requests.length).toEqual(1);
});
// TODO: status indicator
@ -320,7 +320,7 @@ describe('OCA.External.Settings tests', function() {
describe('recheck storages', function() {
// TODO
});
describe('mount options dropdown', function() {
describe('mount options popovermenu', function() {
var $tr;
var $td;
@ -330,45 +330,45 @@ describe('OCA.External.Settings tests', function() {
selectBackend('\\OC\\TestBackend');
});
it('shows dropdown when clicking on toggle button, hides when clicking outside', function() {
$td.find('img').click();
it('shows popovermenu when clicking on toggle button, hides when clicking outside', function() {
$td.find('.icon-settings-dark').click();
expect($td.find('.dropdown').length).toEqual(1);
expect($td.find('.popovermenu.open').length).toEqual(1);
$('body').mouseup();
expect($td.find('.dropdown').length).toEqual(0);
expect($td.find('.popovermenu.open').length).toEqual(0);
});
it('doesnt show the encryption option when encryption is disabled', function () {
view._encryptionEnabled = false;
$td.find('img').click();
$td.find('.icon-settings-dark').click();
expect($td.find('.dropdown [name=encrypt]:visible').length).toEqual(0);
expect($td.find('.popovermenu [name=encrypt]:visible').length).toEqual(0);
$('body').mouseup();
expect($td.find('.dropdown').length).toEqual(0);
expect($td.find('.popovermenu.open').length).toEqual(0);
});
it('reads config from mountOptions field', function() {
$tr.find('input.mountOptions').val(JSON.stringify({previews:false}));
$td.find('img').click();
expect($td.find('.dropdown [name=previews]').prop('checked')).toEqual(false);
$td.find('.icon-settings-dark').click();
expect($td.find('.popovermenu [name=previews]').prop('checked')).toEqual(false);
$('body').mouseup();
$tr.find('input.mountOptions').val(JSON.stringify({previews:true}));
$td.find('img').click();
expect($td.find('.dropdown [name=previews]').prop('checked')).toEqual(true);
$td.find('.icon-settings-dark').click();
expect($td.find('.popovermenu [name=previews]').prop('checked')).toEqual(true);
});
it('writes config into mountOptions field', function() {
$td.find('img').click();
$td.find('.icon-settings-dark').click();
// defaults to true
var $field = $td.find('.dropdown [name=previews]');
var $field = $td.find('.popovermenu [name=previews]');
expect($field.prop('checked')).toEqual(true);
$td.find('.dropdown [name=filesystem_check_changes]').val(0);
$td.find('.popovermenu [name=filesystem_check_changes]').val(0);
$('body').mouseup();
expect(JSON.parse($tr.find('input.mountOptions').val())).toEqual({