Skip to content

Commit

Permalink
dashed-case to camelCase attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcobain committed Feb 5, 2016
1 parent a02e89c commit cf2a8da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
18 changes: 8 additions & 10 deletions addon/components/paper-progress-linear.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const MODE_QUERY = 'query';
export default Component.extend(ColorMixin, {
tagName: 'md-progress-linear',

attributeBindings: ['mode:md-mode', 'buffer-value:md-buffer-value'],
attributeBindings: ['mode:md-mode', 'bufferValue:md-buffer-value'],
classNames: ['md-default-theme'],

constants: inject.service(),
Expand All @@ -29,7 +29,7 @@ export default Component.extend(ColorMixin, {

mode: computed('value', function() {
let value = this.get('value');
let bufferValue = this.get('buffer-value');
let bufferValue = this.get('bufferValue');

if (isPresent(value)) {
if (isPresent(bufferValue)) {
Expand All @@ -50,12 +50,10 @@ export default Component.extend(ColorMixin, {
case MODE_BUFFER:
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
return `md-mode-${this.get('mode')}`;
return `md-mode-${mode}`;
default:
return ``;
return '';
}


}),

transforms: new Array(101),
Expand All @@ -67,7 +65,7 @@ export default Component.extend(ColorMixin, {
},

bar1Style: computed('clampedBufferValue', function() {
return Ember.String.htmlSafe(this.get('constants.CSS.TRANSFORM') + ': ' + this.transforms[this.get('clampedBufferValue')]);
return Ember.String.htmlSafe(`${this.get('constants.CSS.TRANSFORM')}: ${this.transforms[this.get('clampedBufferValue')]}`);
}),

bar2Style: computed('clampedValue', function() {
Expand All @@ -76,16 +74,16 @@ export default Component.extend(ColorMixin, {
return Ember.String.htmlSafe('');
}

return Ember.String.htmlSafe(this.get('constants.CSS.TRANSFORM') + ': ' + this.transforms[this.get('clampedValue')]);
return Ember.String.htmlSafe(`${this.get('constants.CSS.TRANSFORM')}: ${this.transforms[this.get('clampedValue')]}`);
}),

clampedValue: computed('value', function() {
let value = this.get('value');
return Math.max(0, Math.min(value || 0, 100));
}),

clampedBufferValue: computed('buffer-value', function() {
let value = this.get('buffer-value');
clampedBufferValue: computed('bufferValue', function() {
let value = this.get('bufferValue');
return Math.max(0, Math.min(value || 0, 100));
})

Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/templates/progress-linear.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<h4>Buffer mode</h4>
<p>For operations where the user wants to indicate some activity or loading from the server, use the buffer indicator:</p>
{{paper-progress-linear warn=true value=determinateValue buffer-value=determinateValue2}}
{{paper-progress-linear warn=true value=determinateValue bufferValue=determinateValue2}}

<h4>Query mode</h4>
<p>For situations where the user wants to indicate pre-loading (until the loading can actually be made), use the query indicator:</p>
Expand All @@ -35,7 +35,7 @@
\{{paper-progress-linear}}

&lt;h4&gt;Buffer mode&lt;/h4&gt;
\{{paper-progress-linear warn=true value=determinateValue buffer-value=determinateValue2}}
\{{paper-progress-linear warn=true value=determinateValue bufferValue=determinateValue2}}

&lt;h4&gt;Query mode&lt;/h4&gt;
\{{paper-progress-linear accent=true mode=mode value=determinateValue}}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/components/paper-progress-linear-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test('should auto-set the md-mode to "determinate" if a value is specified', fun
});

test('should auto-set the md-mode to "buffer" if a value and bufferValue is specified', function(assert) {
this.render(hbs`{{paper-progress-linear value=50 buffer-value=100}}`);
this.render(hbs`{{paper-progress-linear value=50 bufferValue=100}}`);
assert.equal(this.$('md-progress-linear').attr('md-mode'), 'buffer');
});

Expand All @@ -31,7 +31,7 @@ test('it sets transform based on value', function(assert) {
});

test('it sets transform based on buffer value', function(assert) {
this.render(hbs`{{paper-progress-linear value=50 buffer-value=75}}`);
this.render(hbs`{{paper-progress-linear value=50 bufferValue=75}}`);

var bar1 = this.$('.md-bar1')[0];
var bar1style = bar1.style['transform'] || bar1.style['-webkit-transform'];
Expand Down

0 comments on commit cf2a8da

Please sign in to comment.