diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2020-09-03 21:04:24 +0000 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2020-09-03 21:04:24 +0000 |
commit | cf023383ae6a38e26b03fdda8c1bd728d15f2fff (patch) | |
tree | 07c26151d134ae0036d1ededb35062761c6940e4 | |
parent | b52aa7daef2299a0bf708feb01cfa41089c280a7 (diff) | |
parent | 1677770ca6b01be3ace0e3f31b10cb8eb50b4263 (diff) | |
download | gjs-cf023383ae6a38e26b03fdda8c1bd728d15f2fff.tar.gz |
Merge branch 'august-maintenance' into 'master'
August maintenance
See merge request GNOME/gjs!485
-rw-r--r-- | .eslintrc.yml | 8 | ||||
-rw-r--r-- | installed-tests/js/meson.build | 1 | ||||
-rw-r--r-- | installed-tests/js/testGIMarshalling.js | 4 | ||||
-rw-r--r-- | installed-tests/js/testPrint.js | 31 | ||||
-rw-r--r-- | modules/script/_bootstrap/default.js | 4 | ||||
-rw-r--r-- | modules/script/tweener/tweener.js | 4 |
6 files changed, 47 insertions, 5 deletions
diff --git a/.eslintrc.yml b/.eslintrc.yml index 9b242b8e..b50a5760 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -109,14 +109,14 @@ rules: no-restricted-properties: - error - object: Lang + property: copyProperties + message: Use Object.assign() + - object: Lang property: bind message: Use arrow notation or Function.prototype.bind() - object: Lang property: Class message: Use ES6 classes - - object: imports - property: mainloop - message: Use GLib main loops and timeouts no-restricted-syntax: - error - selector: >- @@ -132,6 +132,8 @@ rules: BlockStatement[body.length=1] CallExpression[arguments.length=0][callee.object.type="Super"][callee.property.name="_init"] message: _init() that only calls super._init() is unnecessary + - selector: BinaryExpression[operator="instanceof"][right.name="Array"] + message: Use Array.isArray() no-return-assign: error no-return-await: error no-self-compare: error diff --git a/installed-tests/js/meson.build b/installed-tests/js/meson.build index a9c030b9..b6fa7ce3 100644 --- a/installed-tests/js/meson.build +++ b/installed-tests/js/meson.build @@ -109,6 +109,7 @@ jasmine_tests = [ 'Namespace', 'Package', 'ParamSpec', + 'Print', 'Regress', 'Signals', 'System', diff --git a/installed-tests/js/testGIMarshalling.js b/installed-tests/js/testGIMarshalling.js index 6001e316..d2666626 100644 --- a/installed-tests/js/testGIMarshalling.js +++ b/installed-tests/js/testGIMarshalling.js @@ -1154,6 +1154,10 @@ let VFuncTester = GObject.registerClass(class VFuncTester extends GIMarshallingT vfunc_vfunc_in_object_transfer_none(object) { void object; } + + vfunc_vfunc_in_object_transfer_full(object) { + this._inObject = object; + } }); try { diff --git a/installed-tests/js/testPrint.js b/installed-tests/js/testPrint.js new file mode 100644 index 00000000..c42b0003 --- /dev/null +++ b/installed-tests/js/testPrint.js @@ -0,0 +1,31 @@ +describe('print', function () { + it('can be spied upon', function () { + spyOn(globalThis, 'print'); + print('foo'); + expect(print).toHaveBeenCalledWith('foo'); + }); +}); + +describe('printerr', function () { + it('can be spied upon', function () { + spyOn(globalThis, 'printerr'); + printerr('foo'); + expect(printerr).toHaveBeenCalledWith('foo'); + }); +}); + +describe('log', function () { + it('can be spied upon', function () { + spyOn(globalThis, 'log'); + log('foo'); + expect(log).toHaveBeenCalledWith('foo'); + }); +}); + +describe('logError', function () { + it('can be spied upon', function () { + spyOn(globalThis, 'logError'); + logError('foo', 'bar'); + expect(logError).toHaveBeenCalledWith('foo', 'bar'); + }); +}); diff --git a/modules/script/_bootstrap/default.js b/modules/script/_bootstrap/default.js index 6b220096..4c1fb179 100644 --- a/modules/script/_bootstrap/default.js +++ b/modules/script/_bootstrap/default.js @@ -7,21 +7,25 @@ print: { configurable: false, enumerable: true, + writable: true, value: print, }, printerr: { configurable: false, enumerable: true, + writable: true, value: printerr, }, log: { configurable: false, enumerable: true, + writable: true, value: log, }, logError: { configurable: false, enumerable: true, + writable: true, value: logError, }, }); diff --git a/modules/script/tweener/tweener.js b/modules/script/tweener/tweener.js index 540d4853..11a909d2 100644 --- a/modules/script/tweener/tweener.js +++ b/modules/script/tweener/tweener.js @@ -484,7 +484,7 @@ function _addTweenOrCaller(target, tweeningParameters, isCaller) { return false; var scopes; // List of objects to tween - if (target instanceof Array) { + if (Array.isArray(target)) { // The first argument is an array scopes = target.concat(); // XXX: To copy the array I guess } else { @@ -770,7 +770,7 @@ function _affectTweensWithFunction(func, args) { var affected = false; var scopes; - if (scope instanceof Array) + if (Array.isArray(scope)) scopes = scope.concat(); else scopes = new Array(scope); |