Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ function prevGraphemeClusterBreak( str, fromIndex ) {
for ( i = 1; i <= idx; i++ ) {
// If the current character is part of a surrogate pair, move along...
if ( hasUTF16SurrogatePairAt( str, i-1 ) ) {
ans = i-2;
breaks.length = 0;
emoji.length = 0;
continue;
}
cp = codePointAt( str, i );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ tape( 'the function returns the previous grapheme break position in a specified
t.end();
});

tape( 'the function treats emoji modifier sequences as a single extended grapheme cluster', function test( t ) {
var out;

out = prevGraphemeClusterBreak( '👉🏿' );
t.strictEqual( out, -1, 'returns expected value' );

t.end();
});

tape( 'the function returns zero when the second argument is a negative integer (equivalent to clamping the second argument to zero)', function test( t ) {
var out;

Expand Down