本文整理汇总了TypeScript中tinymce/core/api/util/JSON.serialize函数的典型用法代码示例。如果您正苦于以下问题:TypeScript serialize函数的具体用法?TypeScript serialize怎么用?TypeScript serialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serialize函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
suite.test('serialize', function () {
LegacyUnit.equal(
Json.serialize({
arr1: [1, 2, 3, [1, 2, 3]],
bool1: true,
float1: 3.14,
int1: 123,
null1: null,
obj1: { key1: 'val1', key2: 'val2' }, str1: '\"\'abc\u00C5123\\'
}
),
'{"arr1":[1,2,3,[1,2,3]],"bool1":true,"float1":3.14,"int1":123,"null1":null,' +
'"obj1":{"key1":"val1","key2":"val2"},"str1":"\\"\'abc\\u00c5123\\\\"}'
);
LegacyUnit.equal(
Json.serialize({
arr1: [1, 2, 3, [1, 2, 3]],
bool1: true,
float1: 3.14,
int1: 123,
null1: null,
obj1: { key1: 'val1', key2: 'val2' }, str1: '\"\'abc\u00C5123'
}, '\''
),
'{\'arr1\':[1,2,3,[1,2,3]],\'bool1\':true,\'float1\':3.14,\'int1\':123,\'null1\':null,' +
'\'obj1\':{\'key1\':\'val1\',\'key2\':\'val2\'},\'str1\':\'\\"\\\'abc\\u00c5123\'}'
);
});
示例2: function
suite.test('serialize', function () {
LegacyUnit.equal(
JSON.serialize({
'arr1': [1, 2, 3, [1, 2, 3]],
'bool1': true,
'float1': 3.14,
'int1': 123,
'null1': null,
'obj1': { key1: 'val1', key2: 'val2' },
'\"obj2': { key1: undefined },
'str1': '\"\'abc\u00C5123\\',
'date1': new Date(0)
}
),
'{"arr1":[1,2,3,[1,2,3]],"bool1":true,"float1":3.14,"int1":123,"null1":null,' +
'"obj1":{"key1":"val1","key2":"val2"},"\\"obj2":{},"str1":"\\"\'abc\\u00c5123\\\\",' +
'"date1":"1970-01-01T00:00:00.000Z"}'
);
});
示例3: function
suite.test('mceInsertRawHTML - insert char at char surrounded by spaces', function (editor) {
editor.setContent('<p>a b c</p>');
LegacyUnit.setSelection(editor, 'p', 2, 'p', 3);
editor.execCommand('mceInsertRawHTML', false, '<strong>X</strong>');
LegacyUnit.equal(JSON.serialize(editor.getContent()), '"<p>a <strong>X</strong> c</p>"');
});