-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(element-templates-modal): get local and global element templates
Closes #2012
- Loading branch information
1 parent
155d7f0
commit 51620a4
Showing
4 changed files
with
88 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. | ||
* | ||
* Camunda licenses this file to you under the MIT; you may not use this file | ||
* except in compliance with the MIT License. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import TestRenderer from 'react-test-renderer'; | ||
|
||
import PluginsRoot from '../PluginsRoot'; | ||
|
||
|
||
describe('<PluginParent>', function() { | ||
|
||
it('should render', function() { | ||
createPluginsRoot(); | ||
}); | ||
|
||
|
||
it('should pass props to plugin', function() { | ||
createPluginsRoot({ | ||
plugins: [ | ||
props => { | ||
expect(props.triggerAction).to.exist; | ||
expect(props.config).to.exist; | ||
expect(props.getConfig).to.exist; | ||
expect(props.setConfig).to.exist; | ||
expect(props.subscribe).to.exist; | ||
expect(props.log).to.exist; | ||
expect(props.displayNotification).to.exist; | ||
expect(props._getGlobal).to.exist; | ||
|
||
return null; | ||
} | ||
] | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
// helpers ////////// | ||
|
||
function createPluginsRoot(props = {}) { | ||
const defaultProps = { | ||
app: new App(), | ||
plugins: [] | ||
}; | ||
|
||
return TestRenderer.create(<PluginsRoot { ...{ ...defaultProps, ...props } } />); | ||
} | ||
|
||
class App { | ||
getConfig = () => {} | ||
|
||
setConfig = () => {} | ||
|
||
getGlobal = name => { | ||
if (name === 'config') { | ||
return new Config(); | ||
} | ||
} | ||
|
||
triggerAction = () => {} | ||
} | ||
|
||
class Config { | ||
get = () => {} | ||
} |
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