-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from seatsio/add-designer-support
Add designer support
- Loading branch information
Showing
9 changed files
with
109 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Embeddable from "./Embeddable"; | ||
|
||
export default class SeatsioDesigner extends Embeddable { | ||
|
||
createChart(seatsio, config) { | ||
return new seatsio.SeatingChartDesigner(config); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export {default as SeatsioSeatingChart} from './SeatsioSeatingChart'; | ||
export {default as SeatsioEventManager} from './SeatsioEventManager'; | ||
export {default as SeatsioEventManager} from './SeatsioEventManager'; | ||
export {default as SeatsioDesigner} from './SeatsioDesigner'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from "react"; | ||
import Enzyme, {mount} from "enzyme"; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import {SeatsioDesigner} from "../main/index"; | ||
import Embeddable from "../main/Embeddable"; | ||
|
||
Enzyme.configure({adapter: new Adapter()}); | ||
|
||
describe("SeatsioDesigner", () => { | ||
|
||
let seatsioMock = { | ||
|
||
SeatingChartDesigner: class { | ||
|
||
constructor(props) { | ||
this.props = props; | ||
} | ||
|
||
render() { | ||
return this; | ||
} | ||
} | ||
}; | ||
|
||
Embeddable.prototype.loadSeatsio = () => { | ||
return Promise.resolve(seatsioMock); | ||
}; | ||
|
||
it('renders the designer', () => { | ||
let chart = mount(( | ||
<SeatsioDesigner/> | ||
)); | ||
|
||
expect(chart.find('div#chart').length).toEqual(1); | ||
}); | ||
|
||
it('passes parameters onto the designer', () => { | ||
return new Promise(resolve => { | ||
mount(( | ||
<SeatsioDesigner | ||
id="someID" | ||
className="someClassName" | ||
designerKey="aDesignerKey" | ||
onRenderStarted={chart => { | ||
expect(chart.props).toEqual({ | ||
divId: 'someID', | ||
designerKey: 'aDesignerKey' | ||
}); | ||
resolve(); | ||
}}/> | ||
)); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters