blob: c3025e5f3e7b38640a1398ed15b0f301e70a65bc [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001// Copyright 2016 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Copybara854996b2021-09-07 19:36:02 +00004
5/**
6 * @fileoverview Tests for framework-ajax.js.
7 */
8
9var CS_env;
10
11function setUp() {
12 CS_env = {'token': 'd34db33f'};
13}
14
15function testPostData() {
16 assertEquals(
17 'token=d34db33f',
18 CS_postData({}));
19 assertEquals(
20 'token=d34db33f',
21 CS_postData({}, true));
22 assertEquals(
23 '',
24 CS_postData({}, false));
25 assertEquals(
26 'a=5&b=foo&token=d34db33f',
27 CS_postData({a: 5, b: 'foo'}));
28
29 let unescaped = {};
30 unescaped['f oo?'] = 'b&ar';
31 assertEquals(
32 'f%20oo%3F=b%26ar',
33 CS_postData(unescaped, false));
34}