Unverified Commit aa404bef authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #769 from hypothesis/postmessage-config-fetch-setting

Add "requestConfigFromFrame" string setting
parents 87098dd8 d12659da
......@@ -24,6 +24,7 @@ function configFrom(window_) {
onLayoutChange: settings.hostPageSetting('onLayoutChange'),
openSidebar: settings.hostPageSetting('openSidebar', {allowInBrowserExt: true}),
query: settings.query,
requestConfigFromFrame: settings.hostPageSetting('requestConfigFromFrame'),
services: settings.hostPageSetting('services'),
showHighlights: settings.showHighlights,
sidebarAppUrl: settings.sidebarAppUrl,
......
......@@ -87,15 +87,17 @@ describe('annotator.config.index', function() {
[
'assetRoot',
'openSidebar',
'branding',
'openSidebar',
'requestConfigFromFrame',
'services',
].forEach(function(settingName) {
it('returns the ' + settingName + ' value from the host page', function() {
const settings = {
'assetRoot': 'chrome-extension://1234/client/',
'openSidebar': 'OPEN_SIDEBAR_SETTING',
'branding': 'BRANDING_SETTING',
'openSidebar': 'OPEN_SIDEBAR_SETTING',
'requestConfigFromFrame': 'https://embedder.com',
'services': 'SERVICES_SETTING',
};
fakeSettingsFrom().hostPageSetting = function(settingName) {
......
......@@ -35,6 +35,9 @@ function hostPageConfig(window) {
// This should be removed once new note button is enabled for everybody.
'enableExperimentalNewNoteButton',
// Fetch config from a parent frame.
'requestConfigFromFrame',
// Theme which can either be specified as 'clean'.
// If nothing is the specified the classic look is applied.
'theme',
......
......@@ -16,6 +16,7 @@ describe('hostPageConfig', function () {
annotations: '1234',
appType: 'bookmarklet',
openSidebar: true,
requestConfigFromFrame: 'https://embedder.com',
showHighlights: true,
services: [{
authority: 'hypothes.is',
......@@ -26,6 +27,7 @@ describe('hostPageConfig', function () {
annotations: '1234',
appType: 'bookmarklet',
openSidebar: true,
requestConfigFromFrame: 'https://embedder.com',
showHighlights: true,
services: [{
authority: 'hypothes.is',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment