mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-28 19:27:44 +00:00
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
import 'mocha';
|
|
import { assert } from 'chai';
|
|
import { NameCompiler } from '../src/keyman/compiler/name';
|
|
import { CompilerCallbacks, loadSectionFixture } from './helpers';
|
|
import { Name } from '../src/keyman/kmx/kmx-plus';
|
|
//import { CompilerMessages } from './keyman/compiler/messages';
|
|
|
|
describe('name', function () {
|
|
this.slow(500); // 0.5 sec -- json schema validation takes a while
|
|
|
|
it('should compile minimal name data', function() {
|
|
const callbacks = new CompilerCallbacks();
|
|
let name = loadSectionFixture(NameCompiler, 'sections/name/minimal.xml', callbacks) as Name;
|
|
assert.equal(callbacks.messages.length, 0);
|
|
|
|
assert.equal(name.names.length, 1);
|
|
assert.equal(name.names[0], 'My First Keyboard');
|
|
});
|
|
|
|
it('should compile multiple names', function() {
|
|
const callbacks = new CompilerCallbacks();
|
|
let name = loadSectionFixture(NameCompiler, 'sections/name/multiple.xml', callbacks) as Name;
|
|
assert.equal(callbacks.messages.length, 0);
|
|
|
|
assert.equal(name.names.length, 5);
|
|
assert.equal(name.names[0], 'My Second Keyboard');
|
|
assert.equal(name.names[1], 'My 2nd Keyboard');
|
|
assert.equal(name.names[2], 'win:kbd2');
|
|
assert.equal(name.names[3], 'mac:keybd_2');
|
|
assert.equal(name.names[4], 'web:keyboard-2');
|
|
});
|
|
|
|
//TODO-LDML: should we be linting on repeated names?
|
|
});
|
|
|