web-apps/test/common/main/lib/util/utils.js

33 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-03-11 00:48:53 +00:00
/**
* utils.js
*
* Unit test
*
* Created by Alexander Yuzhin on 5/7/14
2018-03-01 12:16:38 +00:00
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
2016-03-11 00:48:53 +00:00
*
*/
define([
'../../../../../apps/common/main/lib/util/utils.js'
],function() {
describe('Common.Utils.String', function(){
it('Test format', function(){
assert.equal('successively: first, second', Common.Utils.String.format('successively: {0}, {1}', 'first', 'second'));
assert.equal('revers: second, first', Common.Utils.String.format('revers: {1}, {0}', 'first', 'second'));
});
it('Test htmlEncode', function(){
assert.equal('Curly, Larry & Moe', Common.Utils.String.htmlEncode('Curly, Larry & Moe'));
});
it('Test htmlDecode', function(){
assert.equal('Curly, Larry & Moe', Common.Utils.String.htmlDecode('Curly, Larry & Moe'));
});
it('Test ellipsis', function(){
assert.equal('Truncate a s...', Common.Utils.String.ellipsis('Truncate a string and add an ellipsis', 15));
assert.equal('Truncate a string and add...', Common.Utils.String.ellipsis('Truncate a string and add an ellipsis', 30, true));
});
});
});