Merge pull request #2382 from AndrewADev/update-grunt-contrib-qunit

Update grunt-contrib-qunit and extend FullScreen test
This commit is contained in:
Ian Gilman 2023-07-17 14:02:02 -07:00 committed by GitHub
commit eec052f054
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 580 additions and 172 deletions

View File

@ -161,9 +161,12 @@ module.exports = function(grunt) {
normal: { normal: {
options: { options: {
urls: [ "http://localhost:8000/test/test.html" ], urls: [ "http://localhost:8000/test/test.html" ],
timeout: 10000 timeout: 10000,
puppeteer: {
headless: 'new'
} }
}, },
},
coverage: { coverage: {
options: { options: {
urls: [ "http://localhost:8000/test/coverage.html" ], urls: [ "http://localhost:8000/test/coverage.html" ],

714
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,7 @@
"grunt-contrib-compress": "^2.0.0", "grunt-contrib-compress": "^2.0.0",
"grunt-contrib-concat": "^2.1.0", "grunt-contrib-concat": "^2.1.0",
"grunt-contrib-connect": "^3.0.0", "grunt-contrib-connect": "^3.0.0",
"grunt-contrib-qunit": "^6.2.0", "grunt-contrib-qunit": "^7.0.1",
"grunt-contrib-uglify": "^5.0.1", "grunt-contrib-uglify": "^5.0.1",
"grunt-contrib-watch": "^1.1.0", "grunt-contrib-watch": "^1.1.0",
"grunt-eslint": "^24.0.1", "grunt-eslint": "^24.0.1",

View File

@ -231,25 +231,36 @@
return; return;
} }
viewer.addHandler("open", function () { viewer.addHandler('open', function () {
assert.ok(!OpenSeadragon.isFullScreen(), 'Started out not fullscreen'); assert.ok(!OpenSeadragon.isFullScreen(), 'Started out not fullscreen');
const checkEnteringPreFullScreen = function(event) { const checkEnteringPreFullScreen = (event) => {
viewer.removeHandler('pre-full-screen', checkEnteringPreFullScreen); viewer.removeHandler('pre-full-screen', checkEnteringPreFullScreen);
assert.ok(event.fullScreen, 'Switching to fullscreen'); assert.ok(event.fullScreen, 'Switching to fullscreen');
assert.ok(!OpenSeadragon.isFullScreen(), 'Not yet fullscreen'); assert.ok(!OpenSeadragon.isFullScreen(), 'Not yet fullscreen');
}; };
// The fullscreen mode is always denied during tests so we are const checkExitingFullScreen = (event) => {
// exiting directly.
const checkExitingFullScreen = function(event) {
viewer.removeHandler('full-screen', checkExitingFullScreen); viewer.removeHandler('full-screen', checkExitingFullScreen);
assert.ok(!event.fullScreen, 'Exiting fullscreen'); assert.ok(!event.fullScreen, 'Disabling fullscreen');
assert.ok(!OpenSeadragon.isFullScreen(), 'Disabled fullscreen'); assert.ok(!OpenSeadragon.isFullScreen(), 'Fullscreen disabled');
done(); done();
}
// The 'new' headless mode allows us to enter fullscreen, so verify
// that we see the correct values returned. We will then close out
// of fullscreen to check the same values when exiting.
const checkAcquiredFullScreen = (event) => {
viewer.removeHandler('full-screen', checkAcquiredFullScreen);
viewer.addHandler('full-screen', checkExitingFullScreen);
assert.ok(event.fullScreen, 'Acquired fullscreen');
assert.ok(OpenSeadragon.isFullScreen(), 'Fullscreen enabled');
viewer.setFullScreen(false);
}; };
viewer.addHandler("pre-full-screen", checkEnteringPreFullScreen);
viewer.addHandler("full-screen", checkExitingFullScreen);
viewer.addHandler('pre-full-screen', checkEnteringPreFullScreen);
viewer.addHandler('full-screen', checkAcquiredFullScreen);
viewer.setFullScreen(true); viewer.setFullScreen(true);
}); });