Skip to content

Commit

Permalink
Renovation: Enable all constellations QUnit for pager (#16675)
Browse files Browse the repository at this point in the history
  • Loading branch information
vconst authored Mar 15, 2021
1 parent 1ed8467 commit df178b9
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 77 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/renovation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ jobs:
qunit-tests:
strategy:
fail-fast: true
matrix:
RENOVATION: [ true ]
BROWSER: [ google-chrome ]
CONSTEL: [ export, viz, renovation ]
# CONSTEL: [ export, misc, ui, ui.widgets, ui.editors, ui.grid, ui.scheduler, viz, renovation ]
# CONSTEL: [ export, viz, renovation ]
CONSTEL: [ export, misc, ui, ui.widgets, ui.editors, ui.grid, ui.scheduler, viz, renovation ]
JQUERY: [ jquery=3 ]

runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions js/bundles/modules/parts/renovation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// pathToWrapper should contains named export - WrapperWidget. WrapperWidget is predefined.
// Default export doesnt work
module.exports = [
{ name: 'Button', pathInRenovationFolder: 'ui/button.j', pathInJSFolder: 'ui/button.js' },
{ name: 'CheckBox', pathInRenovationFolder: 'ui/check_box.j', pathInJSFolder: 'ui/check_box.js' },
// { name: 'Button', pathInRenovationFolder: 'ui/button.j', pathInJSFolder: 'ui/button.js' },
// { name: 'CheckBox', pathInRenovationFolder: 'ui/check_box.j', pathInJSFolder: 'ui/check_box.js' },
// { name: 'Widget', pathInRenovationFolder: 'ui/widget.j' },
// { name: 'ScrollView', pathInRenovationFolder: 'ui/scroll_view/scroll_view.j', pathInJSFolder: 'ui/scroll_view.js' },
// { name: 'Scrollable', pathInRenovationFolder: 'ui/scroll_view/scrollable.j', pathInJSFolder: 'ui/scroll_view/ui.scrollable.js' },
Expand Down
12 changes: 6 additions & 6 deletions testing/helpers/renovationPagerHelper.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import $ from 'jquery';
import RenovatedPager from 'renovation/ui/pager/pager.j.js';
import resizeCallbacks from 'core/utils/resize_callbacks';
const $ = require('jquery');
const RenovatedPager = require('renovation/ui/pager/pager.j.js');
const resizeCallbacks = require('core/utils/resize_callbacks');

// eslint-disable-next-line spellcheck/spell-checker
import { rerender as reRender } from 'inferno';
const reRender = require('inferno').rerender;

// default export not supported
export class WrappedWidget extends RenovatedPager {
exports.WrappedWidget = class WrappedWidget extends RenovatedPager {

get _$pagesSizeChooser() {
return this._$element.find('.dx-page-sizes');
Expand Down Expand Up @@ -42,5 +42,5 @@ export class WrappedWidget extends RenovatedPager {
const currentIndex = pages.indexOf(page);
pages[currentIndex]._$page.trigger('dxclick');
}
}
};

6 changes: 3 additions & 3 deletions testing/helpers/wrapRenovatedWidget.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// eslint-disable-next-line spellcheck/spell-checker
import { rerender as reRender } from 'inferno';
const reRender = require('inferno').rerender;

function callMethod() {
const result = this.callBase.apply(this, arguments);
reRender();
return result;
}

export function wrapRenovatedWidget(renovatedWidget) {
exports.wrapRenovatedWidget = function wrapRenovatedWidget(renovatedWidget) {
const result = renovatedWidget.inherit({
ctor: function() {
return callMethod.apply(this, arguments);
Expand All @@ -25,4 +25,4 @@ export function wrapRenovatedWidget(renovatedWidget) {
result.getInstance = renovatedWidget.getInstance;
result.IS_RENOVATED_WIDGET = true;
return result;
}
};
10 changes: 6 additions & 4 deletions testing/tests/DevExpress.aspnet/aspnet_bundled.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ SystemJS.config({
'/testing/helpers/jQueryEventsPatch.js': { format: 'system' },
'/testing/helpers/ajaxMock.js': { format: 'cjs' },
'/testing/helpers/dataPatch.js': { format: 'system' },
'/artifacts/transpiled/aspnet.js': { format: 'global' }
'/testing/helpers/wrapRenovatedWidget.js': { format: 'cjs' },
'/testing/helpers/renovationPagerHelper.js': { format: 'cjs' },
'aspnet.js': { format: 'global' }
}
});

define(function(require) {
window.DevExpress_ui_widget_errors = require('/artifacts/transpiled/ui/widget/ui.errors');
window.DevExpress_ui_widget_errors = require('ui/widget/ui.errors');
window.ajaxMock = require('/testing/helpers/ajaxMock.js');
require('/artifacts/transpiled/bundles/dx.web.js');
require('/artifacts/transpiled/aspnet.js');
require('bundles/dx.web.js');
require('aspnet.js');
require('/testing/tests/DevExpress.aspnet/aspnet.tests.js');
});
2 changes: 1 addition & 1 deletion testing/tests/DevExpress.core/config_bundled.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ window.DevExpress = window.DevExpress || {};
window.DevExpress.config = { useJQuery: useJQuery };

define(function(require) {
require('/artifacts/transpiled/bundles/dx.all.js');
require('bundles/dx.all.js');

QUnit.module('config.useJQuery');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define(function(require) {
require('/artifacts/transpiled/bundles/dx.all.js');
require('bundles/dx.all.js');

QUnit.module('config.useJQuery');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,13 @@ QUnit.module('DataGrid markup', {
});

this.clock.tick(30);
const hasWindowOrRenovation = windowUtils.hasWindow() || QUnit.urlParams.renovation;
const $pagerView = $element.find('.dx-datagrid-pager');
assert.equal($pagerView.length, 1, 'pager view is rendered');
assert.ok($pagerView.hasClass('dx-pager'), 'pager is rendered');
assert.equal($pagerView.children().length, windowUtils.hasWindow() ? 2 : 1, 'pager content is rendered');
assert.equal($pagerView.find('.dx-pages .dx-page').length, windowUtils.hasWindow() ? 2 : 1, 'page size count');
assert.equal($pagerView.find('.dx-pages .dx-page').eq(0).text(), windowUtils.hasWindow() ? '1' : '', 'page size text');
assert.equal($pagerView.children().length, hasWindowOrRenovation ? 2 : 1, 'pager content is rendered');
assert.equal($pagerView.find('.dx-pages .dx-page').length, hasWindowOrRenovation ? 2 : 1, 'page size count');
assert.equal($pagerView.find('.dx-pages .dx-page').eq(0).text(), hasWindowOrRenovation ? '1' : '', 'page size text');
});

QUnit.test('markup with virtual columns', function(assert) {
Expand Down
34 changes: 0 additions & 34 deletions testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1747,40 +1747,6 @@ QUnit.module('Assign options', baseModuleConfig, () => {
assert.ok($('#dataGrid').find('.dx-datagrid-rowsview').height() > rowsViewHeight, 'rowsView height updated');
});

// T121445
QUnit.test('pager light-mode should be correct after change pageSize', function(assert) {
// arrange, act
const data = [];
for(let i = 0; i < 11; ++i) {
data.push({ value: i });
}
const dataGrid = createDataGrid({
width: 250,
loadingTimeout: undefined,
dataSource: data,
pager: {
allowedPageSizes: [2, 6],
showInfo: true,
showNavigationButtons: true,
showPageSizeSelector: true,
visible: true
},
paging: {
pageSize: 6
}
});

// assert
assert.notOk($('#dataGrid .dx-pager').hasClass('dx-light-mode'));

// act
dataGrid.option('paging.pageSize', 2);
dataGrid.option('paging.pageSize', 6);

// assert
assert.notOk($('#dataGrid .dx-pager').hasClass('dx-light-mode'), 'is not light-mode');
});

// T120699
QUnit.test('showRowLines/showColumnLines change', function(assert) {
// arrange, act
Expand Down
39 changes: 19 additions & 20 deletions testing/tests/DevExpress.ui.widgets/pager.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ QUnit.module('Pager', {
function() {
const isRenovation = !!Pager.IS_RENOVATED_WIDGET;
const getPagesElement = function(rootElement) {
return rootElement.find(isRenovation ? '.dx-page-indexies' : '.dx-pages')[0].childNodes;
return rootElement.find(isRenovation ? '.dx-page-indexes' : '.dx-pages')[0].childNodes;
};
QUnit.test('Default options init', function(assert) {
const $pager = $('#container').dxPager();
Expand Down Expand Up @@ -1321,27 +1321,26 @@ function() {
assert.equal(isLightMode(pager), true, 'lightModeEnabled is enabled');
});

if(!isRenovation) {
QUnit.test('Pager is rendered in a normal view after light mode when pageCount is changed', function(assert) {
const $pager = $('#container').width(460).dxPager({
maxPagesCount: 10,
pageCount: 5,
pageSize: 8,
pageSizes: [5, 8, 15, 30],
showInfo: true,
totalCount: 40,
infoText: 'Page {0} of {1} ({2} items)',
pagesCountText: 'of',
showNavigationButtons: true
});
const pager = $pager.dxPager('instance');
QUnit.test('Pager is rendered in a normal view after light mode when pageCount is changed', function(assert) {
const $pager = $('#container').width(460).dxPager({
maxPagesCount: 10,
pageCount: 5,
pageSize: 8,
pageSizes: [5, 8, 15, 30],
showInfo: true,
totalCount: 40,
infoText: 'Page {0} of {1} ({2} items)',
pagesCountText: 'of',
showNavigationButtons: true
});
const pager = $pager.dxPager('instance');

pager.option({ pageCount: 10, pageIndexChanged: commonUtils.noop });
pager.option({ pageCount: 5, pageIndexChanged: commonUtils.noop });
pager.option({ pageCount: 10, pageIndexChanged: commonUtils.noop });
pager.option({ pageCount: 5, pageIndexChanged: commonUtils.noop });

assert.strictEqual(isLightMode(pager), isRenovation, `pager is ${isRenovation ? '' : 'not'} displayed in the light mode for pager`);
});

assert.ok(!isLightMode(pager), 'pager is not displayed in the light mode');
});
}
QUnit.test('Light mode is applied only one', function(assert) {
const $pager = $('#container').width(1000).dxPager({
maxPagesCount: 8,
Expand Down
3 changes: 2 additions & 1 deletion testing/tests/Renovation/compatibility.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import 'ui/pager';
* List of registered jQuery widgets which were created only to be used from old DevExtreme code
*/
const PRIVATE_JQUERY_WIDGETS = [
'Widget',
'TimePanelTableLayout', 'GroupPanel', 'HeaderPanelLayout', 'TimelineHeaderPanelLayout',
'DayDateTableLayout', 'WeekTableLayout', 'TimelineDateTableLayout',
'AllDayPanelLayout', 'AllDayPanelTitle', 'MonthDateTableLayout',
'GridPager', 'Scrollable',
];
const INPROGRESS_WIDGETS = ['Widget', 'ScrollView', 'DataGrid', 'Bullet'];
const INPROGRESS_WIDGETS = ['Button', 'CheckBox', 'ScrollView', 'DataGrid', 'Bullet'];
const CUSTOM_ROOT_WIDGET_CLASS = { 'dxGridPager': 'datagrid-pager', 'dxDataGrid': 'widget' };

const widgetsInBundle = publicWidgets.map(widget => widget.name);
Expand Down

0 comments on commit df178b9

Please sign in to comment.