<commit_before>import { mount } from '@vue/test-utils';
import DatePicker from '@/components/DatePicker';

describe('DatePicker', () => {
  let wrapper;

  beforeEach(() => {
    wrapper = mount(DatePicker, {
      propsData: {
        value: new Date(2000, 0, 15),
      },
    });
  });

  describe(':props', () => {
    it(':value - renders a date value', async () => {
      expect(wrapper.find('.id-2000-01-15').exists()).toBe(true);
    });
    it(':min-date - prevents date before minimum date', async () => {
      await wrapper.setProps({ minDate: new Date(2000, 0, 5) });
      // Day before min date is disabled
      expect(wrapper.find('.id-2000-01-04 .is-disabled').exists()).toBe(true);
      // Day of min date is not disabled
      expect(wrapper.find('.id-2000-01-05 .is-disabled').exists()).toBe(false);
    });
    it(':max-date - prevents date after maximum date', async () => {
      await wrapper.setProps({ maxDate: new Date(2000, 0, 25) });
      // Day after max date is disabled
      expect(wrapper.find('.id-2000-01-26 .is-disabled').exists()).toBe(true);
      // Day of max date is not disabled
      expect(wrapper.find('.id-2000-01-25 .is-disabled').exists()).toBe(false);
    });
  });
});<commit_msg>Add date selection tests for `min-date` and `max-date`<commit_after>import { mount } from '@vue/test-utils';
import DatePicker from '@/components/DatePicker';

describe('DatePicker', () => {
  let wrapper;

  beforeEach(() => {
    wrapper = mount(DatePicker, {
      propsData: {
        value: new Date(2000, 0, 15),
      },
    });
  });

  describe(':props', () => {
    it(':value - renders a date value', async () => {
      expect(wrapper.find('.id-2000-01-15').exists()).toBe(true);
    });
    it(':min-date - prevents date before minimum date', async () => {
      await wrapper.setProps({ minDate: new Date(2000, 0, 5) });
      // Day before min date is disabled
      expect(wrapper.find('.id-2000-01-04 .is-disabled').exists()).toBe(true);
      // Click day before min date
      await wrapper.find('.id-2000-01-04 .vc-day-content').trigger('click');
      // Highlight should NOT appear
      expect(wrapper.find('.id-2000-01-04 .vc-highlight').exists()).toBe(false);
      // Day of min date is not disabled
      expect(wrapper.find('.id-2000-01-05 .is-disabled').exists()).toBe(false);
      // Click day of min date
      await wrapper.find('.id-2000-01-05 .vc-day-content').trigger('click');
      // Highlight should appear
      expect(wrapper.find('.id-2000-01-05 .vc-highlight').exists()).toBe(true);
    });
    it(':max-date - prevents date after maximum date', async () => {
      await wrapper.setProps({ maxDate: new Date(2000, 0, 25) });
      // Day after max date is disabled
      expect(wrapper.find('.id-2000-01-26 .is-disabled').exists()).toBe(true);
      // Click day after max date
      await wrapper.find('.id-2000-01-26 .vc-day-content').trigger('click');
      // Highlight should NOT appear
      expect(wrapper.find('.id-2000-01-26 .vc-highlight').exists()).toBe(false);
      // Day of max date is not disabled
      expect(wrapper.find('.id-2000-01-25 .is-disabled').exists()).toBe(false);
      // Click day of max date
      await wrapper.find('.id-2000-01-25 .vc-day-content').trigger('click');
      // Highlight should appear
      expect(wrapper.find('.id-2000-01-25 .vc-highlight').exists()).toBe(true);
    });
  });
});
{'fraction_non_alphanumeric': 0.19226260257913247, 'fraction_numerical': 0.053927315357561546, 'mean_word_length': 2.8006681514476615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2214761', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1041, 'n_words': 241}