Skip to content

Commit 4789960

Browse files
committed
added looping back test
1 parent c811946 commit 4789960

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

packages/devextreme/testing/tests/DevExpress.ui.widgets/tabPanel.tests.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,10 +1137,31 @@ QUnit.module('keyboard navigation', {
11371137
this.$element.trigger(keyDownEvent);
11381138
assert.strictEqual(this.instance.option('loop'), true, 'loop option is set to true');
11391139

1140-
assert.strictEqual(currentTheme(), 'generic.light', 'theme is generic.light');
11411140
assert.strictEqual(this.instance.option('selectedIndex'), 0, 'loop comes back to first element');
11421141
});
11431142

1143+
QUnit.test('2nd looping should work on keyboard navigation after loop runtime change to true and swipe', function(assert) {
1144+
this.instance.option({
1145+
items: [1, 2, 3],
1146+
loop: true,
1147+
swipeEnabled: true,
1148+
});
1149+
// this.instance.option('loop', true);
1150+
const pointer = pointerMock(this.$element);
1151+
const keyDownEvent = $.Event('keydown', { key: 'ArrowLeft' });
1152+
1153+
pointer.start().swipeStart().swipe(-0.5).swipeEnd(-1);
1154+
assert.strictEqual(this.instance.option('selectedIndex'), 1, 'at second element after swipe');
1155+
1156+
this.$element.trigger(keyDownEvent);
1157+
assert.strictEqual(this.instance.option('selectedIndex'), 0, 'at first element after first keydown');
1158+
1159+
this.$element.trigger(keyDownEvent);
1160+
assert.strictEqual(this.instance.option('loop'), true, 'loop option is set to true');
1161+
1162+
assert.strictEqual(this.instance.option('selectedIndex'), 2, 'loop goess back to last element');
1163+
});
1164+
11441165
const createWidget = ($element) => {
11451166
const widget = $element.dxTabPanel({
11461167
focusStateEnabled: true,

0 commit comments

Comments
 (0)