Sun, Nov 11th
@@ -223,23 +223,6 @@ exports[`Dayz localizes to specified locale 1`] = `
-
@@ -264,7 +247,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 2,
+ "order": 1,
}
}
>
@@ -281,7 +264,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 3,
+ "order": 2,
}
}
>
@@ -298,7 +281,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 4,
+ "order": 3,
}
}
>
@@ -315,7 +298,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 5,
+ "order": 4,
}
}
>
@@ -332,7 +315,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 6,
+ "order": 5,
}
}
>
@@ -349,7 +332,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 7,
+ "order": 6,
}
}
>
@@ -366,7 +349,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 8,
+ "order": 7,
}
}
>
@@ -383,7 +366,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 9,
+ "order": 8,
}
}
>
@@ -400,7 +383,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 10,
+ "order": 9,
}
}
>
@@ -417,7 +400,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 11,
+ "order": 10,
}
}
>
@@ -434,7 +417,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 12,
+ "order": 11,
}
}
>
@@ -451,7 +434,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 13,
+ "order": 12,
}
}
>
@@ -468,7 +451,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 14,
+ "order": 13,
}
}
>
@@ -485,7 +468,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 15,
+ "order": 14,
}
}
>
@@ -502,7 +485,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 16,
+ "order": 15,
}
}
>
@@ -519,7 +502,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 17,
+ "order": 16,
}
}
>
@@ -536,7 +519,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 18,
+ "order": 17,
}
}
>
@@ -553,7 +536,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 19,
+ "order": 18,
}
}
>
@@ -570,7 +553,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 20,
+ "order": 19,
}
}
>
@@ -587,7 +570,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 21,
+ "order": 20,
}
}
>
@@ -604,7 +587,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 22,
+ "order": 21,
}
}
>
@@ -621,7 +604,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 23,
+ "order": 22,
}
}
>
@@ -638,7 +621,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 24,
+ "order": 23,
}
}
>
@@ -655,7 +638,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 25,
+ "order": 24,
}
}
>
@@ -672,7 +655,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 26,
+ "order": 25,
}
}
>
@@ -689,7 +672,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 27,
+ "order": 26,
}
}
>
@@ -706,7 +689,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 28,
+ "order": 27,
}
}
>
@@ -723,7 +706,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 29,
+ "order": 28,
}
}
>
@@ -740,7 +723,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 30,
+ "order": 29,
}
}
>
@@ -757,7 +740,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 31,
+ "order": 30,
}
}
>
@@ -774,7 +757,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 32,
+ "order": 31,
}
}
>
@@ -791,7 +774,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 33,
+ "order": 32,
}
}
>
@@ -808,7 +791,7 @@ exports[`Dayz localizes to specified locale 1`] = `
onDoubleClick={[Function]}
style={
Object {
- "order": 34,
+ "order": 33,
}
}
>
diff --git a/test/layout.spec.js b/test/layout.spec.js
index 8588d8f..8f96fe7 100644
--- a/test/layout.spec.js
+++ b/test/layout.spec.js
@@ -1,6 +1,6 @@
import React from 'react'; // eslint-disable-line no-unused-vars
import moment from '../src/moment-range';
-import { testEventMonth, testEventRange, testEventDay } from './testing-layouts';
+import { testEventMonth, testEventRange, testEventDay, testWeekStartsOn } from './testing-layouts';
describe('Layout calculations', () => {
describe('day layout', () => {
@@ -160,4 +160,58 @@ describe('Layout calculations', () => {
})).toMatchObject({ className: 'day after tenth' });
});
});
+
+ describe('weekStartsOn', () => {
+ describe('month layout', () => {
+ describe('default', () => {
+ it('starts the week on Sunday for "en" locale', () => {
+ const layout = testWeekStartsOn({ locale: 'en' });
+ expect(layout.range.start.isoWeekday()).toBe(7);
+ });
+
+ it('starts the week on Monday for "de" locale', () => {
+ const layout = testWeekStartsOn({ locale: 'de' });
+ expect(layout.range.start.isoWeekday()).toBe(1);
+ });
+ });
+
+ describe('weekStartsOn set', () => {
+ it('starts the week on Sunday when 0', () => {
+ const layout = testWeekStartsOn({ locale: 'de', weekStartsOn: 0 });
+ expect(layout.range.start.isoWeekday()).toBe(7);
+ });
+
+ it('starts the week on Monday when 1', () => {
+ const layout = testWeekStartsOn({ locale: 'en', weekStartsOn: 1 });
+ expect(layout.range.start.isoWeekday()).toBe(1);
+ });
+ });
+ });
+
+ describe('week layout', () => {
+ describe('default', () => {
+ it('starts the week on Sunday for "en" locale', () => {
+ const layout = testWeekStartsOn({ locale: 'en' });
+ expect(layout.range.start.isoWeekday()).toBe(7);
+ });
+
+ it('starts the week on Monday for "de" locale', () => {
+ const layout = testWeekStartsOn({ locale: 'de' });
+ expect(layout.range.start.isoWeekday()).toBe(1);
+ });
+ });
+
+ describe('weekStartsOn set', () => {
+ it('starts the week on Sunday when 0', () => {
+ const layout = testWeekStartsOn({ locale: 'de', weekStartsOn: 0 });
+ expect(layout.range.start.isoWeekday()).toBe(7);
+ });
+
+ it('starts the week on Monday when 1', () => {
+ const layout = testWeekStartsOn({ locale: 'en', weekStartsOn: 1 });
+ expect(layout.range.start.isoWeekday()).toBe(1);
+ });
+ });
+ });
+ });
});
diff --git a/test/testing-layouts.js b/test/testing-layouts.js
index 9e9aa04..f499a31 100644
--- a/test/testing-layouts.js
+++ b/test/testing-layouts.js
@@ -67,3 +67,13 @@ const testEventMonth = (options = {}) => {
}, options));
return layout;
};
+
+export
+const testWeekStartsOn = (options = {}, display = 'month', events = new EventsCollection([])) => {
+ const layout = new Layout(Object.assign({
+ date: '2019-10-15',
+ display,
+ events,
+ }, options));
+ return layout;
+};