Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function MyComponent() {
return
}
DayPicker2.DateUtils.clone(new Date());
describe('renderCaption', () => {
const currentYear = new Date().getFullYear()
const datepicker = shallow()
const captionProps: Partial = {
date: new Date(currentYear, 0, 1),
localeUtils: {
...DayPicker.LocaleUtils,
formatMonthTitle: datepicker.instance().formatMonthTitle,
},
}
it('Should render the given month title', () => {
const caption = renderer.create(datepicker.instance().renderCaption(captionProps))
expect(caption).toMatchSnapshot()
})
it('Should render the given month title with year if it is not the current year', () => {
const futureYearProps = { ...captionProps, date: new Date(2050, 0, 1) }
const caption = renderer.create(datepicker.instance().renderCaption(futureYearProps))
expect(caption).toMatchSnapshot()
})
})
const defaultWeekdaysLong = [0, 1, 2, 3, 4, 5, 6].map(weekday =>
DayPicker.LocaleUtils.formatWeekdayLong(weekday),
)
const defaultWeekdaysShort = [0, 1, 2, 3, 4, 5, 6].map(weekday =>
DayPicker.LocaleUtils.formatWeekdayShort(weekday),
)
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { checkA11y } from 'storybook-addon-a11y';
import Weekday from './index';
import DayPicker from 'react-day-picker';
const localeUtils = DayPicker.LocaleUtils;
storiesOf('InputDateWeekdays', module)
.addDecorator(checkA11y)
.add('Short Weekday', () => (
))
.add('Medium Weekday', () => (
))
.add('Long Weekday', () => (
));