mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-28 19:27:44 +00:00
Merge pull request #1817 from keymanapp/lmlayer-string-normalize
[LMLayer] Partial workaround for lack of String.prototype.normalize() support.
This commit is contained in:
commit
a8dfaaa5aa
3 changed files with 51 additions and 8 deletions
|
|
@ -154,7 +154,36 @@ describe('LMLayerWorker trie model for word lists', function() {
|
|||
firstResults.map(s => s.displayAs)
|
||||
);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('The default key function', function () {
|
||||
it('uses the default key function', function () {
|
||||
var model = new TrieModel(jsonFixture('tries/accented'));
|
||||
|
||||
// «nai| » [Send]
|
||||
// [ ??? ] [ naïve ] [ ??? ]
|
||||
var [suggestion] = model.predict({
|
||||
insert: 'i', deleteLeft: 0
|
||||
}, {
|
||||
left: 'na',
|
||||
startOfBuffer: false,
|
||||
endOfBuffer: true
|
||||
}).map(getSample);
|
||||
assert.strictEqual(suggestion.displayAs, 'naïve');
|
||||
|
||||
// «Let‘s get some pho| » [Send]
|
||||
// [ ??? ] [ phở ] [ ??? ]
|
||||
var [suggestion] = model.predict({
|
||||
insert: 'o', deleteLeft: 0
|
||||
}, {
|
||||
left: 'Let‘s get some ph',
|
||||
startOfBuffer: false,
|
||||
endOfBuffer: true
|
||||
}).map(getSample);
|
||||
assert.strictEqual(suggestion.displayAs, 'phở');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
it('replaces the entire typed word when a suggestion is accepted', function () {
|
||||
// Ensure that all input is lower-cased when we try to look it up.
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
{"type":"internal","weight":1,"values":["p","n"],"children":{"p":{"type":"leaf","weight":1,"entries":[{"key":"pho","weight":1,"content":"phở"}]},"n":{"type":"leaf","weight":1,"entries":[{"key":"naive","weight":1,"content":"naïve"}]}}}
|
||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue