Skip to content

Commit

Permalink
use title case for all placeholder text (#663)
Browse files Browse the repository at this point in the history
* use title case for all placeholder text

* updated tests
  • Loading branch information
nelsonpecora committed Oct 12, 2016
1 parent 2fcb1d6 commit 2aa9d91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion decorators/placeholder.js
Expand Up @@ -33,7 +33,9 @@ function getPlaceholderText(path, data, componentData) {
placeholder = schema[references.placeholderProperty];

if (_.isObject(placeholder) && placeholder.text) {
return interpolate(placeholder.text, componentData);
let interpolated = interpolate(placeholder.text, componentData) || '';

return interpolated.split(' ').map(_.capitalize).join(' ');
} else {
return label(path, schema);
}
Expand Down
6 changes: 3 additions & 3 deletions decorators/placeholder.test.js
Expand Up @@ -51,7 +51,7 @@ describe(dirname, function () {
},
componentData = { mockProp: { value: 'some value' }};

expect(fn('mockProp', mockData, componentData)).to.equal('Value is some value');
expect(fn('mockProp', mockData, componentData)).to.equal('Value Is Some Value');
});

it('uses values from a group in placeholder text if values exist', function () {
Expand All @@ -78,7 +78,7 @@ describe(dirname, function () {
propB: { value: 'another value' }
};

expect(fn('mockGroup', mockGroupData, componentData)).to.equal('A is some value and B is another value');
expect(fn('mockGroup', mockGroupData, componentData)).to.equal('A Is Some Value And B Is Another Value');
});

it('uses empty string in placeholder text if value does not exist', function () {
Expand All @@ -95,7 +95,7 @@ describe(dirname, function () {
mockProp: { value: null }
};

expect(fn('mockProp', mockData, componentData)).to.equal('Value is ');
expect(fn('mockProp', mockData, componentData)).to.equal('Value Is ');
});
});

Expand Down

0 comments on commit 2aa9d91

Please sign in to comment.