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 a8f65b1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 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
11 changes: 9 additions & 2 deletions src/ext/error_marker_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ 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/theme/textmate")
return cb(null, require("../theme/textmate"));
if (moduleName == "ace/ext/error_marker")
return cb(null, require("../ext/error_marker"));
return console.error("loader is not configured");
});
if (!editor) {
editor = ace.edit(null);
document.body.appendChild(editor.container);
Expand All @@ -31,7 +38,7 @@ module.exports = {
if (editor) {
editor.destroy();
editor.container.remove();
editor = textarea = null;
editor = null;
}
},
"test: simple text input": function() {
Expand Down
11 changes: 9 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,14 @@ function setScreenPosition(node, rect) {
var editor = null;
module.exports = {
setUp: function() {
require("./config").setLoader(function(moduleName, cb) {
if (moduleName == "ace/theme/textmate")
return cb(null, require("./theme/textmate"));
if (moduleName == "ace/ext/error_marker")
return cb(null, require("./ext/error_marker"));
return console.error("loader is not configured");
});

if (editor)
editor.destroy();
var el = document.createElement("div");
Expand Down Expand Up @@ -255,7 +262,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 a8f65b1

Please sign in to comment.