Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ define(function (require, exports, module) {
);
if (matchedSnippet) {
// Get current editor from EditorManager since it's not passed
const editor = EditorManager.getFocusedEditor();
const editor = EditorManager.getActiveEditor();

if (editor) {
// to track the usage metrics
Expand Down Expand Up @@ -154,4 +154,5 @@ define(function (require, exports, module) {
}

exports.init = init;
exports._CustomSnippetsHandler = CustomSnippetsHandler; // exposed for integration testing
});
12 changes: 11 additions & 1 deletion src/extensionsIntegrated/CustomSnippets/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ define(function (require, exports, module) {
CodeHintIntegration.init();

// load snippets from file storage
SnippetsState.loadSnippetsFromState()
const _snippetsLoadedPromise = SnippetsState.loadSnippetsFromState()
.then(function () {
// track boot-time snippet count (only if user has snippets)
const snippetCount = Global.SnippetHintsList.length;
Expand All @@ -281,5 +281,15 @@ define(function (require, exports, module) {
});

SnippetCursorManager.registerHandlers();

// Expose modules for integration testing
if (brackets.test) {
brackets.test.CustomSnippetsGlobal = Global;
brackets.test.CustomSnippetsHelper = Helper;
brackets.test.CustomSnippetsCursorManager = SnippetCursorManager;
brackets.test.CustomSnippetsCodeHintHandler = CodeHintIntegration._CustomSnippetsHandler;
brackets.test.CustomSnippetsDriver = Driver;
brackets.test._customSnippetsLoadedPromise = _snippetsLoadedPromise;
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,6 @@ define(function (require, exports, module) {
exports.handleCursorActivity = handleCursorActivity;
exports.endSnippetSession = endSnippetSession;
exports.registerHandlers = registerHandlers;
exports.navigateToNextTabStop = navigateToNextTabStop; // exposed for integration testing
exports.navigateToPreviousTabStop = navigateToPreviousTabStop; // exposed for integration testing
});
2 changes: 2 additions & 0 deletions test/UnitTestSuite.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ define(function (require, exports, module) {
require("spec/Extn-CSSColorPreview-integ-test");
require("spec/Extn-CollapseFolders-integ-test");
require("spec/Extn-Tabbar-integ-test");
require("spec/Extn-CustomSnippets-test");
require("spec/Extn-CustomSnippets-integ-test");
// extension integration tests
require("spec/Extn-CSSCodeHints-integ-test");
require("spec/Extn-HTMLCodeHints-Lint-integ-test");
Expand Down
10 changes: 10 additions & 0 deletions test/spec/CustomSnippets-test-files/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<body>

<script>
var x = 1;

</script>
</body>
</html>
1 change: 1 addition & 0 deletions test/spec/CustomSnippets-test-files/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// test file for custom snippets integration tests
1 change: 1 addition & 0 deletions test/spec/CustomSnippets-test-files/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# test file for custom snippets integration tests
1 change: 1 addition & 0 deletions test/spec/CustomSnippets-test-files/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// test file for custom snippets integration tests
Loading
Loading