Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jquery 4.0 #916

Merged
merged 3 commits into from
Feb 7, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ jobs:
- name: Install ImageMagick
run: sudo apt-get -y install graphicsmagick
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '20'
- run: npm install
- run: make
- run: make lint
- run: make skipped_tests
- run: make test
- name: Coveralls
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
16 changes: 8 additions & 8 deletions __tests__/terminal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3082,7 +3082,7 @@ describe('Terminal plugin', function() {
});
expect(term.find('.cmd-prompt').text()).toEqual('>>>');
});
it('should render funtion that return promise', async () => {
it('should render function that return promise', async () => {
var term = $('<div/>').terminal($.noop, {
prompt: function() {
return Promise.resolve('>>>');
Expand All @@ -3091,7 +3091,7 @@ describe('Terminal plugin', function() {
await delay(10);
expect(term.find('.cmd-prompt').text()).toEqual('>>>');
});
it('should render funtion that call callback', () => {
it('should render function that call callback', () => {
var term = $('<div/>').terminal($.noop, {
prompt: function(fn) {
fn('>>>');
Expand Down Expand Up @@ -4081,7 +4081,7 @@ describe('Terminal plugin', function() {
$.ajax = function(obj) {
function done() {
if (!canceled) {
if ($.isFunction(obj.success)) {
if (typeof obj.success === 'function') {
obj.success(response, 'OK', {
getResponseHeader: function(header) {
if (header == 'Content-Type') {
Expand All @@ -4104,7 +4104,7 @@ describe('Terminal plugin', function() {
};
$(document).trigger("ajaxSend", [ jqXHR, obj ] );
try {
if ($.isFunction(obj.beforeSend)) {
if (typeof obj.beforeSend === 'function') {
obj.beforeSend({}, obj);
}
if (options.async) {
Expand Down Expand Up @@ -4142,7 +4142,7 @@ describe('Terminal plugin', function() {
var proc = {
name: key
};
if ($.isFunction(object[key])) {
if (typeof object[key] === 'function') {
var re = /function[^\(]+\(([^\)]+)\)/;
var m = object[key].toString().match(re);
if (m) {
Expand All @@ -4153,7 +4153,7 @@ describe('Terminal plugin', function() {
}
$.ajax = function(obj) {
function done() {
if ($.isFunction(obj.success)) {
if (typeof obj.success === 'function') {
obj.success(resp, 'OK', {
getResponseHeader: function(header) {
if (header == 'Content-Type') {
Expand Down Expand Up @@ -4192,7 +4192,7 @@ describe('Terminal plugin', function() {
var error = null;
var ret = null;
try {
if ($.isFunction(object[req.method])) {
if (typeof object[req.method] === 'function') {
ret = object[req.method].apply(null, req.params);
} else {
ret = null;
Expand Down Expand Up @@ -5566,7 +5566,7 @@ describe('Terminal plugin', function() {
var term = $('<div/>').appendTo('body').terminal(interpreter);
expect(term.commands()).toEqual(interpreter);
term.push('/test');
expect($.isFunction(term.commands())).toEqual(true);
expect(typeof term.commands() === 'function').toEqual(true);
term.destroy().remove();
});
});
Expand Down
20 changes: 10 additions & 10 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,13 @@
clone_object: function(object) {
var tmp = {};
if (typeof object === 'object') {
if ($.isArray(object)) {
if (Array.isArray(object)) {
return this.clone_array(object);
} else if (object === null) {
return object;
} else {
for (var key in object) {
if ($.isArray(object[key])) {
if (Array.isArray(object[key])) {
tmp[key] = this.clone_array(object[key]);
} else if (typeof object[key] === 'object') {
tmp[key] = this.clone_object(object[key]);
Expand Down Expand Up @@ -625,7 +625,7 @@
if (value === undefined || value === null) {
return null;
}
var result = this.regex.exec(jQuery.trim(value.toString()));
var result = this.regex.exec(value.toString().trim());
if (result[2]) {
var num = parseInt(result[1], 10);
var mult = this.powers[result[2]] || 1;
Expand All @@ -637,7 +637,7 @@
add: function(element, interval, label, fn, times, belay) {
var counter = 0;

if (jQuery.isFunction(label)) {
if (typeof label === 'function') {
if (!times) {
times = fn;
}
Expand Down Expand Up @@ -7107,7 +7107,7 @@
};
}
function validJSONRPC(response) {
return $.isNumeric(response.id) &&
return typeof response.id === 'number' &&
(typeof response.result !== 'undefined' ||
typeof response.error !== 'undefined');
}
Expand Down Expand Up @@ -8102,7 +8102,7 @@
object = {
interpreter: make_basic_json_rpc(user_intrp, login)
};
if ($.isArray(settings.completion)) {
if (Array.isArray(settings.completion)) {
object.completion = settings.completion;
}
finalize(object);
Expand Down Expand Up @@ -9410,7 +9410,7 @@
// will be used internaly since users know
// when login success (they decide when
// it happen by calling the callback -
// this funtion)
// this function)
if (is_function(next)) {
next();
}
Expand Down Expand Up @@ -9611,7 +9611,7 @@
} else {
save_state.push(self.export_view());
}
if (!$.isArray(hash_commands)) {
if (!Array.isArray(hash_commands)) {
hash_commands = [];
}
if (command !== undefined && !ignore_hash) {
Expand Down Expand Up @@ -9665,7 +9665,7 @@
}
var d = exec_settings.deferred;
cmd_ready(function ready() {
if ($.isArray(command)) {
if (Array.isArray(command)) {
(function recur() {
var cmd = command.shift();
if (cmd) {
Expand Down Expand Up @@ -11237,7 +11237,7 @@
// result is object with interpreter and completion properties
interpreters.push($.extend({}, ret, push_settings));
if (push_settings.completion === true) {
if ($.isArray(ret.completion)) {
if (Array.isArray(ret.completion)) {
interpreters.top().completion = ret.completion;
} else if (!ret.completion) {
interpreters.top().completion = false;
Expand Down
4 changes: 2 additions & 2 deletions js/less.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
term.removeClass('terminal-less');
$output.css('height', '');
var exit = options.exit || options.onExit;
if ($.isFunction(exit)) {
if (typeof exit === 'function') {
exit();
}
}
Expand Down Expand Up @@ -299,7 +299,7 @@
});
}
}
if ($.isFunction(text)) {
if (typeof text === 'function') {
text(cols, run);
} else {
run(text);
Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,10 @@
},
"dependencies": {
"@jcubic/lily": "^0.3.0",
"@types/jquery": "^3.5.14",
"@types/jquery": "^3.5.29",
"ansidec": "^0.3.4",
"iconv-lite": "^0.6.3",
"jquery": "^3.6.0",
"jquery": "^3.7.1",
"prismjs": "^1.27.0",
"wcwidth": "^1.0.1"
},
Expand Down