Skip to content
This repository was archived by the owner on Dec 26, 2019. It is now read-only.

Commit 77532fc

Browse files
committed
Add support for disabled Ember prototype extensions
1 parent c9ff41f commit 77532fc

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

addon/components/datepicker-support.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Ember from 'ember';
33
export default Ember.Mixin.create({
44
value: null,
55

6-
setupBootstrapDatepicker: function() {
6+
setupBootstrapDatepicker: Ember.on('didInsertElement', function() {
77
var self = this;
88

99
this.$().
@@ -29,18 +29,22 @@ export default Ember.Mixin.create({
2929
}).
3030
on('changeDate', function(event) {
3131
Ember.run(function() {
32-
self.didChangeDate(event);
32+
self._didChangeDate(event);
3333
});
3434
});
3535

3636
this._updateDatepicker();
37-
}.on('didInsertElement'),
37+
}),
3838

39-
teardownBootstrapDatepicker: function() {
39+
teardownBootstrapDatepicker: Ember.on('willDestroyElement', function() {
4040
this.$().datepicker('remove');
41-
}.on('willDestroyElement'),
41+
}),
4242

43-
didChangeDate: function(event) {
43+
didChangeValue: Ember.observer('value', function() {
44+
this._updateDatepicker();
45+
}),
46+
47+
_didChangeDate: function(event) {
4448
var value = null;
4549

4650
if (event.date) {
@@ -54,10 +58,6 @@ export default Ember.Mixin.create({
5458
this.set('value', value);
5559
},
5660

57-
didChangeValue: function() {
58-
this._updateDatepicker();
59-
}.observes('value'),
60-
6161
_updateDatepicker: function() {
6262
var self = this,
6363
element = this.$(),

tests/integration/bootstrap-datepicker-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ moduleForComponent('bootstrap-datepicker', 'bootstrap-datepicker component', {
1313
}
1414
});
1515

16-
test('...', function() {
17-
expect(0);
16+
test('...', function(assert) {
17+
assert.expect(0);
1818
});

tests/unit/components/bootstrap-datepicker-test.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,65 @@ import Ember from 'ember';
33

44
moduleForComponent('bootstrap-datepicker', 'bootstrap-datepicker component');
55

6-
test('should be an input tag', function() {
7-
expect(1);
6+
test('should be an input tag', function(assert) {
7+
assert.expect(1);
88

9-
equal('INPUT', this.$().prop('tagName'));
9+
assert.equal('INPUT', this.$().prop('tagName'));
1010
});
1111

12-
test('should display empty input field when no date is set', function(){
13-
expect(1);
12+
test('should display empty input field when no date is set', function(assert) {
13+
assert.expect(1);
1414

1515
var component = this.subject({
1616
value: null
1717
});
1818

19-
equal(this.$().val(), '');
19+
assert.equal(this.$().val(), '');
2020
});
2121

2222

23-
test('should display date with default format when no format is set', function(){
24-
expect(1);
23+
test('should display date with default format when no format is set', function(assert) {
24+
assert.expect(1);
2525

2626
var component = this.subject({
2727
value: new Date(2014, 11, 31)
2828
});
2929

30-
equal(this.$().val(), '12/31/2014');
30+
assert.equal(this.$().val(), '12/31/2014');
3131
});
3232

33-
test('should display date with custom format when format is set', function(){
34-
expect(1);
33+
test('should display date with custom format when format is set', function(assert) {
34+
assert.expect(1);
3535

3636
var component = this.subject({
3737
value: new Date(2014, 11, 31),
3838
format: 'dd.M.yy'
3939
});
4040

41-
equal(this.$().val(), '31.Dec.14');
41+
assert.equal(this.$().val(), '31.Dec.14');
4242
});
4343

44-
test('should set dates provided by value (multidate, default multidateSeparator)', function(){
45-
expect(2);
44+
test('should set dates provided by value (multidate, default multidateSeparator)', function(assert) {
45+
assert.expect(2);
4646

4747
var component = this.subject({
4848
value: [new Date(2015, 0, 13), new Date(2015, 0, 7), new Date(2015, 0, 15)],
4949
multidate: true
5050
});
5151

52-
equal(this.$().val(), '01/13/2015,01/07/2015,01/15/2015', 'should set value as input field value');
53-
equal(this.$().datepicker('getDates').length, 3, 'should set internal datepicker dates by value');
52+
assert.equal(this.$().val(), '01/13/2015,01/07/2015,01/15/2015', 'should set value as input field value');
53+
assert.equal(this.$().datepicker('getDates').length, 3, 'should set internal datepicker dates by value');
5454
});
5555

56-
test('should set dates provided by value (multidate, multidateSeparator provided)', function(){
57-
expect(2);
56+
test('should set dates provided by value (multidate, multidateSeparator provided)', function(assert) {
57+
assert.expect(2);
5858

5959
var component = this.subject({
6060
value: [new Date(2015, 0, 13), new Date(2015, 0, 7), new Date(2015, 0, 15)],
6161
multidate: true,
6262
multidateSeparator: ';'
6363
});
6464

65-
equal(this.$().val(), '01/13/2015;01/07/2015;01/15/2015', 'should set value as input field value using multidate separator');
66-
equal(this.$().datepicker('getDates').length, 3, 'should set internal datepicker dates by value');
65+
assert.equal(this.$().val(), '01/13/2015;01/07/2015;01/15/2015', 'should set value as input field value using multidate separator');
66+
assert.equal(this.$().datepicker('getDates').length, 3, 'should set internal datepicker dates by value');
6767
});

0 commit comments

Comments
 (0)