本文整理匯總了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>"');
});