8
0
Просмотр исходного кода

Add unit test for international words.

Mateusz Samsel 6 лет назад
Родитель
Сommit
5c27279eba
1 измененных файлов с 14 добавлено и 0 удалено
  1. 14 0
      packages/ckeditor5-word-count/tests/wordcount.js

+ 14 - 0
packages/ckeditor5-word-count/tests/wordcount.js

@@ -15,6 +15,7 @@ import { add as addTranslations, _clear as clearTranslations } from '@ckeditor/c
 import Position from '@ckeditor/ckeditor5-engine/src/model/position';
 import ShiftEnter from '@ckeditor/ckeditor5-enter/src/shiftenter';
 import TableEditing from '@ckeditor/ckeditor5-table/src/tableediting';
+import featureDetection from '@ckeditor/ckeditor5-utils/src/featuredetection';
 
 // Delay related to word-count throttling.
 const DELAY = 255;
@@ -95,6 +96,19 @@ describe( 'WordCount', () => {
 			expect( wordCountPlugin.characters ).to.equal( 9 );
 		} );
 
+		it( 'should count international words', function() {
+			if ( !featureDetection.isUnicodePropertySupported ) {
+				this.skip();
+			}
+
+			expect( wordCountPlugin.words ).to.equal( 0 );
+
+			setModelData( model, '<paragraph>שמש 太陽 ดวงอาทิตย์ شمس ਸੂਰਜ słońce</paragraph>' );
+			wordCountPlugin._calculateWordsAndCharacters();
+
+			expect( wordCountPlugin.words ).to.equal( 6 );
+		} );
+
 		describe( 'update event', () => {
 			it( 'fires update event with actual amount of characters and words', () => {
 				const fake = sinon.fake();