Skip to content

Commit

Permalink
fix & test
Browse files Browse the repository at this point in the history
  • Loading branch information
pomahtri committed Oct 21, 2024
1 parent 8e2f9b1 commit fffa561
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 26 deletions.
76 changes: 51 additions & 25 deletions e2e/testcafe-devextreme/tests/scheduler/a11y/appointment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,57 @@ fixture.disablePageReloads`a11y - appointment`
],
});
});

test('appointments should have accessible info about reccurence', async (t) => {
const scheduler = new Scheduler('#container');
const recurrenceIcon = scheduler.getAppointment('Website Re-Design Plan').getRecurrenceElement();

await t
.expect(recurrenceIcon.getAttribute('aria-label'))
.eql('Recurring appointment');
}).before(async () => {
await createWidget('dxScheduler', {
timeZone: 'America/Los_Angeles',
dataSource: [
{
text: 'Website Re-Design Plan',
startDate: new Date('2021-04-29T16:30:00.000Z'),
endDate: new Date('2021-04-29T18:30:00.000Z'),
recurrenceRule: 'FREQ=WEEKLY;BYDAY=MO,TH;COUNT=10',
},
],
currentView,
currentDate: new Date(2021, 3, 29),
startDayHour: 9,
});
});

test('appointments should have right role', async (t) => {
const scheduler = new Scheduler('#container');
const appt = scheduler.getAppointment('Website Re-Design Plan');

await t
.expect(appt.element.getAttribute('role'))
.eql('application');

await t
.expect(appt.element.getAttribute('aria-activedescendant'))
.eql(null);
}).before(async () => {
await createWidget('dxScheduler', {
timeZone: 'America/Los_Angeles',
dataSource: [
{
text: 'Website Re-Design Plan',
startDate: new Date('2021-04-29T16:30:00.000Z'),
endDate: new Date('2021-04-29T18:30:00.000Z'),
},
],
currentView,
currentDate: new Date(2021, 3, 29),
startDayHour: 9,
});
});
});

[
Expand Down Expand Up @@ -231,28 +282,3 @@ test('appointments & collector buttons can be navigated', async (t) => {
currentDate: new Date(2021, 1, 1),
});
});

test('Scheduler a11y: appointments does not have info about reccurence', async (t) => {
const scheduler = new Scheduler('#container');
const recurrenceIcon = scheduler.getAppointment('Website Re-Design Plan').getRecurrenceElement();

await t
.expect(recurrenceIcon.getAttribute('aria-label'))
.eql('Recurring appointment');
}).before(async () => {
await createWidget('dxScheduler', {
timeZone: 'America/Los_Angeles',
dataSource: [
{
text: 'Website Re-Design Plan',
startDate: new Date('2021-04-26T16:30:00.000Z'),
endDate: new Date('2021-04-26T18:30:00.000Z'),
recurrenceRule: 'FREQ=WEEKLY;BYDAY=MO,TH;COUNT=10',
},
],
views: ['day', 'week', 'workWeek', 'month'],
currentView: 'day',
currentDate: new Date(2021, 3, 29),
startDayHour: 9,
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export class Appointment extends DOMComponent {
const text = ExpressionUtils.getField(this.option('dataAccessors'), 'text', this.rawAppointment);
(this.$element() as any).attr('title', text);
(this.$element() as any).data('dxAppointmentStartDate', this.option('startDate'));
(this.$element() as any).attr('role', 'button');
(this.$element() as any).attr('role', 'application');

this._renderRecurrenceClass();
this._renderResizable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ class SchedulerAppointments extends CollectionWidget {
}
}

_refreshActiveDescendant() {
// override to do nothing
}

_attachAppointmentsEvents() {
(this as any)._attachClickEvent();
(this as any)._attachHoldEvent();
Expand Down

0 comments on commit fffa561

Please sign in to comment.