bypass pump when unittesting

This commit is contained in:
dloverin committed 2013-05-01 14:04:52 -04:00
1 parent 51805f0f8f
commit 520ab57716
2 files changed
+7 -5

No files matched your search

@@ -53,7 +53,6 @@ define(function (require, exports, module) {
cachedToken = null, // the token used in the current hinting session
matcher = null; // string matcher for hints
/**
* Get the value of current session.
* Used for unit testing.
@@ -392,14 +391,17 @@ define(function (require, exports, module) {
* information, and reject any pending deferred requests.
*
* @param {Editor} editor - editor context to be initialized.
* @param {boolean} primePump - true if the pump should be primed.
*/
function initializeSession(editor) {
function initializeSession(editor, primePump) {
ScopeManager.handleEditorChange(editor.document);
session = new Session(editor);
cachedHints = null;
// prime pump for hints so the first user request is fast
ScopeManager.requestHints(session, session.editor.document, 0);
if (primePump) {
ScopeManager.requestHints(session, session.editor.document, 0);
}
}
/*
@@ -415,7 +417,7 @@ define(function (require, exports, module) {
cachedType = null;
if (editor && editor.getLanguageForSelection().getId() === HintUtils.LANGUAGE_ID) {
initializeSession(editor);
initializeSession(editor, true);
$(editor)
.on(HintUtils.eventName("change"), function () {
ScopeManager.handleFileChange(editor.document);
@@ -332,7 +332,7 @@ define(function (require, exports, module) {
// create Editor instance (containing a CodeMirror instance)
runs(function () {
testEditor = createMockEditor(testDoc);
JSCodeHints.initializeSession(testEditor);
JSCodeHints.initializeSession(testEditor, false);
});
});