blob: c5218d39d9d4c5b6a05b9412f3a599a5acc573fa [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001/* Copyright 2016 The Chromium Authors. All Rights Reserved.
2 *
3 * Use of this source code is governed by a BSD-style
4 * license that can be found in the LICENSE file or at
5 * https://developers.google.com/open-source/licenses/bsd
6 */
7
8/**
9 * @fileoverview Tests for framework-ajax.js.
10 */
11
12var CS_env;
13
14function setUp() {
15 CS_env = {'token': 'd34db33f'};
16}
17
18function testPostData() {
19 assertEquals(
20 'token=d34db33f',
21 CS_postData({}));
22 assertEquals(
23 'token=d34db33f',
24 CS_postData({}, true));
25 assertEquals(
26 '',
27 CS_postData({}, false));
28 assertEquals(
29 'a=5&b=foo&token=d34db33f',
30 CS_postData({a: 5, b: 'foo'}));
31
32 let unescaped = {};
33 unescaped['f oo?'] = 'b&ar';
34 assertEquals(
35 'f%20oo%3F=b%26ar',
36 CS_postData(unescaped, false));
37}