From 8b84b9bc8adfc692448be8dca1e275e0e578c7b0 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Mon, 28 Feb 2022 12:27:27 +0800 Subject: [PATCH] Add test for #2 (#39) --- test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test.js b/test.js index 41b7181..df3f1c4 100644 --- a/test.js +++ b/test.js @@ -32,3 +32,10 @@ test('ignores control characters', t => { test('handles combining characters', t => { t.is(stringWidth('x\u0300'), 1); }); + +test('handles ZWJ characters', t => { + t.is(stringWidth('πŸ‘Ά'), 2); + t.is(stringWidth('πŸ‘ΆπŸ½'), 2); + t.is(stringWidth('πŸ‘©β€πŸ‘©β€πŸ‘¦β€πŸ‘¦'), 2); + t.is(stringWidth('πŸ‘¨β€β€οΈβ€πŸ’‹β€πŸ‘¨'), 2); +});