From 85d4795054b883bc4a3b31a9254cfd862247b96b Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Tue, 25 Aug 2026 16:00:01 -0600 Subject: [PATCH 1/2] Fix menu background image lost at extra large screen sizes after migration (fixes #244) --- migrations/v6.js | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/migrations/v6.js b/migrations/v6.js index cb16db9..50fdc1c 100644 --- a/migrations/v6.js +++ b/migrations/v6.js @@ -137,7 +137,8 @@ describe('Box menu - v6.3.8 to v6.3.9', async () => { mutateContent('Box menu - add _xlarge attribute', async (content) => { menusWithBgImage.forEach(({ _boxMenu }) => { if (!_.has(_boxMenu, '_backgroundImage')) return true; - _boxMenu._backgroundImage._xlarge = ''; + // carry _large over so existing backgrounds survive at the new xlarge breakpoint + _boxMenu._backgroundImage._xlarge = _boxMenu._backgroundImage._large ?? ''; }); return true; }); @@ -145,23 +146,32 @@ describe('Box menu - v6.3.8 to v6.3.9', async () => { mutateContent('Box menu - add _xlarge attribute to _menuHeader', async (content) => { menusWithBgImage.forEach(({ _boxMenu }) => { if (!_.has(_boxMenu, '_menuHeader._backgroundImage')) return true; - _boxMenu._menuHeader._backgroundImage._xlarge = ''; + // carry _large over so existing backgrounds survive at the new xlarge breakpoint + _boxMenu._menuHeader._backgroundImage._xlarge = _boxMenu._menuHeader._backgroundImage._large ?? ''; }); return true; }); checkContent('Box menu - check _xlarge attribute', async (content) => { - const isValid = menusWithBgImage.every(({ _boxMenu }) => ( - !_boxMenu._backgroundImage || _boxMenu._backgroundImage._xlarge === '' - )); + const isValid = menusWithBgImage.every(({ _boxMenu }) => { + const backgroundImage = _boxMenu._backgroundImage; + if (!backgroundImage) return true; + if (typeof backgroundImage._xlarge !== 'string') return false; + // a populated _large must have been carried over, not blanked + return !backgroundImage._large || backgroundImage._xlarge === backgroundImage._large; + }); if (!isValid) throw new Error('Box menu - course attribute _xlarge'); return true; }); checkContent('Box menu - check _xlarge attribute for _menuHeader', async (content) => { - const isValid = menusWithBgImage.every(({ _boxMenu }) => ( - !_boxMenu._menuHeader?._backgroundImage || _boxMenu._menuHeader._backgroundImage._xlarge === '' - )); + const isValid = menusWithBgImage.every(({ _boxMenu }) => { + const backgroundImage = _boxMenu._menuHeader?._backgroundImage; + if (!backgroundImage) return true; + if (typeof backgroundImage._xlarge !== 'string') return false; + // a populated _large must have been carried over, not blanked + return !backgroundImage._large || backgroundImage._xlarge === backgroundImage._large; + }); if (!isValid) throw new Error('Box menu - course attribute _xlarge'); return true; }); @@ -185,6 +195,20 @@ describe('Box menu - v6.3.8 to v6.3.9', async () => { ] }); + testSuccessWhere('boxMenu with populated _large carried over to _xlarge', { + fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '6.3.8' }], + content: [ + { + _type: 'course', + _boxMenu: { + _backgroundImage: { _large: 'menu-lg.jpg', _medium: 'menu-md.jpg', _small: 'menu-sm.jpg' }, + _menuHeader: { _backgroundImage: { _large: 'hdr-lg.jpg', _medium: 'hdr-md.jpg', _small: 'hdr-sm.jpg' } } + } + }, + { _type: 'menu', _boxMenu: { _backgroundImage: { _large: 'sub-lg.jpg', _medium: '', _small: '' } } } + ] + }); + testStopWhere('boxMenu with empty course', { fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '6.3.8' }], content: [ From 6c2b5e85c76afa39d7cf0260818044a88125ea6b Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Tue, 25 Aug 2026 16:04:52 -0600 Subject: [PATCH 2/2] Fix stray quote in migration framework versions --- migrations/v2.js | 2 +- migrations/v4.js | 2 +- migrations/v6.js | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/migrations/v2.js b/migrations/v2.js index 7eefc90..638cfd0 100644 --- a/migrations/v2.js +++ b/migrations/v2.js @@ -28,7 +28,7 @@ describe('Box menu - v2.0.2 to v2.0.3', async () => { return true; }); - updatePlugin('Box menu - update to v2.0.3', { name: 'adapt-contrib-boxMenu', version: '2.0.3', framework: '">=2.0.0' }); + updatePlugin('Box menu - update to v2.0.3', { name: 'adapt-contrib-boxMenu', version: '2.0.3', framework: '>=2.0.0' }); testSuccessWhere('boxMenu with empty course', { fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '2.0.2' }], diff --git a/migrations/v4.js b/migrations/v4.js index 6b65ed9..c23ad38 100644 --- a/migrations/v4.js +++ b/migrations/v4.js @@ -49,7 +49,7 @@ describe('Box menu - v3.0.0 to v4.0.0', async () => { return true; }); - updatePlugin('Box menu - update to v4.0.0', { name: 'adapt-contrib-boxMenu', version: '4.0.0', framework: '">=4' }); + updatePlugin('Box menu - update to v4.0.0', { name: 'adapt-contrib-boxMenu', version: '4.0.0', framework: '>=4' }); testStopWhere('boxMenu with empty course', { fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '3.0.0' }], diff --git a/migrations/v6.js b/migrations/v6.js index 50fdc1c..8533920 100644 --- a/migrations/v6.js +++ b/migrations/v6.js @@ -36,7 +36,7 @@ describe('Box menu - v6.0.2 to v6.1.0', async () => { return true; }); - updatePlugin('Box menu - update to v6.1.0', { name: 'adapt-contrib-boxMenu', version: '6.1.0', framework: '">=5.22.6' }); + updatePlugin('Box menu - update to v6.1.0', { name: 'adapt-contrib-boxMenu', version: '6.1.0', framework: '>=5.22.6' }); testSuccessWhere('boxMenu with course/menu _boxMenu._menuHeader', { fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '6.0.2' }], @@ -94,7 +94,7 @@ describe('Box menu - v6.2.0 to v6.2.1', async () => { return true; }); - updatePlugin('Box menu - update to v6.2.1', { name: 'adapt-contrib-boxMenu', version: '6.2.1', framework: '">=5.24.2' }); + updatePlugin('Box menu - update to v6.2.1', { name: 'adapt-contrib-boxMenu', version: '6.2.1', framework: '>=5.24.2' }); testSuccessWhere('boxMenu with course _boxMenu', { fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '6.2.0' }], @@ -176,7 +176,7 @@ describe('Box menu - v6.3.8 to v6.3.9', async () => { return true; }); - updatePlugin('Box menu - update to v6.3.9', { name: 'adapt-contrib-boxMenu', version: '6.3.9', framework: '">=5.24.2' }); + updatePlugin('Box menu - update to v6.3.9', { name: 'adapt-contrib-boxMenu', version: '6.3.9', framework: '>=5.24.2' }); testSuccessWhere('boxMenu with course._boxMenu._backgroundImage', { fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '6.3.8' }], @@ -255,7 +255,7 @@ describe('Box menu - v6.3.9 to v6.3.10', async () => { return true; }); - updatePlugin('Box menu - update to v6.3.10', { name: 'adapt-contrib-boxMenu', version: '6.3.10', framework: '">=5.24.2' }); + updatePlugin('Box menu - update to v6.3.10', { name: 'adapt-contrib-boxMenu', version: '6.3.10', framework: '>=5.24.2' }); testSuccessWhere('boxMenu with empty course', { fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '6.3.9' }],