Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge individual changes to public/src/modules/settings.js from project 1 #16

Merged
merged 4 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added dump.rdb
Binary file not shown.
41 changes: 23 additions & 18 deletions public/src/modules/settings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
'use strict';

function updateValue(trim, value, element) {
console.log('Anna Shi');
print('Anna');
if (trim && value && typeof value.trim === 'function') {
value = value.trim();
if (typeof value.toString === 'function') {
value = value.toString();
}
} else if (value != null) {
if (typeof value.toString === 'function') {
value = value.toString();
}
if (trim) {
value = value.trim();
}
} else {
value = '';
}
if (value !== undefined) {
element.val(value);
}
}

define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
// eslint-disable-next-line prefer-const
Expand Down Expand Up @@ -183,24 +205,7 @@ define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
if (value instanceof Array) {
value = value.join(element.data('split') || (trim ? ', ' : ','));
}
if (trim && value && typeof value.trim === 'function') {
value = value.trim();
if (typeof value.toString === 'function') {
value = value.toString();
}
} else if (value != null) {
if (typeof value.toString === 'function') {
value = value.toString();
}
if (trim) {
value = value.trim();
}
} else {
value = '';
}
if (value !== undefined) {
element.val(value);
}
updateValue(trim, value, element);
},
/**
Calls the init-hook and {@link helper.fillField} on each field within wrapper-object.
Expand Down
12 changes: 0 additions & 12 deletions test/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,6 @@ describe('file', () => {
done();
});
});

it('should error if existing file is read only', (done) => {
fs.writeFileSync(uploadPath, 'hsdkjhgkjsfhkgj');
fs.chmodSync(uploadPath, '444');

fs.copyFile(tempPath, uploadPath, (err) => {
assert(err);
assert(err.code === 'EPERM' || err.code === 'EACCES');

done();
});
});
});

describe('saveFileToLocal', () => {
Expand Down