Project import generated by Copybara.
GitOrigin-RevId: d9e9e3fb4e31372ec1fb43b178994ca78fa8fe70
diff --git a/static/js/framework/framework-ajax_test.js b/static/js/framework/framework-ajax_test.js
new file mode 100644
index 0000000..c5218d3
--- /dev/null
+++ b/static/js/framework/framework-ajax_test.js
@@ -0,0 +1,37 @@
+/* Copyright 2016 The Chromium Authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style
+ * license that can be found in the LICENSE file or at
+ * https://developers.google.com/open-source/licenses/bsd
+ */
+
+/**
+ * @fileoverview Tests for framework-ajax.js.
+ */
+
+var CS_env;
+
+function setUp() {
+ CS_env = {'token': 'd34db33f'};
+}
+
+function testPostData() {
+ assertEquals(
+ 'token=d34db33f',
+ CS_postData({}));
+ assertEquals(
+ 'token=d34db33f',
+ CS_postData({}, true));
+ assertEquals(
+ '',
+ CS_postData({}, false));
+ assertEquals(
+ 'a=5&b=foo&token=d34db33f',
+ CS_postData({a: 5, b: 'foo'}));
+
+ let unescaped = {};
+ unescaped['f oo?'] = 'b&ar';
+ assertEquals(
+ 'f%20oo%3F=b%26ar',
+ CS_postData(unescaped, false));
+}