mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed keyboard navigation for dialog tabs. Fixes #3862
This commit is contained in:
committed by
Akshay Joshi
parent
3e7381414f
commit
f731ab730b
@@ -14,10 +14,10 @@ describe('dialogTabNavigator', function () {
|
||||
let dialog, tabNavigator, backward_shortcut, forward_shortcut;
|
||||
|
||||
beforeEach(() => {
|
||||
let dialogHtml =$('<div tabindex="1" class="backform-tab" role="tabpanel">'+
|
||||
dialog = $('<div tabindex="1" class="backform-tab" role="tabpanel">'+
|
||||
' <ul class="nav nav-tabs" role="tablist">'+
|
||||
' <li role="presentation" class="active">'+
|
||||
' <a data-toggle="tab" tabindex="-1" data-tab-index="1" href="#1" aria-controls="1"> General</a>'+
|
||||
' <li role="presentation">'+
|
||||
' <a class="active" data-toggle="tab" tabindex="-1" data-tab-index="1" href="#1" aria-controls="1"> General</a>'+
|
||||
' </li>'+
|
||||
' <li role="presentation">'+
|
||||
' <a data-toggle="tab" tabindex="-1" data-tab-index="5" href="#2" aria-controls="2"> Default Privileges</a>'+
|
||||
@@ -52,11 +52,6 @@ describe('dialogTabNavigator', function () {
|
||||
' </ul>'+
|
||||
'</div>');
|
||||
|
||||
dialog = {};
|
||||
|
||||
dialog.el = dialogHtml[0];
|
||||
dialog.$el = dialogHtml;
|
||||
|
||||
backward_shortcut = {
|
||||
'alt': false,
|
||||
'shift': true,
|
||||
@@ -112,4 +107,93 @@ describe('dialogTabNavigator', function () {
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('navigateForward from fist tab to second tab', function () {
|
||||
var navigateForwardResult;
|
||||
beforeEach(() => {
|
||||
spyOn(tabNavigator, 'navigateForward').and.callThrough();
|
||||
|
||||
navigateForwardResult = tabNavigator.navigateForward(
|
||||
dialog.find('ul.nav-tabs:first'),
|
||||
dialog.find('div#1')
|
||||
);
|
||||
});
|
||||
|
||||
it('should return true', function () {
|
||||
|
||||
expect(navigateForwardResult).toEqual(true);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('navigateForward from last tab', function () {
|
||||
var navigateForwardResult;
|
||||
beforeEach(() => {
|
||||
|
||||
// set second tab active
|
||||
dialog.find('ul.nav-tabs li a.active').removeClass('active');
|
||||
|
||||
dialog.find('ul.nav-tabs li a[href="#3"]').addClass('active');
|
||||
|
||||
spyOn(tabNavigator, 'navigateForward').and.callThrough();
|
||||
|
||||
navigateForwardResult = tabNavigator.navigateForward(
|
||||
dialog.find('ul.nav-tabs:first'),
|
||||
dialog.find('div#1')
|
||||
);
|
||||
});
|
||||
|
||||
it('should return false', function () {
|
||||
|
||||
expect(navigateForwardResult).toEqual(false);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('navigateBackward from second tab to first tab', function () {
|
||||
var navigateBackwardResult;
|
||||
beforeEach(() => {
|
||||
// set second tab active
|
||||
dialog.find('ul.nav-tabs li a.active').removeClass('active');
|
||||
|
||||
dialog.find('ul.nav-tabs li a[href="#2"]').addClass('active');
|
||||
|
||||
spyOn(tabNavigator, 'navigateBackward').and.callThrough();
|
||||
|
||||
navigateBackwardResult = tabNavigator.navigateBackward(
|
||||
dialog.find('ul.nav-tabs:first'),
|
||||
dialog.find('div#1')
|
||||
);
|
||||
});
|
||||
|
||||
it('should return true', function () {
|
||||
|
||||
expect(navigateBackwardResult).toEqual(true);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('navigateBackward from first tab', function () {
|
||||
var navigateBackwardResult;
|
||||
beforeEach(() => {
|
||||
spyOn(tabNavigator, 'navigateBackward').and.callThrough();
|
||||
|
||||
navigateBackwardResult = tabNavigator.navigateBackward(
|
||||
dialog.find('ul.nav-tabs:first'),
|
||||
dialog.find('div#1')
|
||||
);
|
||||
});
|
||||
|
||||
it('should return false', function () {
|
||||
|
||||
expect(navigateBackwardResult).toEqual(false);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user