diff --git a/src/main/Embeddable.js b/src/main/Embeddable.js
index b63c931..c09b5e3 100644
--- a/src/main/Embeddable.js
+++ b/src/main/Embeddable.js
@@ -8,6 +8,7 @@ export default class Embeddable extends React.Component {
let seatsio = await this.getSeatsio();
let {id, className, onRenderStarted, ...config} = this.props;
config.divId = this.props.id;
+ config.chartJsUrl = this.props.chartJsUrl;
let chart = this.createChart(seatsio, config).render();
this.chart = chart;
if (this.props.onRenderStarted) this.props.onRenderStarted(chart);
@@ -31,7 +32,7 @@ export default class Embeddable extends React.Component {
let script = document.createElement('script');
script.onload = () => resolve(seatsio);
script.onerror = () => reject(`Could not load ${script.src}`);
- script.src = 'https://cdn.seatsio.net/chart.js';
+ script.src = this.props.chartJsUrl;
document.head.appendChild(script);
});
}
@@ -44,5 +45,6 @@ export default class Embeddable extends React.Component {
}
Embeddable.defaultProps = {
- id: 'chart'
+ id: 'chart',
+ chartJsUrl: 'https://cdn.seatsio.net/chart.js'
};
\ No newline at end of file
diff --git a/src/test/SeatsioDesigner.test.js b/src/test/SeatsioDesigner.test.js
index 47a7d31..2c85bb7 100644
--- a/src/test/SeatsioDesigner.test.js
+++ b/src/test/SeatsioDesigner.test.js
@@ -27,28 +27,30 @@ describe("SeatsioDesigner", () => {
};
it('renders the designer', () => {
- let chart = mount((
+ let chart = mount(
- ));
+ );
expect(chart.find('div#chart').length).toEqual(1);
});
it('passes parameters onto the designer', () => {
return new Promise(resolve => {
- mount((
+ mount(
{
expect(chart.props).toEqual({
divId: 'someID',
- designerKey: 'aDesignerKey'
+ designerKey: 'aDesignerKey',
+ chartJsUrl: 'https://www.google.com'
});
resolve();
}}/>
- ));
+ );
});
});
diff --git a/src/test/SeatsioEventManager.test.js b/src/test/SeatsioEventManager.test.js
index b177cd6..f4e6372 100644
--- a/src/test/SeatsioEventManager.test.js
+++ b/src/test/SeatsioEventManager.test.js
@@ -41,10 +41,12 @@ describe("SeatsioEventManager", () => {
id="someID"
className="someClassName"
publicKey="aPublicKey"
+ chartJsUrl="https://www.google.com"
onRenderStarted={chart => {
expect(chart.props).toEqual({
divId: 'someID',
- publicKey: 'aPublicKey'
+ publicKey: 'aPublicKey',
+ chartJsUrl:"https://www.google.com"
});
resolve();
}}/>
diff --git a/src/test/SeatsioSeatingChart.test.js b/src/test/SeatsioSeatingChart.test.js
index e08f100..bc245b8 100644
--- a/src/test/SeatsioSeatingChart.test.js
+++ b/src/test/SeatsioSeatingChart.test.js
@@ -34,6 +34,21 @@ describe("SeatsioSeatingChart", () => {
expect(chart.find('div#chart').length).toEqual(1);
});
+ it('renders the chart with default properties', () => {
+ return new Promise(resolve => {
+ mount((
+ {
+ expect(chart.props).toEqual({
+ divId: "chart",
+ chartJsUrl:"https://cdn.seatsio.net/chart.js"
+ });
+ resolve();
+ }}/>
+ ));
+ });
+ });
+
it('renders the chart in a div with the specified ID', () => {
let chart = mount((
@@ -57,10 +72,12 @@ describe("SeatsioSeatingChart", () => {
id="someID"
className="someClassName"
publicKey="aPublicKey"
+ chartJsUrl="https://www.google.com"
onRenderStarted={chart => {
expect(chart.props).toEqual({
divId: 'someID',
- publicKey: 'aPublicKey'
+ publicKey: 'aPublicKey',
+ chartJsUrl:"https://www.google.com"
});
resolve();
}}/>