mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-11 11:25:34 +00:00
27 lines
819 B
JavaScript
27 lines
819 B
JavaScript
var assert = chai.assert;
|
|
var LMLayer = com.keyman.text.prediction.LMLayer;
|
|
|
|
describe('LMLayerWorker', function () {
|
|
describe('LMLayerWorkerCode', function() {
|
|
it('should exist!', function() {
|
|
assert.isFunction(LMLayerWorkerCode,
|
|
'Could not find LMLayerWorkerCode! Does embedded_worker.js exist?'
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('Usage within a Web Worker', function () {
|
|
it('should install itself in the worker context', function (done) {
|
|
let uri = LMLayer.asBlobURI(LMLayerWorkerCode);
|
|
let worker = new Worker(uri);
|
|
worker.onmessage = function thisShouldBeCalled(message) {
|
|
done();
|
|
};
|
|
worker.postMessage({
|
|
message: 'initialize',
|
|
model: { type: 'dummy' },
|
|
capabilities: { maxLeftContextCodeUnits: 64 }
|
|
});
|
|
});
|
|
});
|
|
})
|