Skip to content

Commit

Permalink
Fixed another 170 comma-dangle warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JedWatson committed Feb 1, 2016
1 parent ba1e4d4 commit 9756eb8
Show file tree
Hide file tree
Showing 56 changed files with 284 additions and 298 deletions.
4 changes: 2 additions & 2 deletions fields/types/Type.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var DEFAULT_OPTION_KEYS = [
'indent',
'hidden',
'collapse',
'dependsOn'
'dependsOn',
];

/**
Expand Down Expand Up @@ -75,7 +75,7 @@ function Field(list, path, options) {
Object.defineProperty(this, 'note', {
get: function() {
return (note === null) ? (note = (this.options.note) ? marked(this.options.note) : '') : note;
}
},
});

}
Expand Down
4 changes: 2 additions & 2 deletions fields/types/password/PasswordFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var PasswordFilter = React.createClass({
propTypes: {
filter: React.PropTypes.shape({
exists: React.PropTypes.oneOf(TOGGLE_OPTIONS.map(i => i.value)),
})
}),
},

getDefaultProps () {
Expand All @@ -38,7 +38,7 @@ var PasswordFilter = React.createClass({
render () {
const { field, filter } = this.props;
return <SegmentedControl equalWidthSegments options={TOGGLE_OPTIONS} value={filter.exists} onChange={this.toggleExists} />;
}
},

});

Expand Down
4 changes: 2 additions & 2 deletions fields/types/password/PasswordType.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ password.prototype.addToSchema = function() {

this.paths = {
hash: this.options.hashPath || this._path.append('_hash'),
confirm: this.options.confirmPath || this._path.append('_confirm')
confirm: this.options.confirmPath || this._path.append('_confirm'),
};

schema.path(this.path, _.defaults({
type: String,
set: function(newValue) {
this[needs_hashing] = true;
return newValue;
}
},
}, this.options));

schema.virtual(this.paths.hash).set(function(newValue) {
Expand Down
2 changes: 1 addition & 1 deletion fields/types/relationship/RelationshipColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var RelationshipColumn = React.createClass({
{many ? this.renderMany(value) : this.renderValue(value)}
</ItemsTableCell>
);
}
},
});

module.exports = RelationshipColumn;
4 changes: 2 additions & 2 deletions fields/types/relationship/RelationshipField.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ module.exports = Field.create({
// NOTE: this seems like the wrong way to add options to the Select
this.loadOptionsCallback(null, {
complete: true,
options: Object.keys(this._itemsCache).map((k) => this._itemsCache[k])
options: Object.keys(this._itemsCache).map((k) => this._itemsCache[k]),
});
this.toggleCreate(false);
},
Expand Down Expand Up @@ -223,6 +223,6 @@ module.exports = Field.create({
} else {
return this.renderSelect();
}
}
},

});
2 changes: 1 addition & 1 deletion fields/types/select/SelectColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var SelectColumn = React.createClass({
</ItemsTableValue>
</ItemsTableCell>
);
}
},
});

module.exports = SelectColumn;
4 changes: 2 additions & 2 deletions fields/types/select/SelectField.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = Field.create({
}
this.props.onChange({
path: this.props.path,
value: newValue
value: newValue,
});
},

Expand All @@ -33,6 +33,6 @@ module.exports = Field.create({
var ops = (this.props.numeric) ? this.props.ops.map(function(i) { return { label: i.label, value: String(i.value) }; }) : this.props.ops;
var value = ('number' === typeof this.props.value) ? String(this.props.value) : this.props.value;
return <Select simpleValue name={this.props.path} value={value} options={ops} onChange={this.valueChanged} />;
}
},

});
6 changes: 3 additions & 3 deletions fields/types/select/SelectFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PopoutList from '../../../admin/client/components/PopoutList';

const TOGGLE_OPTIONS = [
{ label: 'Matches', value: false },
{ label: 'Does NOT Match', value: true }
{ label: 'Does NOT Match', value: true },
];

function getDefaultValue () {
Expand All @@ -25,7 +25,7 @@ var SelectFilter = React.createClass({
filter: React.PropTypes.shape({
inverted: React.PropTypes.boolean,
value: React.PropTypes.array,
})
}),
},

getDefaultProps () {
Expand Down Expand Up @@ -94,7 +94,7 @@ var SelectFilter = React.createClass({
{this.renderOptions()}
</div>
);
}
},

});

Expand Down
4 changes: 2 additions & 2 deletions fields/types/select/SelectType.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ select.prototype.addToSchema = function() {
data: this.options.dataPath || this._path.append('Data'),
label: this.options.labelPath || this._path.append('Label'),
options: this.options.optionsPath || this._path.append('Options'),
map: this.options.optionsMapPath || this._path.append('OptionsMap')
map: this.options.optionsMapPath || this._path.append('OptionsMap'),
};
schema.path(this.path, _.defaults({
type: this._nativeType,
enum: this.values,
set: function(val) {
return (val === '' || val === null || val === false) ? undefined : val;
}
},
}, this.options));
schema.virtual(this.paths.data).get(function () {
return field.map[this.get(field.path)];
Expand Down
12 changes: 6 additions & 6 deletions fields/types/select/test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ exports.initList = function(List) {
List.add({
select: { type: SelectType, options: 'one, two, three' },
nested: {
select: { type: SelectType, options: 'one, two, three' }
}
select: { type: SelectType, options: 'one, two, three' },
},
});
};

Expand All @@ -15,7 +15,7 @@ exports.testFieldType = function(List) {

it('should update top level fields', function(done) {
List.fields.select.updateItem(testItem, {
select: 'one'
select: 'one',
}, function() {
demand(testItem.select).be('one');
testItem.select = undefined;
Expand All @@ -26,8 +26,8 @@ exports.testFieldType = function(List) {
it('should update nested fields', function(done) {
List.fields['nested.select'].updateItem(testItem, {
nested: {
select: 'one'
}
select: 'one',
},
}, function() {
demand(testItem.nested.select).be('one');
testItem.nested.select = undefined;
Expand All @@ -37,7 +37,7 @@ exports.testFieldType = function(List) {

it('should update nested fields with flat paths', function(done) {
List.fields['nested.select'].updateItem(testItem, {
'nested.select': 'one'
'nested.select': 'one',
}, function() {
demand(testItem.nested.select).be('one');
testItem.nested.select = undefined;
Expand Down
2 changes: 1 addition & 1 deletion fields/types/text/TextColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var TextColumn = React.createClass({
</ItemsTableValue>
</ItemsTableCell>
);
}
},
});

module.exports = TextColumn;
2 changes: 1 addition & 1 deletion fields/types/text/TextField.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Field from '../Field';

module.exports = Field.create({
displayName: 'TextField'
displayName: 'TextField',
});
4 changes: 2 additions & 2 deletions fields/types/text/TextFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var TextFilter = React.createClass({
mode: React.PropTypes.oneOf(MODE_OPTIONS.map(i => i.value)),
inverted: React.PropTypes.boolean,
value: React.PropTypes.string,
})
}),
},

getDefaultProps () {
Expand Down Expand Up @@ -77,7 +77,7 @@ var TextFilter = React.createClass({
</FormField>
</div>
);
}
},

});

Expand Down
18 changes: 9 additions & 9 deletions fields/types/text/test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ exports.initList = function(List) {
List.add({
text: String,
nested: {
text: String
}
text: String,
},
});
};

Expand All @@ -14,33 +14,33 @@ exports.testFieldType = function(List) {

it('should update top level fields', function(done) {
List.fields.text.updateItem(testItem, {
text: 'value'
text: 'value',
}, function() {
demand(testItem.text).be('value');
testItem.text = undefined;
done();
});
});

it('should update nested fields', function(done) {
List.fields['nested.text'].updateItem(testItem, {
nested: {
text: 'value'
}
text: 'value',
},
}, function() {
demand(testItem.nested.text).be('value');
testItem.nested.text = undefined;
done();
});
});

it('should update nested fields with flat paths', function(done) {
List.fields['nested.text'].updateItem(testItem, {
'nested.text': 'value'
'nested.text': 'value',
}, function() {
demand(testItem.nested.text).be('value');
testItem.nested.text = undefined;
done();
});
});
});
};
7 changes: 2 additions & 5 deletions fields/types/textarea/TextareaField.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import Field from '../Field';
import React from 'react';

module.exports = Field.create({

displayName: 'TextareaField',

renderField () {
var styles = {
height: this.props.height
height: this.props.height,
};
return <textarea name={this.props.path} styles={styles} ref="focusTarget" value={this.props.value} onChange={this.valueChanged} autoComplete="off" className="FormInput" />;
}

},
});
42 changes: 21 additions & 21 deletions fields/types/textarea/test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ exports.initList = function(List) {
List.add({
text: TextareaType,
nested: {
text: TextareaType
}
text: TextareaType,
},
});
};

Expand All @@ -15,73 +15,73 @@ exports.testFieldType = function(List) {

it('should update top level fields', function(done) {
List.fields.text.updateItem(testItem, {
text: 'value'
text: 'value',
}, function() {
demand(testItem.text).be('value');
testItem.text = undefined;
done();
});
});

it('should update nested fields', function(done) {
List.fields['nested.text'].updateItem(testItem, {
nested: {
text: 'value'
}
text: 'value',
},
}, function() {
demand(testItem.nested.text).be('value');
testItem.nested.text = undefined;
done();
});
});
});

it('should update nested fields with flat paths', function(done) {
List.fields['nested.text'].updateItem(testItem, {
'nested.text': 'value'
'nested.text': 'value',
}, function() {
demand(testItem.nested.text).be('value');
testItem.nested.text = undefined;
done();
});
});
});

it('should format to HTML', function(done) {
List.fields.text.updateItem(testItem, {
text: 'foo\nbar'
text: 'foo\nbar',
}, function() {
demand(testItem._.text.format()).be('foo<br>bar');
testItem.text = undefined;
done();
});
});
});

it('should truncate text with a length', function(done) {
List.fields.text.updateItem(testItem, {
text: 'foobar'
text: 'foobar',
}, function() {
demand(testItem._.text.crop(5)).be('fooba');
testItem.text = undefined;
done();
});
});
});

it('should truncate text with a length and custom append string', function(done) {
List.fields.text.updateItem(testItem, {
text: 'foobar'
text: 'foobar',
}, function() {
demand(testItem._.text.crop(5, '...')).be('fooba...');
testItem.text = undefined;
done();
});
});
});

it('should truncate text with and preserve words with a length, custom append string', function(done) {
List.fields.text.updateItem(testItem, {
text: 'foo bar lol'
text: 'foo bar lol',
}, function() {
demand(testItem._.text.crop(5, '...', true)).be('foo bar...');
testItem.text = undefined;
done();
});
});
});
};
Loading

0 comments on commit 9756eb8

Please sign in to comment.