emoji counting, fix #141
This commit is contained in:
parent
ed43487091
commit
1c4438dbb9
|
@ -50,6 +50,13 @@ describe('CreateStatusComponent', () => {
|
|||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not count emoji as multiple chars', () => {
|
||||
const status = '😃 😍 👌 👇 😱 😶 status with 😱 😶 emojis 😏 👍 ';
|
||||
(<any>component).maxCharLength = 500;
|
||||
(<any>component).countStatusChar(status);
|
||||
expect((<any>component).charCountLeft).toBe(461);
|
||||
});
|
||||
|
||||
it('should not parse small status', () => {
|
||||
const status = 'this is a cool status';
|
||||
(<any>component).maxCharLength = 500;
|
||||
|
|
|
@ -356,7 +356,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
|
|||
const currentStatus = parseStatus[parseStatus.length - 1];
|
||||
const statusExtraChars = this.getMentionExtraChars(status);
|
||||
|
||||
const statusLength = currentStatus.length - statusExtraChars;
|
||||
const statusLength = [...currentStatus].length - statusExtraChars;
|
||||
this.charCountLeft = this.maxCharLength - statusLength - this.getCwLength();
|
||||
this.postCounts = parseStatus.length;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es5",
|
||||
"downlevelIteration": true,
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue