chore(tests): add diagram.css during tests
This commit is contained in:
parent
aca1ea21e9
commit
5df579bd02
|
@ -182,3 +182,31 @@ function inject(fn) {
|
|||
module.exports.bootstrapModeler = (window || global).bootstrapModeler = bootstrapModeler;
|
||||
module.exports.bootstrapViewer = (window || global).bootstrapViewer = bootstrapViewer;
|
||||
module.exports.inject = (window || global).inject = inject;
|
||||
|
||||
|
||||
function insertCSS(name, css) {
|
||||
if (document.querySelector('[data-css-file="' + name + '"]')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var head = document.head || document.getElementsByTagName('head')[0],
|
||||
style = document.createElement('style');
|
||||
style.setAttribute('data-css-file', name);
|
||||
|
||||
style.type = 'text/css';
|
||||
if (style.styleSheet) {
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
|
||||
head.appendChild(style);
|
||||
}
|
||||
|
||||
module.exports.insertCSS = insertCSS;
|
||||
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
// insert diagram.css
|
||||
insertCSS('diagram.css', fs.readFileSync(__dirname + '/../node_modules/diagram-js/assets/diagram.css', 'utf-8'));
|
Loading…
Reference in New Issue