瀏覽代碼

Fixed failing JS tests

Adam Cozzette 7 年之前
父節點
當前提交
e372df5c97
共有 4 個文件被更改,包括 3 次插入11 次删除
  1. 1 0
      js/commonjs/export_testdeps.js
  2. 1 1
      js/debug.js
  3. 1 1
      js/debug_test.js
  4. 0 9
      js/message_test.js

+ 1 - 0
js/commonjs/export_testdeps.js

@@ -12,6 +12,7 @@
 goog.provide('jspb.ExportTestDeps');
 
 goog.require('goog.crypt.base64');
+goog.require('goog.testing.PropertyReplacer');
 goog.require('jspb.arith.Int64');
 goog.require('jspb.arith.UInt64');
 goog.require('jspb.BinaryEncoder');

+ 1 - 1
js/debug.js

@@ -79,7 +79,7 @@ jspb.debug.dump_ = function(thing) {
       type == 'null' || type == 'undefined') {
     return thing;
   }
-  if (window.Uint8Array) {
+  if (typeof Uint8Array !== 'undefined') {
     // Will fail on IE9, where Uint8Array doesn't exist.
     if (message instanceof Uint8Array) {
       return thing;

+ 1 - 1
js/debug_test.js

@@ -77,7 +77,7 @@ describe('debugTest', function() {
   });
 
   it('testBytes', function() {
-    if (COMPILED || !window['Uint8Array']) {
+    if (COMPILED || typeof Uint8Array == 'undefined') {
       return;
     }
     var message = new proto.jspb.test.TestAllTypes();

+ 0 - 9
js/message_test.js

@@ -1052,13 +1052,4 @@ describe('Message test suite', function() {
     assertNan(message.getDefaultDoubleField());
   });
 
-  it('testSerializePreservesEmptyNestedField', function() {
-    var message = new proto.jspb.test.OptionalFields();
-    message.setANestedMessage(new proto.jspb.test.OptionalFields.Nested());
-    message.addARepeatedMessage(new proto.jspb.test.OptionalFields.Nested());
-    message = proto.jspb.test.OptionalFields.deserialize(message.serialize());
-    assertNotNullNorUndefined(message.getANestedMessage());
-    assertEquals(1, message.getARepeatedMessageList().length);
-  });
-
 });