diff --git a/app/embeds/Mindmeister.js b/app/embeds/Mindmeister.js new file mode 100644 index 00000000..7bbb3f4f --- /dev/null +++ b/app/embeds/Mindmeister.js @@ -0,0 +1,29 @@ +// @flow +import * as React from 'react'; +import Frame from './components/Frame'; + +const URL_REGEX = new RegExp( + '^https://([w.-]+.)?mindmeister.com(/maps/public_map_shell)?/(\\d+)(/.*)?$' +); + +type Props = { + url: string, + matches: string[], +}; + +export default class Mindmeister extends React.Component { + static ENABLED = [URL_REGEX]; + + render() { + console.log(this.props.matches); + const chartId = this.props.matches[3]; + + return ( + + ); + } +} diff --git a/app/embeds/Mindmeister.test.js b/app/embeds/Mindmeister.test.js new file mode 100644 index 00000000..0626df93 --- /dev/null +++ b/app/embeds/Mindmeister.test.js @@ -0,0 +1,40 @@ +/* eslint-disable flowtype/require-valid-file-annotation */ +import embeds from '.'; + +const { Mindmeister } = embeds; + +describe('Mindmeister', () => { + const match = Mindmeister.ENABLED[0]; + test('to be enabled on embed link', () => { + expect( + 'https://www.mindmeister.com/maps/public_map_shell/326377934/paper-digital-or-online-mind-mapping'.match( + match + ) + ).toBeTruthy(); + }); + + test('to be enabled on public link', () => { + expect( + 'https://www.mindmeister.com/326377934/paper-digital-or-online-mind-mapping'.match( + match + ) + ).toBeTruthy(); + }); + + test('to be enabled without www', () => { + expect( + 'https://mindmeister.com/326377934/paper-digital-or-online-mind-mapping'.match( + match + ) + ).toBeTruthy(); + }); + + test('to be enabled without slug', () => { + expect('https://mindmeister.com/326377934'.match(match)).toBeTruthy(); + }); + + test('to not be enabled elsewhere', () => { + expect('https://mindmeister.com'.match(match)).toBe(null); + expect('https://www.mindmeister.com/pricing'.match(match)).toBe(null); + }); +}); diff --git a/app/embeds/index.js b/app/embeds/index.js index dc2fdd9b..5bff86bf 100644 --- a/app/embeds/index.js +++ b/app/embeds/index.js @@ -9,6 +9,7 @@ import InVision from './InVision'; import Loom from './Loom'; import Lucidchart from './Lucidchart'; import Marvel from './Marvel'; +import Mindmeister from './Mindmeister'; import ModeAnalytics from './ModeAnalytics'; import Numeracy from './Numeracy'; import Prezi from './Prezi'; @@ -30,6 +31,7 @@ export default { Loom, Lucidchart, Marvel, + Mindmeister, ModeAnalytics, Numeracy, Prezi,