@@ -68,6 +74,7 @@ AnvilEmbedFrame.propTypes = {
onEvent: PropTypes.func,
anvilURL: PropTypes.string,
scroll: PropTypes.oneOf(['auto', 'smooth']),
+ style: PropTypes.object,
}
export default AnvilEmbedFrame
diff --git a/packages/anvil-embed-frame/test/src/index.test.js b/packages/anvil-embed-frame/test/src/index.test.js
index e3a5a7e..e4cb090 100644
--- a/packages/anvil-embed-frame/test/src/index.test.js
+++ b/packages/anvil-embed-frame/test/src/index.test.js
@@ -44,4 +44,20 @@ describe('AnvilEmbedFrame', function () {
expect($.handleEvent).to.have.been.calledWith(data)
})
})
+
+ it('calls postMessage successfully', () => {
+ const wrapper = $.render
+ const iframe = wrapper.find('iframe')
+ const postMessage = sinon.spy()
+ const iframeMock = {
+ contentWindow: {
+ postMessage,
+ },
+ }
+
+ iframe.getElement().ref.current = iframeMock
+
+ wrapper.instance().postMessage({ action: 'test' })
+ expect(postMessage.called).to.be.equal(true)
+ })
})
diff --git a/packages/anvil-embed-frame/types/index.d.ts b/packages/anvil-embed-frame/types/index.d.ts
index 6da62f4..58b6f21 100644
--- a/packages/anvil-embed-frame/types/index.d.ts
+++ b/packages/anvil-embed-frame/types/index.d.ts
@@ -13,6 +13,7 @@ export type Props = {
* @prop {String} anvilURL
* @prop {boolean} enableDefaultStyles
* @prop {String} scroll
+ * @prop {object} style
*/
/**
* @extends React.Component