Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagram - fix server-side rendering test #11913

Merged
merged 1 commit into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion js/ui/diagram/ui.diagram.toolbox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import $ from '../../core/renderer';
import { Deferred } from '../../core/utils/deferred';
import { hasWindow } from '../../core/utils/window';
import Widget from '../widget/ui.widget';
import Popup from '../popup';
import TextBox from '../text_box';
Expand Down Expand Up @@ -30,14 +31,15 @@ class DiagramToolbox extends Widget {
const that = this;
const $parent = this.$element();

const popupHeight = hasWindow() ? $parent.height() - 2 * DIAGRAM_TOOLBOX_SPACING : 200;
const $popupElement = $('<div>')
.addClass(DIAGRAM_TOOLBOX_POPUP_CLASS)
.appendTo($parent);

this._popupInstance = this._createComponent($popupElement, Popup, {
animation: null,
width: DIAGRAM_TOOLBOX_POPUP_WIDTH,
height: $parent.height() - 2 * DIAGRAM_TOOLBOX_SPACING,
height: popupHeight,
position: {
my: 'left top',
at: 'left top',
Expand Down
30 changes: 30 additions & 0 deletions testing/tests/DevExpress.serverSide/diagram.tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import $ from 'jquery';
import 'ui/diagram';
import 'common.css!';

QUnit.testStart(function() {
const markup =
'<div id="widget"></div>';

$('#qunit-fixture').html(markup);
});

const DIAGRAM_CLASS = 'dx-diagram';
const DIAGRAM_CORE_CLASS = 'dxdi-control';

QUnit.module('rendering', {
beforeEach: function() {
this.element = $('<div></div>').appendTo('body');
},
afterEach: function() {
this.element.remove();
}
}, () => {
QUnit.test('base elements should be rendered correctly', function(assert) {
const $element = this.element.dxDiagram();

assert.ok($element.hasClass(DIAGRAM_CLASS), 'Element has a widget-specific class');
assert.equal($element.find('.' + DIAGRAM_CORE_CLASS).length, 0, 'Diagram core must not be created in server-side');
});
});