michael@0: // nsDoTestsForAutoCompleteWithComposition tests autocomplete with composition. michael@0: // Users must include SimpleTest.js and EventUtils.js. michael@0: michael@0: function nsDoTestsForAutoCompleteWithComposition(aDescription, michael@0: aWindow, michael@0: aTarget, michael@0: aAutoCompleteController, michael@0: aIsFunc, michael@0: aGetTargetValueFunc, michael@0: aOnFinishFunc) michael@0: { michael@0: this._description = aDescription; michael@0: this._window = aWindow; michael@0: this._target = aTarget; michael@0: this._controller = aAutoCompleteController; michael@0: michael@0: this._is = aIsFunc; michael@0: this._getTargetValue = aGetTargetValueFunc; michael@0: this._onFinish = aOnFinishFunc; michael@0: michael@0: this._target.focus(); michael@0: michael@0: this._DefaultCompleteDefaultIndex = michael@0: this._controller.input.completeDefaultIndex; michael@0: michael@0: this._doTests(); michael@0: } michael@0: michael@0: nsDoTestsForAutoCompleteWithComposition.prototype = { michael@0: _window: null, michael@0: _target: null, michael@0: _controller: null, michael@0: _DefaultCompleteDefaultIndex: false, michael@0: _description: "", michael@0: michael@0: _is: null, michael@0: _getTargetValue: function () { return "not initialized"; }, michael@0: _onFinish: null, michael@0: michael@0: _doTests: function () michael@0: { michael@0: if (++this._testingIndex == this._tests.length) { michael@0: this._controller.input.completeDefaultIndex = michael@0: this._DefaultCompleteDefaultIndex; michael@0: this._onFinish(); michael@0: return; michael@0: } michael@0: michael@0: var test = this._tests[this._testingIndex]; michael@0: if (this._controller.input.completeDefaultIndex != test.completeDefaultIndex) { michael@0: this._controller.input.completeDefaultIndex = test.completeDefaultIndex; michael@0: } michael@0: test.execute(this._window); michael@0: michael@0: var timeout = this._controller.input.timeout + 10; michael@0: this._waitResult(timeout); michael@0: }, michael@0: michael@0: _waitResult: function (aTimes) michael@0: { michael@0: var obj = this; michael@0: if (aTimes-- > 0) { michael@0: setTimeout(function () { obj._waitResult(aTimes); }, 0); michael@0: } else { michael@0: setTimeout(function () { obj._checkResult(); }, 0); michael@0: } michael@0: }, michael@0: michael@0: _checkResult: function () michael@0: { michael@0: var test = this._tests[this._testingIndex]; michael@0: this._is(this._getTargetValue(), test.value, michael@0: this._description + ", " + test.description + ": value"); michael@0: this._is(this._controller.searchString, test.searchString, michael@0: this._description + ", " + test.description +": searchString"); michael@0: this._is(this._controller.input.popupOpen, test.popup, michael@0: this._description + ", " + test.description + ": popupOpen"); michael@0: this._doTests(); michael@0: }, michael@0: michael@0: _testingIndex: -1, michael@0: _tests: [ michael@0: // Simple composition when popup hasn't been shown. michael@0: // The autocomplete popup should not be shown during composition, but michael@0: // after compositionend, the popup should be shown. michael@0: { description: "compositionstart shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("m", { type: "keydown", shiftKey: true }, aWindow); michael@0: synthesizeComposition({ type: "compositionstart" }, aWindow); michael@0: synthesizeComposition({ type: "compositionupdate", data: "M" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "M", michael@0: "clauses": michael@0: [ michael@0: { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 1, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "M", searchString: "" michael@0: }, michael@0: { description: "compositionupdate shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "Mo" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "Mo", michael@0: "clauses": michael@0: [ michael@0: { "length": 2, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mo", searchString: "" michael@0: }, michael@0: { description: "compositionend should open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "Mo", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }, aWindow); michael@0: synthesizeComposition({ type: "compositionend", data: "Mo" }, aWindow); michael@0: synthesizeKey("VK_RETURN", { type: "keyup" }, aWindow); michael@0: }, popup: true, value: "Mo", searchString: "Mo" michael@0: }, michael@0: // If composition starts when popup is shown, the compositionstart event michael@0: // should cause closing the popup. michael@0: { description: "compositionstart should close the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("z", { type: "keydown" }, aWindow); michael@0: synthesizeComposition({ type: "compositionstart" }, aWindow); michael@0: synthesizeComposition({ type: "compositionupdate", data: "z" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "z", michael@0: "clauses": michael@0: [ michael@0: { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 1, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Moz", searchString: "Mo" michael@0: }, michael@0: { description: "compositionupdate shouldn't reopen the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "zi" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "zi", michael@0: "clauses": michael@0: [ michael@0: { "length": 2, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mozi", searchString: "Mo" michael@0: }, michael@0: { description: "compositionend should research the result and open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "zi", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }); michael@0: synthesizeComposition({ type: "compositionend", data: "zi" }, aWindow); michael@0: synthesizeKey("VK_RETURN", { type: "keyup" }, aWindow); michael@0: }, popup: true, value: "Mozi", searchString: "Mozi" michael@0: }, michael@0: // If composition is cancelled, the value shouldn't be changed. michael@0: { description: "compositionstart should reclose the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("l", { type: "keydown" }, aWindow); michael@0: synthesizeComposition({ type: "compositionstart" }, aWindow); michael@0: synthesizeComposition({ type: "compositionupdate", data: "l" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "l", michael@0: "clauses": michael@0: [ michael@0: { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 1, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mozil", searchString: "Mozi" michael@0: }, michael@0: { description: "compositionupdate shouldn't reopen the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "ll" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "ll", michael@0: "clauses": michael@0: [ michael@0: { "length": 2, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mozill", searchString: "Mozi" michael@0: }, michael@0: { description: "empty compositionupdate shouldn't reopen the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 0, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mozi", searchString: "Mozi" michael@0: }, michael@0: { description: "cancled compositionend should reopen the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 0, "length": 0 } michael@0: }, aWindow); michael@0: synthesizeComposition({ type: "compositionend", data: "" }, aWindow); michael@0: synthesizeKey("VK_ESCAPE", { type: "keyup" }, aWindow); michael@0: }, popup: true, value: "Mozi", searchString: "Mozi" michael@0: }, michael@0: // But if composition replaces some characters and canceled, the search michael@0: // string should be the latest value. michael@0: { description: "compositionstart with selected string should close the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("VK_LEFT", { shiftKey: true }, aWindow); michael@0: synthesizeKey("VK_LEFT", { shiftKey: true }, aWindow); michael@0: synthesizeKey("z", { type: "keydown" }, aWindow); michael@0: synthesizeComposition({ type: "compositionstart" }, aWindow); michael@0: synthesizeComposition({ type: "compositionupdate", data: "z" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "z", michael@0: "clauses": michael@0: [ michael@0: { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 1, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Moz", searchString: "Mozi" michael@0: }, michael@0: { description: "compositionupdate shouldn't reopen the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "zi" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "zi", michael@0: "clauses": michael@0: [ michael@0: { "length": 2, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mozi", searchString: "Mozi" michael@0: }, michael@0: { description: "empty compositionupdate shouldn't reopen the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 0, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mo", searchString: "Mozi" michael@0: }, michael@0: { description: "canceled compositionend should seach the result with the latest value", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 0, "length": 0 } michael@0: }, aWindow); michael@0: synthesizeComposition({ type: "compositionend", data: "" }, aWindow); michael@0: synthesizeKey("VK_ESCAPE", { type: "keyup" }, aWindow); michael@0: }, popup: true, value: "Mo", searchString: "Mo" michael@0: }, michael@0: //If all characters are removed, the popup should be closed. michael@0: { description: "the value becomes empty by backspace, the popup should be closed", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("VK_BACK_SPACE", {}, aWindow); michael@0: synthesizeKey("VK_BACK_SPACE", {}, aWindow); michael@0: }, popup: false, value: "", searchString: "" michael@0: }, michael@0: // composition which is canceled shouldn't cause opening the popup. michael@0: { description: "compositionstart shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("m", { type: "keydown", shiftKey: true }, aWindow); michael@0: synthesizeComposition({ type: "compositionstart" }, aWindow); michael@0: synthesizeComposition({ type: "compositionupdate", data: "M" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "M", michael@0: "clauses": michael@0: [ michael@0: { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 1, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "M", searchString: "" michael@0: }, michael@0: { description: "compositionupdate shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "Mo" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "Mo", michael@0: "clauses": michael@0: [ michael@0: { "length": 2, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mo", searchString: "" michael@0: }, michael@0: { description: "empty compositionupdate shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 0, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "", searchString: "" michael@0: }, michael@0: { description: "canceled compositionend shouldn't open the popup if it was closed", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 0, "length": 0 } michael@0: }, aWindow); michael@0: synthesizeComposition({ type: "compositionend", data: "" }, aWindow); michael@0: synthesizeKey("VK_ESCAPE", { type: "keyup" }, aWindow); michael@0: }, popup: false, value: "", searchString: "" michael@0: }, michael@0: // Down key should open the popup even if the editor is empty. michael@0: { description: "DOWN key should open the popup even if the value is empty", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("VK_DOWN", {}, aWindow); michael@0: }, popup: true, value: "", searchString: "" michael@0: }, michael@0: // If popup is open at starting composition, the popup should be reopened michael@0: // after composition anyway. michael@0: { description: "compositionstart shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("m", { type: "keydown", shiftKey: true }, aWindow); michael@0: synthesizeComposition({ type: "compositionstart" }, aWindow); michael@0: synthesizeComposition({ type: "compositionupdate", data: "M" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "M", michael@0: "clauses": michael@0: [ michael@0: { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 1, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "M", searchString: "" michael@0: }, michael@0: { description: "compositionupdate shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "Mo" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "Mo", michael@0: "clauses": michael@0: [ michael@0: { "length": 2, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mo", searchString: "" michael@0: }, michael@0: { description: "empty compositionupdate shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 0, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "", searchString: "" michael@0: }, michael@0: { description: "canceled compositionend should open the popup if it was opened", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 0, "length": 0 } michael@0: }, aWindow); michael@0: synthesizeComposition({ type: "compositionend", data: "" }, aWindow); michael@0: synthesizeKey("VK_ESCAPE", { type: "keyup" }, aWindow); michael@0: }, popup: true, value: "", searchString: "" michael@0: }, michael@0: // Type normally, and hit escape, the popup should be closed. michael@0: { description: "ESCAPE should close the popup after typing something", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("M", { shiftKey: true }, aWindow); michael@0: synthesizeKey("o", { shiftKey: true }, aWindow); michael@0: synthesizeKey("VK_ESCAPE", {}, aWindow); michael@0: }, popup: false, value: "Mo", searchString: "Mo" michael@0: }, michael@0: // Even if the popup is closed, composition which is canceled should open michael@0: // the popup if the value isn't empty. michael@0: // XXX This might not be good behavior, but anyway, this is minor issue... michael@0: { description: "compositionstart shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("z", { type: "keydown", shiftKey: true }, aWindow); michael@0: synthesizeComposition({ type: "compositionstart" }, aWindow); michael@0: synthesizeComposition({ type: "compositionupdate", data: "z" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "z", michael@0: "clauses": michael@0: [ michael@0: { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 1, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Moz", searchString: "Mo" michael@0: }, michael@0: { description: "compositionupdate shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "zi" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "zi", michael@0: "clauses": michael@0: [ michael@0: { "length": 2, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mozi", searchString: "Mo" michael@0: }, michael@0: { description: "empty compositionupdate shouldn't open the popup", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 0, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mo", searchString: "Mo" michael@0: }, michael@0: { description: "canceled compositionend shouldn't open the popup if the popup was closed", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 0, "length": 0 } michael@0: }, aWindow); michael@0: synthesizeComposition({ type: "compositionend", data: "" }, aWindow); michael@0: synthesizeKey("VK_ESCAPE", { type: "keyup" }, aWindow); michael@0: }, popup: true, value: "Mo", searchString: "Mo" michael@0: }, michael@0: // House keeping... michael@0: { description: "house keeping for next tests", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("VK_BACK_SPACE", {}, aWindow); michael@0: synthesizeKey("VK_BACK_SPACE", {}, aWindow); michael@0: }, popup: false, value: "", searchString: "" michael@0: }, michael@0: // Testing for nsIAutoCompleteInput.completeDefaultIndex being true. michael@0: { description: "compositionstart shouldn't open the popup (completeDefaultIndex is true)", michael@0: completeDefaultIndex: true, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("m", { type: "keydown", shiftKey: true }, aWindow); michael@0: synthesizeComposition({ type: "compositionstart" }, aWindow); michael@0: synthesizeComposition({ type: "compositionupdate", data: "M" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "M", michael@0: "clauses": michael@0: [ michael@0: { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 1, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "M", searchString: "" michael@0: }, michael@0: { description: "compositionupdate shouldn't open the popup (completeDefaultIndex is true)", michael@0: completeDefaultIndex: true, michael@0: execute: function (aWindow) { michael@0: synthesizeComposition({ type: "compositionupdate", data: "Mo" }, aWindow); michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "Mo", michael@0: "clauses": michael@0: [ michael@0: { "length": 2, "attr": COMPOSITION_ATTR_RAWINPUT } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }, aWindow); michael@0: }, popup: false, value: "Mo", searchString: "" michael@0: }, michael@0: { description: "compositionend should open the popup (completeDefaultIndex is true)", michael@0: completeDefaultIndex: true, michael@0: execute: function (aWindow) { michael@0: synthesizeText( michael@0: { "composition": michael@0: { "string": "Mo", michael@0: "clauses": michael@0: [ michael@0: { "length": 0, "attr": 0 } michael@0: ] michael@0: }, michael@0: "caret": { "start": 2, "length": 0 } michael@0: }, aWindow); michael@0: synthesizeComposition({ type: "compositionend", data: "Mo" }, aWindow); michael@0: synthesizeKey("VK_RETURN", { type: "keyup" }, aWindow); michael@0: }, popup: true, value: "Mozilla", searchString: "Mo" michael@0: }, michael@0: // House keeping... michael@0: { description: "house keeping for next tests", michael@0: completeDefaultIndex: false, michael@0: execute: function (aWindow) { michael@0: synthesizeKey("VK_BACK_SPACE", {}, aWindow); michael@0: synthesizeKey("VK_BACK_SPACE", {}, aWindow); michael@0: synthesizeKey("VK_BACK_SPACE", {}, aWindow); michael@0: synthesizeKey("VK_BACK_SPACE", {}, aWindow); michael@0: synthesizeKey("VK_BACK_SPACE", {}, aWindow); michael@0: synthesizeKey("VK_BACK_SPACE", {}, aWindow); michael@0: }, popup: false, value: "", searchString: "" michael@0: } michael@0: ] michael@0: };