Skip to content

Commit

Permalink
Text alignment typo fix (#47)
Browse files Browse the repository at this point in the history
* Text alignment typo fix

Text alignment does not work.
Wrong key is used. Draft js uses `textAlignment`
https://draftjs.org/docs/advanced-topics-text-direction#text-alignment

* changing to dot notation

* updated tests

* fixed linter error
  • Loading branch information
vidmantasz authored and raphaelpor committed Oct 18, 2018
1 parent 0b9aacc commit d2660da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions sample/__tests__/components/DraftJsText.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ it('extends a style with a customStyle from another type', () => {

it('renders text-align: left', () => {
const text = 'Hello World';
const data = { 'text-align': 'left' };
const data = { textAlignment: 'left' };
const tree = renderer.create(<DraftJsText
type="paragraph"
text={text}
Expand All @@ -90,7 +90,7 @@ it('renders text-align: left', () => {

it('renders text-align: right', () => {
const text = 'Hello World';
const data = { 'text-align': 'right' };
const data = { textAlignment: 'right' };
const tree = renderer.create(<DraftJsText
type="paragraph"
text={text}
Expand All @@ -104,7 +104,7 @@ it('renders text-align: right', () => {

it('renders text-align: center', () => {
const text = 'Hello World';
const data = { 'text-align': 'center' };
const data = { textAlignment: 'center' };
const tree = renderer.create(<DraftJsText
type="paragraph"
text={text}
Expand Down
2 changes: 1 addition & 1 deletion src/components/DraftJsText.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const DraftJsText = (props: DraftJsTextPropsType): any => {
});

const customStyle = props.customStyles ? props.customStyles[props.type] : undefined;
const textAlignStyle = { textAlign: props.data['text-align'] };
const textAlignStyle = { textAlign: props.data.textAlignment };

return (
<Text
Expand Down

0 comments on commit d2660da

Please sign in to comment.