blob: c3025e5f3e7b38640a1398ed15b0f301e70a65bc [file] [log] [blame]
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @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));
}