diff --git a/karma.conf.js b/karma.conf.js index 2240f7a..6a563c9 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,5 +1,3 @@ -var process = require('process'); - module.exports = function (config) { var configuration = { frameworks: ['mocha'], diff --git a/test/integration/embed-integration.js b/test/integration/embed-integration.js index ea7eef2..bc06d73 100644 --- a/test/integration/embed-integration.js +++ b/test/integration/embed-integration.js @@ -1290,58 +1290,35 @@ describe('Integration - Embed', () => { }); }); - // describe('Editor config', () => { - // it('should fetch the viewer config', (done) => { - // var container = document.createElement('div'); - // document.body.appendChild(container); - - // var embed = new Flat.Embed(container, { - // score: PUBLIC_SCORE, - // baseUrl: BASE_URL, - // embedParams: { - // appId: APP_ID, - // controlsFloating: false, - // branding: false - // } - // }); - - // embed.getEmbedConfig().then((config) => { - // assert.equal(config.branding, false); - // assert.equal(config.controlsPlay, true); - // assert.equal(config.controlsFloating, false); - // container.parentNode.removeChild(container); - // done(); - // }); - // }); - - // it('should use the edit mode and set a tools config', (done) => { - // var container = document.createElement('div'); - // document.body.appendChild(container); - - // var embed = new Flat.Embed(container, { - // baseUrl: BASE_URL, - // embedParams: { - // appId: APP_ID, - // mode: 'edit', - // controlsFloating: false, - // branding: false - // } - // }); - - // embed.setEditorConfig({ - // noteMode: { - // durations: true, - // tuplet: false - // }, - // articulationMode: false - // }).then((config) => { - // assert.ok(config.global); - // assert.equal(config.articulationMode, false); - // assert.equal(config.noteMode.durations, true); - // assert.equal(config.noteMode.tuplet, false); - // container.parentNode.removeChild(container); - // done(); - // }).catch(done); - // }); - // }); + describe('getEmbedConfig', () => { + it('with layout and other config elements', async () => { + // Given + const container = document.createElement('div'); + document.body.appendChild(container); + const extraOpts = { + noHeader: true, + showTabRests: true, + layout: 'track', + hideTempo: true, + }; + + const embed = new Flat.Embed(container, { + baseUrl: BASE_URL, + score: QUARTET_SCORE, + embedParams: { + appId: APP_ID, + ...extraOpts, + }, + }); + + // When + const embedConfig = await embed.getEmbedConfig(); + + // Then + Object.entries(embedConfig).forEach(([key, expectedValue]) => { + const actualValue = embedConfig[key]; + assert.deepEqual(actualValue, expectedValue); + }); + }); + }); });