0898014ebd
In 4.0.20 all tests were reworked. The 'testrunner' was removed and the PhantomJS Runner QUnit plugin was added making it possible to run the tests from cli. However it is still necessary to run the tests in all supported browsers to test the fixes for all browser quirks and normalization. Also all tests are loaded in one html file. See #27014 git-svn-id: https://develop.svn.wordpress.org/trunk@27679 602fd350-edb4-49c9-b593-d223f7449a82
74 lines
4.0 KiB
JavaScript
74 lines
4.0 KiB
JavaScript
module("tinymce.html.Entities");
|
|
|
|
test('encodeRaw', function() {
|
|
expect(2);
|
|
|
|
equal(tinymce.html.Entities.encodeRaw('<>"\'&\u00e5\u00e4\u00f6'), '<>"\'&\u00e5\u00e4\u00f6', 'Raw encoding text');
|
|
equal(tinymce.html.Entities.encodeRaw('<>"\'&\u00e5\u00e4\u00f6', true), '<>"\'&\u00e5\u00e4\u00f6', 'Raw encoding attribute');
|
|
});
|
|
|
|
test('encodeAllRaw', function() {
|
|
expect(1);
|
|
|
|
equal(tinymce.html.Entities.encodeAllRaw('<>"\'&\u00e5\u00e4\u00f6'), '<>"'&\u00e5\u00e4\u00f6', 'Raw encoding all');
|
|
});
|
|
|
|
test('encodeNumeric', function() {
|
|
expect(2);
|
|
|
|
equal(tinymce.html.Entities.encodeNumeric('<>"\'&\u00e5\u00e4\u00f6\u03b8\u2170\ufa11'), '<>"\'&åäöθⅰ﨑', 'Numeric encoding text');
|
|
equal(tinymce.html.Entities.encodeNumeric('<>"\'&\u00e5\u00e4\u00f6', true), '<>"\'&åäö', 'Numeric encoding attribute');
|
|
});
|
|
|
|
test('encodeNamed', function() {
|
|
expect(4);
|
|
|
|
equal(tinymce.html.Entities.encodeNamed('<>"\'&\u00e5\u00e4\u00f6'), '<>"\'&åäö', 'Named encoding text');
|
|
equal(tinymce.html.Entities.encodeNamed('<>"\'&\u00e5\u00e4\u00f6', true), '<>"\'&åäö', 'Named encoding attribute');
|
|
equal(tinymce.html.Entities.encodeNamed('<>"\'\u00e5\u00e4\u00f6', false, {'\u00e5' : 'å'}), '<>"\'å\u00e4\u00f6', 'Named encoding text');
|
|
equal(tinymce.html.Entities.encodeNamed('<>"\'\u00e5\u00e4\u00f6', true, {'\u00e5' : 'å'}), '<>"\'å\u00e4\u00f6', 'Named encoding attribute');
|
|
});
|
|
|
|
test('getEncodeFunc', function() {
|
|
var encodeFunc;
|
|
|
|
expect(10);
|
|
|
|
encodeFunc = tinymce.html.Entities.getEncodeFunc('raw');
|
|
equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '<>"\'&\u00e5\u00e4\u00f6', 'Raw encoding text');
|
|
equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '<>"\'&\u00e5\u00e4\u00f6', 'Raw encoding attribute');
|
|
|
|
encodeFunc = tinymce.html.Entities.getEncodeFunc('named');
|
|
equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '<>"\'&åäö', 'Named encoding text');
|
|
equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '<>"\'&åäö', 'Named encoding attribute');
|
|
|
|
encodeFunc = tinymce.html.Entities.getEncodeFunc('numeric');
|
|
equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '<>"\'&åäö', 'Named encoding text');
|
|
equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '<>"\'&åäö', 'Named encoding attribute');
|
|
|
|
encodeFunc = tinymce.html.Entities.getEncodeFunc('named+numeric', '229,aring');
|
|
equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '<>"\'&åäö', 'Named+numeric encoding text');
|
|
equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '<>"\'&åäö', 'Named+numeric encoding attribute');
|
|
|
|
encodeFunc = tinymce.html.Entities.getEncodeFunc('named,numeric', '229,aring');
|
|
equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '<>"\'&åäö', 'Named+numeric encoding text');
|
|
equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '<>"\'&åäö', 'Named+numeric encoding attribute');
|
|
});
|
|
|
|
test('decode', function() {
|
|
expect(3);
|
|
|
|
equal(tinymce.html.Entities.decode('<>"'&åäö&unknown;'''), '<>"\'&\u00e5\u00e4\u00f6&unknown;\'\'', 'Decode text with various entities');
|
|
|
|
equal(tinymce.html.Entities.encodeNumeric(tinymce.html.Entities.decode(
|
|
'‚ƒ„…†‡ˆ‰Š' +
|
|
'‹ŒŽ‘’“”•–—˜' +
|
|
'™š›œžŸ')
|
|
), '‚ƒ„…†‡ˆ‰Š‹ŒŽ' +
|
|
'‘’“”•–—˜™š' +
|
|
'›œžŸ',
|
|
'Entity decode ascii');
|
|
|
|
equal(tinymce.html.Entities.encodeNumeric(tinymce.html.Entities.decode('你')), '你', "High byte non western character.");
|
|
});
|