Skip to content

Commit

Permalink
Fix all-caps suggestions for contractions
Browse files Browse the repository at this point in the history
Closes GH-36.
Closes GH-40.

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
tvquizphd authored Jan 9, 2021
1 parent 845ab5a commit bd92048
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ function generate(context, memory, words, edits) {
check(before + inject + nextAfter)

// Try upper-case if the original character was upper-cased.
if (upper) {
if (upper && inject !== inject.toUpperCase()) {
inject = inject.toUpperCase()

check(before + inject + after)
Expand Down
24 changes: 24 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,30 @@ test('NSpell()', function (t) {
'should include `warn: true` for warnings'
)

st.deepEqual(
us.suggest('dont'),
[
'dent',
'cont',
'font',
'wont',
'dint',
'dolt',
'don',
"don't",
'dona',
'done',
'dong',
'dons',
'dost',
'dot',
'Donn',
'Mont',
'ONT'
],
'should suggest alternatives including correct conjunction'
)

st.end()
})

Expand Down

0 comments on commit bd92048

Please sign in to comment.