Skip to content

Commit 0681970

Browse files
authored
QUnit tests: divined editors tests to reduce tests per file (#31522) (#31546)
1 parent 88f46fe commit 0681970

13 files changed

+6875
-6842
lines changed

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/calendar.options.tests.js

Lines changed: 2583 additions & 0 deletions
Large diffs are not rendered by default.

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/calendar.tests.js

Lines changed: 1 addition & 2524 deletions
Large diffs are not rendered by default.

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/calendarViews.tests.js

Lines changed: 14 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -234,85 +234,21 @@ QUnit.module('MonthView', {
234234
});
235235

236236
[
237-
{ currentDate: new Date(2012, 0, 1), expectedWeekNumbers: [52, 1, 2, 3, 4, 5] },
238-
{ currentDate: new Date(2007, 0, 1), expectedWeekNumbers: [52, 1, 2, 3, 4, 5] },
239-
{ currentDate: new Date(2007, 11, 31), expectedWeekNumbers: [48, 49, 50, 51, 52, 1] },
240-
{ currentDate: new Date(2002, 11, 31), expectedWeekNumbers: [48, 49, 50, 51, 52, 1] },
241-
{ currentDate: new Date(2008, 11, 29), expectedWeekNumbers: [48, 49, 50, 51, 52, 1] },
242-
{ currentDate: new Date(2009, 11, 28), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
243-
{ currentDate: new Date(2010, 11, 27), expectedWeekNumbers: [48, 49, 50, 51, 52, 1] },
244-
// 53
245-
{ currentDate: new Date(2004, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
246-
{ currentDate: new Date(2009, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
247-
{ currentDate: new Date(2015, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
248-
{ currentDate: new Date(2020, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
237+
{ currentDate: new Date(2025, 11, 31), expectedWeekNumbers: [48, 49, 50, 51, 52, 1] },
249238
{ currentDate: new Date(2026, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
250-
{ currentDate: new Date(2032, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
251-
{ currentDate: new Date(2037, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
252-
{ currentDate: new Date(2043, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
253-
{ currentDate: new Date(2048, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
254-
{ currentDate: new Date(2054, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
255-
{ currentDate: new Date(2060, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
256-
{ currentDate: new Date(2065, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
257-
{ currentDate: new Date(2071, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
258-
{ currentDate: new Date(2076, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
259-
{ currentDate: new Date(2082, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
260-
{ currentDate: new Date(2088, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
261-
{ currentDate: new Date(2093, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
262-
{ currentDate: new Date(2099, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
263-
{ currentDate: new Date(2105, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
264-
{ currentDate: new Date(2111, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
265-
{ currentDate: new Date(2116, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
266-
{ currentDate: new Date(2122, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
267-
{ currentDate: new Date(2128, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
268-
{ currentDate: new Date(2133, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
269-
{ currentDate: new Date(2139, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
270-
{ currentDate: new Date(2144, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
271-
{ currentDate: new Date(2150, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
272-
{ currentDate: new Date(2156, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
273-
{ currentDate: new Date(2161, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
274-
{ currentDate: new Date(2167, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
275-
{ currentDate: new Date(2172, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
276-
{ currentDate: new Date(2178, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
277-
{ currentDate: new Date(2184, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
278-
{ currentDate: new Date(2189, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
279-
{ currentDate: new Date(2195, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
280-
{ currentDate: new Date(2201, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
281-
{ currentDate: new Date(2207, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
282-
{ currentDate: new Date(2212, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
283-
{ currentDate: new Date(2218, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
284-
{ currentDate: new Date(2224, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
285-
{ currentDate: new Date(2229, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
286-
{ currentDate: new Date(2235, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
287-
{ currentDate: new Date(2240, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
288-
{ currentDate: new Date(2246, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
289-
{ currentDate: new Date(2252, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
290-
{ currentDate: new Date(2257, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
291-
{ currentDate: new Date(2263, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
292-
{ currentDate: new Date(2268, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
293-
{ currentDate: new Date(2274, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
294-
{ currentDate: new Date(2280, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
295-
{ currentDate: new Date(2285, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
296-
{ currentDate: new Date(2291, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
297-
{ currentDate: new Date(2296, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
298-
{ currentDate: new Date(2303, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
299-
{ currentDate: new Date(2308, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
300-
{ currentDate: new Date(2314, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
301-
{ currentDate: new Date(2320, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
302-
{ currentDate: new Date(2325, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
303-
{ currentDate: new Date(2331, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
304-
{ currentDate: new Date(2336, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
305-
{ currentDate: new Date(2342, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
306-
{ currentDate: new Date(2348, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
307-
{ currentDate: new Date(2353, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
308-
{ currentDate: new Date(2359, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
309-
{ currentDate: new Date(2364, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
310-
{ currentDate: new Date(2370, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
311-
{ currentDate: new Date(2376, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
312-
{ currentDate: new Date(2381, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
313-
{ currentDate: new Date(2387, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
314-
{ currentDate: new Date(2392, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
315-
{ currentDate: new Date(2398, 11, 31), expectedWeekNumbers: [49, 50, 51, 52, 53, 1] },
239+
{ currentDate: new Date(2027, 11, 31), expectedWeekNumbers: [48, 49, 50, 51, 52, 1] },
240+
{ currentDate: new Date(2028, 11, 31), expectedWeekNumbers: [48, 49, 50, 51, 52, 1] },
241+
{ currentDate: new Date(2029, 11, 31), expectedWeekNumbers: [48, 49, 50, 51, 52, 1] },
242+
{ currentDate: new Date(2030, 11, 31), expectedWeekNumbers: [48, 49, 50, 51, 52, 1] },
243+
{ currentDate: new Date(2033, 11, 31), expectedWeekNumbers: [48, 49, 50, 51, 52, 1] },
244+
245+
{ currentDate: new Date(2025, 0, 1), expectedWeekNumbers: [1, 2, 3, 4, 5, 6] },
246+
{ currentDate: new Date(2026, 0, 1), expectedWeekNumbers: [1, 2, 3, 4, 5, 6] },
247+
{ currentDate: new Date(2027, 0, 1), expectedWeekNumbers: [53, 1, 2, 3, 4, 5] },
248+
{ currentDate: new Date(2028, 0, 1), expectedWeekNumbers: [52, 1, 2, 3, 4, 5] },
249+
{ currentDate: new Date(2029, 0, 1), expectedWeekNumbers: [52, 1, 2, 3, 4, 5] },
250+
{ currentDate: new Date(2030, 0, 1), expectedWeekNumbers: [1, 2, 3, 4, 5, 6] },
251+
{ currentDate: new Date(2034, 0, 1), expectedWeekNumbers: [52, 1, 2, 3, 4, 5] },
316252
].forEach(({ currentDate, expectedWeekNumbers }) => {
317253
QUnit.test(`iso week numbers of 'month' view with date: ${currentDate.toLocaleDateString()}`, function(assert) {
318254
this.reinit({
@@ -332,83 +268,6 @@ QUnit.module('MonthView', {
332268
assert.deepEqual(actualWeekNumbers, expectedWeekNumbers, 'week cell numbers');
333269
});
334270
});
335-
336-
[0, 1, 2, 3, 4, 5, 6].forEach((firstDayOfWeek) => {
337-
QUnit.test(`count years with iso week 53, firstDayOfWeek: ${firstDayOfWeek}`, function(assert) {
338-
let count = 0;
339-
340-
for(let i = 0; i < 400; i++) {
341-
this.reinit({
342-
value: new Date(2000 + i, 11, 31),
343-
date: new Date(2000 + i, 11, 31),
344-
showWeekNumbers: true,
345-
weekNumberRule: 'firstFourDays',
346-
firstDayOfWeek,
347-
zoomLevel: 'month',
348-
});
349-
350-
const $weekCell = this.$element.find(`.${CALENDAR_WEEK_NUMBER_CELL_CLASS}`);
351-
const actualWeekNumbers = $weekCell.map(function() {
352-
return Number($(this).text());
353-
}).get();
354-
355-
if(actualWeekNumbers.indexOf(53) !== -1) {
356-
count++;
357-
}
358-
}
359-
assert.equal(count, 71, 'Should have 71 years with iso week 53');
360-
});
361-
362-
QUnit.test(`count years with iso week 53, firstDayOfWeek: ${firstDayOfWeek}`, function(assert) {
363-
let count = 0;
364-
365-
for(let i = 0; i < 400; i++) {
366-
this.reinit({
367-
value: new Date(2001 + i, 0, 1),
368-
date: new Date(2001 + i, 0, 1),
369-
showWeekNumbers: true,
370-
weekNumberRule: 'firstFourDays',
371-
firstDayOfWeek,
372-
zoomLevel: 'month',
373-
});
374-
375-
const $weekCell = this.$element.find(`.${CALENDAR_WEEK_NUMBER_CELL_CLASS}`);
376-
const actualWeekNumbers = $weekCell.map(function() {
377-
return Number($(this).text());
378-
}).get();
379-
380-
if(actualWeekNumbers.indexOf(53) !== -1 || (dateUtils.getWeekNumber(new Date(2000 + i, 11, 31), firstDayOfWeek, 'firstFourDays') === 53 && actualWeekNumbers[0] === 1)) {
381-
count++;
382-
}
383-
}
384-
assert.equal(count, 71, 'Should have 71 years with iso week 53');
385-
});
386-
387-
QUnit.test(`count years with iso week 52, firstDayOfWeek: ${firstDayOfWeek}`, function(assert) {
388-
let count = 0;
389-
390-
for(let i = 0; i < 400; i++) {
391-
this.reinit({
392-
value: new Date(2000 + i, 11, 31),
393-
date: new Date(2000 + i, 11, 31),
394-
showWeekNumbers: true,
395-
weekNumberRule: 'firstFourDays',
396-
firstDayOfWeek,
397-
zoomLevel: 'month',
398-
});
399-
400-
const $weekCell = this.$element.find(`.${CALENDAR_WEEK_NUMBER_CELL_CLASS}`);
401-
const actualWeekNumbers = $weekCell.map(function() {
402-
return Number($(this).text());
403-
}).get();
404-
405-
if(actualWeekNumbers.indexOf(53) === -1) {
406-
count++;
407-
}
408-
}
409-
assert.equal(count, 329, 'Should have 329 years with iso week 52');
410-
});
411-
});
412271
});
413272

414273
QUnit.module('YearView', {

0 commit comments

Comments
 (0)