Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Unified Diff: remoting/webapp/base/js/base_unittest.js

Issue 1358173005: Refactor HostSettings class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/base/js/base.js ('k') | remoting/webapp/base/js/host.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/base/js/base_unittest.js
diff --git a/remoting/webapp/base/js/base_unittest.js b/remoting/webapp/base/js/base_unittest.js
index 7fd746f7c30c7f1949488b4653246159dd77c933..cecfc8a218fb9b4a60196ba1eb1ebec6059d679a 100644
--- a/remoting/webapp/base/js/base_unittest.js
+++ b/remoting/webapp/base/js/base_unittest.js
@@ -110,6 +110,26 @@ QUnit.test('copyWithoutNullFields(null) returns a new empty object',
base.copyWithoutNullFields(undefined));
});
+QUnit.test('copyWithoutNullFields does a deep copy',
+ function(assert) {
+ var obj = {
+ a: 'foo',
+ b: { c: 'bar' }
+ };
+ var copy = base.copyWithoutNullFields(obj);
+ assert.notEqual(obj.b, copy['b']);
+});
+
+QUnit.test('mergeWithoutNullFields(null) leaves the destination unchanged',
+ function(assert) {
+ var obj = { 'a': 1 };
+ var reference = base.deepCopy(obj);
+ base.mergeWithoutNullFields(obj, null);
+ assert.deepEqual(obj, reference);
+ base.mergeWithoutNullFields(obj, undefined);
+ assert.deepEqual(obj, reference);
+});
+
QUnit.test('isEmptyObject works',
function(assert) {
assert.ok(base.isEmptyObject({}));
« no previous file with comments | « remoting/webapp/base/js/base.js ('k') | remoting/webapp/base/js/host.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698