jakkor / ember-cli-flatpickr

This addon is a wrapper for flatpickr date picker.
MIT License
1 stars 3 forks source link

The last rendered flatpickr is automatically triggered, causing the model to become dirty #5

Open NullVoxPopuli opened 8 years ago

NullVoxPopuli commented 8 years ago

This is a problem especially with editing models.

Here is how I'm using ember-cli-flatpickr https://github.com/NullVoxPopuli/aeonvera-ui/blob/master/app/templates/components/date-time-input.hbs

NullVoxPopuli commented 8 years ago

corresponding js: https://github.com/NullVoxPopuli/aeonvera-ui/blob/master/app/components/date-time-input.js

NullVoxPopuli commented 8 years ago

I have a test that confirms this, because the dateChanged method is invoked, and it shouldn't be.

the test:

test('it renders this month when no date is set', function(assert) {
  let two = Ember.Object.extend({ someDate: null });
  this.set('two', two);
  this.render(hbs`{{date-time-input model=two field='someDate'}}`);

  assert.notEqual(this.$().text().indexOf('2016'), -1);
});