Skip to content

Commit 5d8c86b

Browse files
authoredOct 19, 2016
Merge pull request adopted-ember-addons#111 from sl249/Min-Max-Fix
Tests and fix in pikaday mixin
2 parents fb16c12 + 8c0b452 commit 5d8c86b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
 

‎addon/mixins/pikaday.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ export default Ember.Mixin.create({
4646

4747
didUpdateAttrs({ newAttrs }) {
4848
this._super(...arguments);
49-
this.setPikadayDate();
5049
this.setMinDate();
5150
this.setMaxDate();
51+
this.setPikadayDate();
5252

5353
if(newAttrs.options) {
5454
this._updateOptions();

‎tests/integration/components/pikaday-input-test.js

+17
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,23 @@ test('set max date', function(assert) {
135135
assert.ok($('.is-today').hasClass('is-disabled'));
136136
});
137137

138+
test('set new date value with a new min date', function(assert) {
139+
var tommorow = new Date(2010, 7, 10);
140+
this.set('tommorow', tommorow);
141+
this.render(hbs`{{pikaday-input value=tommorow minDate=tommorow}}`);
142+
this.set('tommorow', new Date(2010, 7, 9));
143+
assert.equal(this.$('input').val(), '09.08.2010');
144+
});
145+
146+
147+
test('set new date value with a new max date', function(assert) {
148+
var tommorow = new Date(2010, 7, 10);
149+
this.set('tommorow', tommorow);
150+
this.render(hbs`{{pikaday-input value=tommorow maxDate=tommorow}}`);
151+
this.set('tommorow', new Date(2010, 7, 11));
152+
assert.equal(this.$('input').val(), '11.08.2010');
153+
});
154+
138155
test('theme option adds theme as CSS class to DOM element', function(assert) {
139156
this.render(hbs`{{pikaday-input theme='dark-theme'}}`);
140157

0 commit comments

Comments
 (0)