jszhuyin
Version:
Smart Chinese Zhuyin Input Method in JavaScript.
43 lines (40 loc) • 1.21 kB
JavaScript
;
(function(factory) {
if (typeof module === 'object' && module.exports) {
// CommonJS
factory(module.exports, {
chai: require('chai')
});
} else if (typeof self === 'object') {
// Window or WorkerGlobalScope
if (typeof self.chai === 'undefined') {
throw new Error('Dependency not found.');
}
factory(self, self);
}
}(function(exports, required) {
var assert = required.chai.assert;
var TaskTest = exports.TaskTest = function() {
this.candidateId = 42;
};
TaskTest.NAME = 'Type ㄌㄨㄅㄟˊ, matches nothing';
TaskTest.prototype = {
tasks: [
{
fn: 'handleKey',
args: ['ㄌㄨㄅㄟˊ'],
wait: true,
checkReturnedValue: function(returnedValue) {
assert(returnedValue, 'Expected handled.');
},
expectCallbacks: ['compositionupdate', 'candidateschange'],
checkCallbackValues: function(values) {
assert.strictEqual(values.compositionupdate, 'ㄌㄨㄅㄟˊ');
assert.deepEqual(values.candidateschange,
[['ㄌㄨㄅㄟˊ', this.candidateId++],
['ㄌ', this.candidateId++]]);
}
}
]
};
}));