Skip to content

Commit

Permalink
fix error_marker test
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Feb 15, 2023
1 parent ae92532 commit 7968105
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/config_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var assert = require("./test/assertions");
module.exports = {

"test: path resolution" : function() {
config.set("packaged", "true");
config.set("packaged", true);
var url = config.moduleUrl("kr_theme", "theme");
assert.equal(url, "theme-kr_theme.js");

Expand All @@ -38,7 +38,8 @@ module.exports = {
assert.equal(url, "_.js");

url = config.moduleUrl("ace/ext/textarea");
assert.equal(url, "a/b/ext-textarea.js");
assert.equal(url, "a/b/ext-textarea.js");
config.set("packaged", false);
},
"test: define options" : function() {
var o = {};
Expand Down
22 changes: 18 additions & 4 deletions src/ext/error_marker_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ if (typeof process !== "undefined") {
var assert = require("./../test/assertions");
require("./../test/mockdom");
var ace = require("../ace");
var editor, changes, textarea;
var editor, changes;

module.exports = {
setUp: function() {
ace.config.setLoader(function(moduleName, cb) {
if (moduleName == "ace/ext/error_marker")
return cb(null, require("../ext/error_marker"));
});
if (!editor) {
editor = ace.edit(null);
document.body.appendChild(editor.container);
Expand All @@ -31,10 +35,10 @@ module.exports = {
if (editor) {
editor.destroy();
editor.container.remove();
editor = textarea = null;
editor = null;
}
},
"test: simple text input": function() {
"test: go to next error": function() {
editor.session.setValue("1\nerror 2 warning\n3\n4 info\n5\n6\n");
editor.execCommand("goToNextError");
editor.resize(true);
Expand All @@ -52,9 +56,19 @@ module.exports = {
type: type
};
}));

editor.execCommand("goToNextError");
editor.renderer.$loop._flush();
assert.ok(/error_widget\s+ace_error/.test(editor.container.innerHTML));

editor.execCommand("goToNextError");
editor.renderer.$loop._flush();
assert.ok(/error_widget/.test(editor.container.innerHTML));
assert.ok(/error_widget\s+ace_info/.test(editor.container.innerHTML));

editor.execCommand("goToPreviousError");
editor.renderer.$loop._flush();
assert.ok(/error_widget\s+ace_error/.test(editor.container.innerHTML));

editor.execCommand("insertstring", "\n");
editor.renderer.$loop._flush();
assert.notOk(/error_widget/.test(editor.container.innerHTML));
Expand Down
8 changes: 6 additions & 2 deletions src/virtual_renderer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ var EditSession = require("./edit_session").EditSession;
var VirtualRenderer = require("./virtual_renderer").VirtualRenderer;
var vim = require("./keyboard/vim");
var assert = require("./test/assertions");
require("./ext/error_marker");

function setScreenPosition(node, rect) {
node.style.left = rect[0] + "px";
Expand All @@ -23,6 +22,11 @@ function setScreenPosition(node, rect) {
var editor = null;
module.exports = {
setUp: function() {
require("./config").setLoader(function(moduleName, cb) {
if (moduleName == "ace/ext/error_marker")
return cb(null, require("./ext/error_marker"));
});

if (editor)
editor.destroy();
var el = document.createElement("div");
Expand Down Expand Up @@ -255,7 +259,7 @@ module.exports = {
}
]);
renderer.$loop._flush();
var context = renderer.$scrollDecorator.canvas.getContext();
var context = renderer.$scrollDecorator.canvas.getContext("2d");
var imageData = context.getImageData(0, 0, 50, 50);
var scrollDecoratorColors = renderer.$scrollDecorator.colors.light;
var values = [
Expand Down

0 comments on commit 7968105

Please sign in to comment.