Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Vue from 'vue';
import flatpickr from "flatpickr";
// Init component
import flatPickrComponent from '../src/index.js';
// Need to add base css for flatpickr
import 'flatpickr/dist/flatpickr.min.css';
// l10n is optional
import {Hindi as HindiLocale} from 'flatpickr/dist/l10n/hi.js';
import {english as EnglishLocale} from 'flatpickr/dist/l10n/default.js'
// Plugins are optional
// https://chmln.github.io/flatpickr/plugins/
import ConfirmDatePlugin from 'flatpickr/dist/plugins/confirmDate/confirmDate.js';
import 'flatpickr/dist/plugins/confirmDate/confirmDate.css';
// Override Global settings
flatpickr.setDefaults({
disableMobile: true,
onClose: () => {
console.log("close event from global config")
}
});
Vue.use(flatPickrComponent);
export default {
name: 'app',
data() {
return {
inputDisabled: false,
form: {
dateBasic: null,
dateTime: null,
describe('Flatpickr events', () => {
let wrapper;
let onChangeStub = jest.fn();
const globalOnChange = jest.fn();
Flatpicker.setDefaults({
onChange: globalOnChange
});
beforeEach(() => {
wrapper = mount(Component, {
propsData: {
value: null,
config: {
onChange: onChangeStub
}
}
});
});
afterEach(() => {
wrapper.destroy();