Compare commits

..

6 Commits

Author SHA1 Message Date
Ian Gilman
b405a904a6
Merge pull request #2362 from AndrewADev/update-qunit
Update to most recent QUnit
2023-05-30 14:31:02 -07:00
Ian Gilman
c2a1df9ae0 Changelog for #2361 2023-05-30 14:25:44 -07:00
Ian Gilman
c69950c6e4
Merge pull request #2361 from AndrewADev/allow-es6-syntax
Allow Using ES6 Syntax
2023-05-30 14:24:34 -07:00
Andrew Armbruster
c7df7be7f1 Catch rejected Promise on failed fullscreen request
Add a `catch()` rejection of request for fullscreen (standard Fullscreen API implementation), as well as fullscreen exit. For now there is no actual handling, but we send a message to the internal error channel.

Motivation: The fullscreen request was causing certain tests to fail when run with newer versions of QUnit (starting in 2.5.0), which now fails tests that have unhandled Promise rejections (as we did here).

The exit case is not currently covered by tests, but works the same way (also returns a promise).

See: https://fullscreen.spec.whatwg.org/#ref-for-dom-element-requestfullscreen%E2%91%A0
2023-05-28 14:15:55 +02:00
Andrew Armbruster
ff67cf1cae Support ES6 Syntax
Bump ESLint's parser options to support ES6 syntax, which allows developers to start using a number of features associated with modern JavaScript.

Doing this now that #2286 has been marked as resolved, since IE 11 support was the last known blocker for such changes.
2023-05-28 12:41:30 +02:00
Andrew A
ad1179b9db Update to most recent QUnit
Update to most recent version of QUnit, which has been published under a new name for a while now.

Accordingly, replace the old package with the new one in both dependencies, as well as update references in test HTML files.
2023-05-27 13:16:28 +02:00
8 changed files with 100 additions and 6641 deletions

View File

@ -6,11 +6,11 @@
"plugin:compat/recommended"
],
"env": {
"es6": false,
"es6": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": 5,
"ecmaVersion": 6,
"sourceType": "script",
"ecmaFeatures": {
"globalReturn": false,

View File

@ -3,7 +3,7 @@ OPENSEADRAGON CHANGELOG
5.0.0: (in progress...)
* BREAKING CHANGE: Dropped support for IE11 (#2300 @AndrewADev)
* BREAKING CHANGE: Dropped support for IE11 (#2300, #2361 @AndrewADev)
4.1.0:

6711
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@
"grunt-git-describe": "^2.4.4",
"grunt-istanbul": "^0.8.0",
"grunt-text-replace": "^0.4.0",
"qunitjs": "2.4.1"
"qunit": "^2.19.4"
},
"scripts": {
"test": "grunt test",

View File

@ -67,10 +67,14 @@
return document.fullscreenElement;
};
fullScreenApi.requestFullScreen = function( element ) {
return element.requestFullscreen();
return element.requestFullscreen().catch(function (msg) {
$.console.error('Fullscreen request failed: ', msg);
});
};
fullScreenApi.exitFullScreen = function() {
document.exitFullscreen();
document.exitFullscreen().catch(function (msg) {
$.console.error('Error while exiting fullscreen: ', msg);
});
};
fullScreenApi.fullScreenEventName = "fullscreenchange";
fullScreenApi.fullScreenErrorEventName = "fullscreenerror";

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>OpenSeadragon QUnit</title>
<link rel="stylesheet" href="/node_modules/qunitjs/qunit/qunit.css">
<link rel="stylesheet" href="/node_modules/qunit/qunit/qunit.css">
<link rel="stylesheet" href="/test/lib/jquery-ui-1.10.2/css/smoothness/jquery-ui-1.10.2.min.css">
<link rel="stylesheet" href="/test/helpers/test.css">
</head>
@ -15,7 +15,7 @@
var isCoverageTest = true;
</script>
<script src="/node_modules/qunitjs/qunit/qunit.js"></script>
<script src="/node_modules/qunit/qunit/qunit.js"></script>
<script src="/test/lib/jquery-1.9.1.min.js"></script>
<script src="/test/lib/jquery-ui-1.10.2/js/jquery-ui-1.10.2.min.js"></script>
<script src="/test/lib/jquery.simulate.js"></script>

View File

@ -224,7 +224,7 @@
});
QUnit.test('FullScreen', function(assert) {
var done = assert.async();
const done = assert.async();
if (!OpenSeadragon.supportsFullScreen) {
assert.expect(0);
done();
@ -234,7 +234,7 @@
viewer.addHandler("open", function () {
assert.ok(!OpenSeadragon.isFullScreen(), 'Started out not fullscreen');
var checkEnteringPreFullScreen = function(event) {
const checkEnteringPreFullScreen = function(event) {
viewer.removeHandler('pre-full-screen', checkEnteringPreFullScreen);
assert.ok(event.fullScreen, 'Switching to fullscreen');
assert.ok(!OpenSeadragon.isFullScreen(), 'Not yet fullscreen');
@ -242,7 +242,7 @@
// The fullscreen mode is always denied during tests so we are
// exiting directly.
var checkExitingFullScreen = function(event) {
const checkExitingFullScreen = function(event) {
viewer.removeHandler('full-screen', checkExitingFullScreen);
assert.ok(!event.fullScreen, 'Exiting fullscreen');
assert.ok(!OpenSeadragon.isFullScreen(), 'Disabled fullscreen');

View File

@ -3,14 +3,14 @@
<head>
<meta charset="utf-8">
<title>OpenSeadragon QUnit</title>
<link rel="stylesheet" href="/node_modules/qunitjs/qunit/qunit.css">
<link rel="stylesheet" href="/node_modules/qunit/qunit/qunit.css">
<link rel="stylesheet" href="/test/lib/jquery-ui-1.10.2/css/smoothness/jquery-ui-1.10.2.min.css">
<link rel="stylesheet" href="/test/helpers/test.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="/node_modules/qunitjs/qunit/qunit.js"></script>
<script src="/node_modules/qunit/qunit/qunit.js"></script>
<script src="/test/lib/jquery-1.9.1.min.js"></script>
<script src="/test/lib/jquery-ui-1.10.2/js/jquery-ui-1.10.2.min.js"></script>
<script src="/test/lib/jquery.simulate.js"></script>